1 1.6 rillig # $NetBSD: suff-rebuild.mk,v 1.6 2020/11/21 12:01:16 rillig Exp $ 2 1.1 rillig # 3 1.1 rillig # Demonstrates what happens to transformation rules (called inference rules 4 1.1 rillig # by POSIX) when all suffixes are deleted. 5 1.1 rillig 6 1.1 rillig all: suff-rebuild-example 7 1.1 rillig 8 1.5 rillig .MAKEFLAGS: -dpst 9 1.5 rillig 10 1.1 rillig .SUFFIXES: 11 1.1 rillig 12 1.1 rillig .SUFFIXES: .a .b .c 13 1.1 rillig 14 1.1 rillig suff-rebuild-example.a: 15 1.4 rillig : Making ${.TARGET} out of nothing. 16 1.1 rillig 17 1.1 rillig .a.b: 18 1.4 rillig : Making ${.TARGET} from ${.IMPSRC}. 19 1.1 rillig .b.c: 20 1.4 rillig : Making ${.TARGET} from ${.IMPSRC}. 21 1.1 rillig .c: 22 1.4 rillig : Making ${.TARGET} from ${.IMPSRC}. 23 1.1 rillig 24 1.3 rillig # XXX: At a quick glance, the code in SuffUpdateTarget looks as if it were 25 1.1 rillig # possible to delete the suffixes in the middle of the makefile, add back 26 1.1 rillig # the suffixes from before, and have the transformation rules preserved. 27 1.1 rillig # 28 1.1 rillig # As of 2020-09-25, uncommenting the following line results in the error 29 1.1 rillig # message "don't know how to make suff-rebuild-example" though. 30 1.1 rillig # 31 1.6 rillig # If this is a bug, the actual cause is probably that when a suffix 32 1.6 rillig # transformation rule is defined, it is not added to the global list of 33 1.6 rillig # targets, see Suff_EndTransform. Later, UpdateTargets iterates over exactly 34 1.6 rillig # this global list of targets though. 35 1.6 rillig # 36 1.6 rillig # If UpdateTargets were to iterate over 'transforms' as well, it still 37 1.6 rillig # wouldn't work because the condition 'ptr == target->name' skips these 38 1.6 rillig # transformation rules. 39 1.6 rillig 40 1.1 rillig #.SUFFIXES: 41 1.1 rillig 42 1.1 rillig # Add the suffixes back. It should not matter that the order of the suffixes 43 1.1 rillig # is different from before. 44 1.1 rillig .SUFFIXES: .c .b .a 45