@true in makefiles

Rafael Ávila de Espíndola rafael.espindola@gmail.com
Sun Oct 23 22:07:00 GMT 2005


According to a comment in line 2694 of gcc/Makefile.in, a dummy command like 
@true must be added to a rule to "force gnu make to recheck modification 
times.".

But the GNU make manual says that a rule without a command simply states a 
dependency.

In gcc, many of those "dependency only" rules depend on a stamp. A 
hack that may be used to remove the stamp itself is to use a pattern rule 
where the % matches just a single character (the . for example).

Attached are three makefiles that illustrate the alternatives:
Makefile1: uses a pattern rule
Makefile2: uses a rule without a command
Makefile3: uses a rule with a dummy command (the current way)

All the three makefiles behave the same.

I will try to change gcc's makefiles and, if all goes well, submit a patch 
(for 4.2).

Rafael
-------------- next part --------------
all: foo.c bar.h

foo%c bar%h: gen
	touch foo.c
	touch bar.h
-------------- next part --------------
all: foo.c bar.h

foo.c bar.h: s-gen

s-gen: gen
	touch foo.c
	touch bar.h
	touch s-gen
-------------- next part --------------
all: foo.c bar.h

foo.c bar.h: s-gen
	@true

s-gen: gen
	touch foo.c
	touch bar.h
	touch s-gen


More information about the Gcc mailing list