bug-make
[Top][All Lists]
Advanced

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

Make does not throw an error for target without a recipe?


From: Patrick Donnelly
Subject: Make does not throw an error for target without a recipe?
Date: Thu, 26 Jun 2014 16:19:53 -0400

See example:


---8<---
TARGETS = foo

all: $(TARGETS)

$(TARGETS): /etc/passwd
--->8---

This is the debug output I get from running this test.mk, comments inline:

$ make -f test.mk -d foo
GNU Make 4.0
Built for x86_64-unknown-linux-gnu
Copyright (C) 1988-2013 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Reading makefiles...
Reading makefile 'test.mk'...
Updating makefiles....
 Considering target file 'test.mk'.
  Looking for an implicit rule for 'test.mk'.
[...]

Why is it trying to build target test.mk...???


 File 'foo' does not exist.
 Looking for an implicit rule for 'foo'.
[...]
 No implicit rule found for 'foo'.
  Considering target file '/etc/passwd'.
   Looking for an implicit rule for '/etc/passwd'.
[...]
   No implicit rule found for '/etc/passwd'.
   Finished prerequisites of target file '/etc/passwd'.
  No need to remake target '/etc/passwd'.
 Finished prerequisites of target file 'foo'.
Must remake target 'foo'.
Successfully remade target file 'foo'.
make: Nothing to be done for 'foo'.

So the interesting thing here is that Make decides it needs to remake
`foo' but it doesn't do anything (based on strace output). Then it
decides it was successful? That doesn't make any sense... How do I get
Make to fail if it can't make the target? In case it matters, I'm
bringing this problem up because targets are not being created (as
expected) by implicit rules but I don't know this because make claims
success.

Thanks for any help,

-- 
Patrick Donnelly



reply via email to

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