bug-make
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[bug #47399] include sometimes fails for built files


From: Paul D. Smith
Subject: [bug #47399] include sometimes fails for built files
Date: Sun, 13 Mar 2016 01:25:30 +0000
User-agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:45.0) Gecko/20100101 Firefox/45.0

Update of bug #47399 (project make):

                  Status:                    None => Not A Bug              
             Open/Closed:                    Open => Closed                 

    _______________________________________________________

Follow-up Comment #1:

This isn't a bug: this is how make is documented to work with building
included makefiles; from the make manual "How Makefiles are Remade":

_After all makefiles have been checked, if any have actually been changed,
make starts with a clean slate and reads all the makefiles over again._

So, GNU make doesn't stop after the first included file, try to make it, and
if it succeeds re-exec itself right away.  Instead it will try to make ALL the
included makefiles it knows about, then afterwards if any of them have been
remade it will re-exec itself.

Since when make first reads the makefile there is no file "baz" and no target
that can build "baz", it fails.  This is the way make has always worked, and
always been intended to work; this feature was already present in GNU make in
1992, when the first set of source code was added to source control.

You have various choices: first, you can change your "include baz" line to
"-include" or "sinclude" which will prevent GNU make from failing if the "baz"
makefile doesn't exist.  It will then remake "bar", ignore the fact that "baz"
doesn't exist, re-exec, find a rule to build "baz", build that, re-exec, and
complete as expected.

Alternatively, you can move the "include baz" line into the "bar" makefile so
that make cannot see it until after "bar" has been created and make has
re-exec'd to read it.  Or you can do a similar thing without moving "include
bar" but using make's if conditionals to make the "include baz" invisible
unless "bar" has been included: testing some variable defined only in "bar"
for example, or even just filtering MAKEFILE_LIST to see if "bar" is present
in it.

FWIW, the correct title of Orwell's work is "Nineteen Eighty-Four", not
"Nineteen Hundred Eight Four".  Although I have no idea if that would be
accepted or if the "it's a date" is supposed to be a hint that it wants the
numeric "1984".

    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?47399>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]