shortest stem
Boris Kolpackov <[email protected]>
| Newsgroups | gmane.comp.gnu.make.devel |
|---|---|
| Organization | Code Synthesis Tools CC |
| Message-ID | <[email protected]> |
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