[lug] OT: Makefile oddity

Tom Tromey tromey at redhat.com
Fri Apr 19 17:05:53 MDT 2002


>>>>> ">" == 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.

>> 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:

>> Unfortunately, make itself is saying "no, it is c++ source".

That's because make comes with a lot of default rules.

Tom



More information about the LUG mailing list