[lug] OT: Makefile oddity

D. Stimits stimits at idcomm.com
Fri Apr 19 22:52:33 MDT 2002


Tom Tromey wrote:
> 
> >>>>> ">" == D Stimits <stimits at idcomm.com> writes:
> 
> >> So if I use "include Makefile.custom", and the only thing in it is
> >> "PROJECT1_SUBDIR=/usr/local/src", then it will always try to build
> >> Makefile.custom?
> 
> Yes.
> 
> >> I have no Makefile targets
> 
> Right, but that doesn't matter.  GNU make first tries to make sure
> that Makefile is up-to-date.  So it searches for a rule to build
> Makefile, which is what you're seeing in the debug output.  It also
> does this processing for included files.

Ok, so it is obligated to test the Makefile.whatever as if it is source.

> 
> >> From what I read, "include Makefile.custom" should do only one
> >> thing: Insert the contents of Makefile.custom as if it were part of
> >> the original Makefile.
> 
> I see this in (make)Include:
> 
>        If an included makefile cannot be found in any of these directories,
>     a warning message is generated, but it is not an immediately fatal
>     error; processing of the makefile containing the `include' continues.
>     Once it has finished reading makefiles, `make' will try to remake any
>     that are out of date or don't exist.  *Note How Makefiles Are Remade:

I keep trying to say, there is NO error message, and it DOES compile
what I expect. Variables and everything is technically working. The
problem is some oddness where a fresh build does everything right, but
if any dependency is out, it tries to double rebuild all things; those
that are not out of date get "target is up to date" twice (no job server
running, this is all a single -j1). Now I know that the dependencies are
right, and I have added echo statements to some of the macro definitions
like $?, $@, $*, and $<, just to verify that it is being told to compile
only one file: It is. But then it turns around and tries to do more than
it should. It is a VERY simple Makefile setup, aside from having a lot
of files and using include to divide directories. Despite being
technically correct with too much scroll from things it shouldn't be
trying to do, there is nothing wrong with it. The scroll though would be
a "political fiasco" in trying to get the new format accepted. And
unless this format is accepted, there will never be cvs nor autoconf, it
simply cannot happen in one step.

D. Stimits, stimits at idcomm.com

> 
> >> Unfortunately, make itself is saying "no, it is c++ source".
> 
> That's because make comes with a lot of default rules.
> 
> Tom
> _______________________________________________
> Web Page:  http://lug.boulder.co.us
> Mailing List: http://lists.lug.boulder.co.us/mailman/listinfo/lug



More information about the LUG mailing list