Makefile question with no answer?
Bair,Paul A.
PABAIR at mitre.org
Mon May 15 13:52:00 EDT 2006
On Mon, 2006-05-15 at 13:35 -0400, Steven W. Orr wrote:
> I suspect that there is no answer to what I'm looking for, but if the
> answer exists I'll probably get it here.
>
There are answers, but it really depends on your Makefile and the
complexity of what you're dealing with.
> I have a Makefile of normal industrial complexity. It builds a huge
> variety of different things, .o's, executables, libs, .PHONYs, etc..
>
> It sincludes a collection of other files.
>
> I want to add a line in one place that will cause *all* targets to have a
> new dependency added to it.
You *might* be able to accomplish this task IF all targets share the
same macro as a dependency. If this is true, just add the dependency to
the end of the macro. In the example below, you would just need to tack
a new dependency onto the INCLUDES macro. This, of course, could get
very messy and become a mainenance nightmare if the dependency is not an
actual include. But, you could do it.
INCLUDES = foo.h bar.h
foo: ${INCLUDES}
bar: ${INCLUDES}
Bottom line is that you'll have to identify something common to all
targets, which might not be the case.
>
> make all or here or there or clean or whatever, I want any make to all of
> a sudden check for newthing as a required target but I want to do it by
> adding a one-liner someplace.
Personally, I would go thru all targets and add the dependency to the
appropriate targets. That might take more up-front time, but may reduce
the down-stream maintenance time and head-scratching.
Andy
More information about the gnhlug-discuss
mailing list