>> 1. For the code that I'm supporting includes are rarely changed.
> All the more reason to ensure dependencies are updated automatically, as
people will forget to do it otherwise.
You are doing exactly Basic Auto-dependencies. But that works because>
of the re-exec if include files are rebuilt
I don't think that's true, as the author explains in regards to the basic method:
"Let’s address the first problem above: the re-invocation of
make. If you think about it, this re-invocation is really not necessary. Since we know some
prerequisite of the target changed, we must rebuild the target; having a
more up-to-date list won’t affect that decision. What we really need
is to ensure that the prerequisite list is up-to-date for the next invocation of make, when we need to decide whether to update it again."
>> 3. I want to have a nodepend rule that will not rebuild dependencies
>> in order to save time
> I don't know what you mean by this... how do you think this would work?
If you run "make nodepend" then it would do the same thing as "make all"
but it wouldn't rebuild dependencies? Or something?"
I was thinking to build the objects but not the dependencies. We do a lot of one-time only builds, where we don't need dependencies at all. Actually previously we were just using batch and shell scripts for builds, which are time consuming to support and maintain. In my defense I didn't make the decision to do this.>
I guess you could do something hacky like this:>
I want it be maintainable by others too. What I'm hearing is that it's not a good idea to use dependencies as targets.
> It does, actually. You've modified the generated a.d file so that you
> declare that a.d depends on a.h. Then you touch a.h.
Now when make reads the makefile and sees "include a.d" it will try to
rebuild a.d because it's an included makefile; it doesn't matter that
the goal target is "a.o", make will try to build all the included
makefiles. Then after a.d is built, make re-execs and builds the
original goal target "a.o".
So make will always check if included targets are up to date and run them if they are not, got it. Now it makes sense.
I'll use this advanced method from the article.
Thank you for your help.