make-alpha
[Top][All Lists]
Advanced

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

shortest stem


From: Boris Kolpackov
Subject: shortest stem
Date: Wed, 23 Sep 2009 16:39:36 +0200
User-agent: Mutt/1.5.18 (2008-05-17)

Hi Paul, All,

I have implemented the shortest stem enhancement for pattern-
specific variable and pattern rules. With this change, GNU
make selects the most specific pattern. Just to recap, for 
pattern-specific variables:

%-pic.o: CFLAGS := -g -fPIC
%.o: CFLAGS := -g

foo-pic.o: foo.c
        @echo $(CFLAGS)

This makefile currently prints '-g'. For pattern rules:

%.o: %.c
        @echo normal

%-mt.o: %-mt.c
        @echo multi-threaded

all: foo-mt.o
foo-mt.c:

This makefile currently prints 'normal'. Changing the order of
the patterns in both makefiles results in the expected behavior.

I am wondering whether this should be enabled by default or only
enabled on request. The implementation is quite compact and the 
performance is unchanged (actually, the performance has improved
slightly as a consequence of a bugfix I made in implicit.c). I 
tested it on my project which has 884 pattern rules and 7361 
pattern-specific variables (non-recursive build system).

While the behavior is not exactly backwards-compatible, I don't
think we actually specify anywhere in which order patterns are
evaluated and I don't think anyone relies on the current behavior,
except maybe accidently. On the other hand, I found a couple of
emails in the archive where people were surprised by the current
behavior and thought it was a bug.

Boris




reply via email to

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