bug-make
[Top][All Lists]
Advanced

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

[bug #55242] Included Makefile not found, no rule to build it but make d


From: Paul D. Smith
Subject: [bug #55242] Included Makefile not found, no rule to build it but make does not fail
Date: Sun, 28 Nov 2021 16:42:28 -0500 (EST)
User-agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.45 Safari/537.36

Follow-up Comment #3, bug #55242 (project make):

I tried these patches (some updates were needed as remake.c has changed
slightly).  They do fix the original issue but I thought of a new test to
add:

# Allow included files to be updated as side-effects of prereqs.  Here a.mk
# already exists, but b (which is rebuilt) updates it so we should re-exec.

touch('a.mk');
unlink('b');

run_make_test(q!
all:; @echo hello=$(hello)
include a.mk
a.mk: b
b: ; @echo hello=world >a.mk
!, '', "touch b\nhello=world");


This does not pass; even though a.mk was rebuilt we don't re-exec because a.mk
was pre-existing, we don't look to see if it's timestamp has changed.

We could continue on to fix this too, but I'm not convinced we should do
that.

In general, make doesn't actually check timestamps of targets unless make
believes that they've been updated.  I'm not sure that it's correct to break
this general rule and do something unique and special for rebuilt makefiles in
particular (or, I guess, this patch does something special for goal targets).

The way to "correct" the original makefile provided in the bug is the same as
when you run into this situation in any other target which is not an included
makefile: it is to add a recipe to the *a.mk* rule.  The recipe can be a "do
nothing" empty recipe: as long as make sees there is SOME recipe then it will
consider the target updated.

So for example, instead of this:

all:; @echo hello=$(hello)
include a.mk
a.mk: b
b: ; @echo hello=world >a.mk

if you added a semicolon (empty recipe) to *a.mk* like this:

all:; @echo hello=$(hello)
include a.mk
a.mk: b ;
b: ; @echo hello=world >a.mk

then it would work fine.

My inclination is to close this as "Not a Bug".

Comments welcome.

    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?55242>

_______________________________________________
  Message sent via Savannah
  https://savannah.gnu.org/




reply via email to

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