URL: <http://savannah.gnu.org/bugs/?21670>
Summary: implicit rule ignored for prerequisite that is produced by .DEFAULT Project: make Submitted by: egerer Submitted on: Thursday 11/29/2007 at 12:52 Severity: 3 - Normal Item Group: Bug Status: None Privacy: Public Assigned to: None Open/Closed: Open Discussion Lock: Any Component Version: 3.81 Operating System: POSIX-Based Fixed Release: None _______________________________________________________ Details: I've found a problem with GNU make 3.81 (built for i686-pc-linux-gnu). The following makefile can be used to recreate the problem: # ------------------------------------- CC = cc .SUFFIXES: .SUFFIXES: .c .o .c.o: $(CC) -c $< .DEFAULT: @if [ -f backup/$< ]; then \ ln -s backup/$< . ;\ echo "ln -s backup/$< .";\ else \ echo "'$<' does not exist.";\ false;\ fi prog: hello.c hello.o $(CC) -o $@ hello.o # ------------------------------------- The directory that contains this makefile should also contain a subdirectory named "backup". That subdirectory should contain a simple C source file named "hello.c". Running "make" should create the file "hello.o" from the file "hello.c" that is produced (in the current directory) by the commands specified for the special built-in target ".DEFAULT". Creation of the file "hello.c" works fine, but "make" fails to produce "hello.o". Here are the commands to reproduce the problem: $ ls backup makefile $ ls backup hello.c $ cat backup/hello.c #include <stdio.h> int main(void) { printf("hello, world\n"); return 0; } $ make -r ln -s backup/hello.c . 'hello.o' does not exist. make: *** [hello.o] Error 1 $ ls backup hello.c makefile $ After this I've run "make" in the debug mode: $ rm hello.c $ make -rd | nl -ba 1 GNU Make 3.81 2 Copyright (C) 2006 Free Software Foundation, Inc. 3 This is free software; see the source for copying conditions. 4 There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A 5 PARTICULAR PURPOSE. 6 7 This program built for i686-pc-linux-gnu 8 Reading makefiles... 9 Reading makefile `makefile'... 10 Updating makefiles.... 11 Considering target file `makefile'. 12 Looking for an implicit rule for `makefile'. 13 No implicit rule found for `makefile'. 14 Using default commands for `makefile'. 15 Finished prerequisites of target file `makefile'. 16 No need to remake target `makefile'. 17 Updating goal targets.... 18 Considering target file `prog'. 19 File `prog' does not exist. 20 Considering target file `hello.c'. 21 File `hello.c' does not exist. 22 Looking for an implicit rule for `hello.c'. 23 No implicit rule found for `hello.c'. 24 Using default commands for `hello.c'. 25 Finished prerequisites of target file `hello.c'. 26 Must remake target `hello.c'. 27 Putting child 0x080774d8 (hello.c) PID 10332 on the chain. 28 Live child 0x080774d8 (hello.c) PID 10332 29 ln -s backup/hello.c . 30 Reaping winning child 0x080774d8 PID 10332 31 Removing child 0x080774d8 PID 10332 from chain. 32 Successfully remade target file `hello.c'. 33 Considering target file `hello.o'. 34 File `hello.o' does not exist. 35 Looking for an implicit rule for `hello.o'. 36 Trying pattern rule with stem `hello'. 37 Trying implicit prerequisite `hello.c'. 38 Trying pattern rule with stem `hello'. 39 Trying implicit prerequisite `hello.c'. 40 Looking for a rule with intermediate file `hello.c'. 41 Avoiding implicit rule recursion. 42 No implicit rule found for `hello.o'. 43 Using default commands for `hello.o'. 44 Finished prerequisites of target file `hello.o'. 45 Must remake target `hello.o'. 46 Putting child 0x080777f0 (hello.o) PID 10335 on the chain. 47 Live child 0x080777f0 (hello.o) PID 10335 48 'hello.o' does not exist. 49 Reaping losing child 0x080777f0 PID 10335 make: *** [hello.o] Error 1 50 Removing child 0x080777f0 PID 10335 from chain. When "make" looks for an implicit rule for "hello.o" (line 35-41) it should recognize that the target `hello.o' could be build from the implicit prerequisite `hello.c' by applying the command specified for the double-suffix rule ".c.o:" (line 6 of makefile). In my opinion, it is a bug that GNU make 3.81 finds no implicit rule for "hello.o" (line 42). _______________________________________________________ File Attachments: ------------------------------------------------------- Date: Thursday 11/29/2007 at 12:52 Name: makefile Size: 332B By: egerer <http://savannah.gnu.org/bugs/download.php?file_id=14507> ------------------------------------------------------- Date: Thursday 11/29/2007 at 12:52 Name: hello.c Size: 79B By: egerer <http://savannah.gnu.org/bugs/download.php?file_id=14508> _______________________________________________________ Reply to this item at: <http://savannah.gnu.org/bugs/?21670> _______________________________________________ Message sent via/by Savannah http://savannah.gnu.org/ _______________________________________________ Bug-make mailing list Bug-make@gnu.org http://lists.gnu.org/mailman/listinfo/bug-make