help-make
[Top][All Lists]
Advanced

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

multiple/hidden targets again


From: Alexander Frink
Subject: multiple/hidden targets again
Date: Tue, 21 Feb 2006 23:29:24 +0100 (CET)

Hi!

The problems around rules which create multiple targets have been
discussed here already several times, e.g. in
http://lists.gnu.org/archive/html/help-make/2003-11/msg00060.html
http://lists.gnu.org/archive/html/help-make/2005-03/msg00093.html
http://lists.gnu.org/archive/html/help-make/2005-10/msg00021.html

If I understand this correctly, the following example should work
when a rule creates two header files 'foo.h' and 'bar.h' from an
input file 'input' using a pseudo-target foobar (note that I
cannot use pattern rules, because 'foo', 'bar' and 'input' do not
have any stem in common). However I need two make invocations to
update the main target 'program' completely. This looks like a problem
with make's stat caching.

I have reproduced this with GNU make 3.80 on Debian, SuSE and AIX
and GNU make 3.81rc1. AIX's builtin make does not show this
behaviour. In rare cases also GNU make updates 'program' correctly
in one step.

If I change the line
foo.h bar.h: foobar
to an empty command
foo.h bar.h: foobar ;
everything works as expected (see debug output below), however
according to the manual "The only reason this is useful is to prevent
a target from getting implicit commands", which is not the case here.

So, is this a bug, a feature or am I doing anything wrong?

Regards,

Alex

# BEGIN MAKEFILE
program: foo.o bar.o
        @echo linking
        touch program

foo.o: foo.c foo.h
        @echo compiling foo
        touch foo.o

bar.o: bar.c bar.h
        @echo compiling bar
        touch bar.o

foo.h bar.h: foobar

foobar: input
        @echo creating foo.h
        touch foo.h
        @echo creating bar.h
        touch bar.h
        @echo creating foobar
        touch foobar
# END MAKEFILE

# BEGIN CONSOLE OUTPUT
address@hidden:~/maketest> make
make: `program' is up to date.

address@hidden:~/maketest> touch input

address@hidden:~/maketest> make
creating foo.h
touch foo.h
creating bar.h
touch bar.h
creating foobar
touch foobar
compiling bar
touch bar.o
linking
touch program

address@hidden:~/maketest> make
compiling foo
touch foo.o
linking
touch program
# END CONSOLE OUTPUT

# BEGIN EXTRACT OF make -d with foo.h bar.h: foobar
[...]
      Successfully remade target file `foobar'.
     Finished prerequisites of target file `foo.h'.
     Prerequisite `foobar' is newer than target `foo.h'.
    Must remake target `foo.h'.
    Successfully remade target file `foo.h'.
   Finished prerequisites of target file `foo.o'.
   Prerequisite `foo.c' is older than target `foo.o'.
   Prerequisite `foo.h' is older than target `foo.o'.
  No need to remake target `foo.o'.
[...]
# END EXTRACT OF make -d with foo.h bar.h: foobar

# BEGIN EXTRACT OF make -d with foo.h bar.h: foobar ;
[...]
      Successfully remade target file `foobar'.
     Finished prerequisites of target file `foo.h'.
     Prerequisite `foobar' is newer than target `foo.h'.
    Must remake target `foo.h'.
    Successfully remade target file `foo.h'.
   Finished prerequisites of target file `foo.o'.
   Prerequisite `foo.c' is older than target `foo.o'.
   Prerequisite `foo.h' is newer than target `foo.o'.
  Must remake target `foo.o'.
compiling foo
[...]
# END EXTRACT OF make -d with foo.h bar.h: foobar ;

-- 
Alexander Frink                      E-Mail: address@hidden
Institut fuer Physik                 Phone:  +49-6131-3923391
Johannes-Gutenberg-Universitaet
D-55099 Mainz, Germany





reply via email to

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