Hello,

On openSUSE Tumbleweed with GNU make 4.4.1 installed.

Background:
* There are two (source) files foo.s and bar.s.
* These files are translated to %.o (object) and %.i (interface) files.
* Further requires the translation of foo.s that bar.i is present (import).
* Finally all %.o files are linked to target.

The following makefile uses a pattern rule with grouped target:

$ cat implicit.mk
MAKEFLAGS += -rR
objects = foo.o bar.o
target : $(objects)
        touch $@
%.o %.i : %.s
        touch $*.o $*.i
foo.o foo.i : bar.i
$

Running the script:

$ rm -f foo.* bar.* target
$ touch foo.s bar.s
$ make -f implicit.mk
touch bar.o bar.i
touch foo.o foo.i
touch target
$

Remove bar.o an run implicit.mk again:

$ rm bar.o
$ make -f implicit.mk
touch bar.o bar.i
touch target
$

Running implicit.mk again:

$ make -f implicit.mk
touch foo.o foo.i
touch target
$

The target is updated again even if nothing was changed!
Obviously the change of bar.i is not considered and the update of foo.o/foo.i 
is omitted.

If I use a script with explicit grouped target rules it works as expected:

$ cat explicit.mk
MAKEFLAGS += -rR
objects = foo.o bar.o
target : $(objects)
        touch $@
foo.o foo.i &: foo.s
        touch foo.o foo.i
bar.o bar.i &: bar.s
        touch bar.o bar.i
foo.o foo.i : bar.i
$

Running the script:

$ rm -f foo.* bar.* target
$ touch foo.s bar.s
$ make -f explicit.mk
touch bar.o bar.i
touch foo.o foo.i
touch target
$

Remove bar.o an run explicit.mk again:

$ rm bar.o
$ make -f explicit.mk
touch bar.o bar.i
touch foo.o foo.i
touch target
$

Running explicit.mk again:

$ make -f explicit.mk
make: 'target' is up to date.
$

It seems to be related to bug #66073. I THINK it should be corrected.

Regards Joerg






  • Unexpected behavior w... joergboe via Bug reports and discussion for GNU make

Reply via email to