1281760Ssjg# $NetBSD: suffixes.mk,v 1.3 2014/08/30 22:21:08 sjg Exp $
2281760Ssjg
3281760Ssjg# Issues from PR 49086
4281760Ssjg
5281760Ssjg# Issue 3: single suffix rules remain active after .SUFFIXES is cleared
6281760Ssjg#
7281760Ssjg# There's a rule for issue3.a, but .a is no longer a known suffix when
8281760Ssjg# targets are being made, so issue3 should not get made.
9281760Ssjgall: issue3
10281760Ssjg
11281760Ssjg# Issue 4: suffix rules do not become regular rules when .SUFFIXES is cleared
12281760Ssjg#
13281760Ssjg# When the rules were encountered, .a and .b were known suffices, but later
14281760Ssjg# on they were forgotten.  These should get created as regular targets.
15281760Ssjgall: .a .a.b .b.a
16281760Ssjg
17281760Ssjg# Issue 5: adding more suffixes does not make existing rules into suffix rules
18281760Ssjg#
19281760Ssjg# When the targets .c.d, .d.c, .d, .d.e, and .e.d were encountered, only .a,
20281760Ssjg# .b and .c were known suffixes, so all of them were regular rules.  Later
21281760Ssjg# rest of the suffixes were made known, so they should all be suffix
22281760Ssjg# transformation rules.
23281760Ssjgall: issue5a.d issue5b.c issue5c issue5d.e issue5e.d
24281760Ssjg
25281760Ssjg# Issue 6: transformation search can end up in an infinite loop
26281760Ssjg#
27281760Ssjg# There is no file or target from which issue6.f could be made from so
28281760Ssjg# this should fail.  The bug was that because rules .e.f, .d.e and .e.d
29281760Ssjg# exist, make would try to make .f from .e and then infinitely try
30281760Ssjg# to do .e from .d and vice versa.
31281760Ssjgall: issue6.f
32281760Ssjg
33281760Ssjg# Issue 10: explicit dependencies affect transformation rule selection
34281760Ssjg#
35281760Ssjg# If issue10.e is wanted and both issue10.d and issue10.f are available,
36281760Ssjg# make should choose the .d.e rule, because .d is before .f in .SUFFIXES.
37281760Ssjg# The bug was that if issue10.d had an explicit dependency on issue10.f,
38281760Ssjg# it would choose .f.e instead.
39281760Ssjgall: issue10.e
40281760Ssjg
41281760Ssjg# Issue 11: sources from transformation rules are expanded incorrectly
42281760Ssjg#
43281760Ssjg# issue11.j should depend on issue11.i and issue11.second and issue11.i
44281760Ssjg# should depend on issue11.h and issue11.first.  The bug was that
45281760Ssjg# the dynamic sources were expanded before ${.PREFIX} and ${.TARGET} were
46281760Ssjg# available, so they would have expanded to a null string.
47281760Ssjgall: issue11.j
48281760Ssjg
49281760Ssjg# we need to clean for repeatable results
50281760Ssjg.BEGIN: clean
51281760Ssjgclean:
52281760Ssjg	@rm -f issue* .[ab]*
53281760Ssjg
54281760Ssjg.SUFFIXES: .a .b .c
55281760Ssjg
56281760Ssjg.a .a.b .b.a:
57281760Ssjg	@echo 'There should be no text after the colon: ${.IMPSRC}'
58281760Ssjg	touch ${.TARGET}
59281760Ssjg
60281760Ssjg.c.d .d.c .d .d.e .e.d:
61281760Ssjg	@echo 'first set'
62281760Ssjg	cp ${.IMPSRC} ${.TARGET}
63281760Ssjg
64281760Ssjg.SUFFIXES:
65281760Ssjg.SUFFIXES: .c .d .e .f .g
66281760Ssjg
67281760Ssjg.e .e.f .f.e:
68281760Ssjg	@echo 'second set'
69281760Ssjg	cp ${.IMPSRC} ${.TARGET}
70281760Ssjg
71281760Ssjgissue3.a:
72281760Ssjg	@echo 'There is a bug if you see this.'
73281760Ssjg	touch ${.TARGET}
74281760Ssjg
75281760Ssjgissue5a.c issue5b.d issue5c.d issue5d.d issue5e.e issue10.d issue10.f:
76281760Ssjg	touch ${.TARGET}
77281760Ssjg
78281760Ssjg.SUFFIXES: .h .i .j
79281760Ssjg
80281760Ssjg.h.i: ${.PREFIX}.first
81281760Ssjg	@echo '.ALLSRC: ${.ALLSRC}'
82281760Ssjg	cp ${.IMPSRC} ${.TARGET}
83281760Ssjg
84281760Ssjg.i.j: ${.PREFIX}.second
85281760Ssjg	@echo '.ALLSRC: ${.ALLSRC}'
86281760Ssjg	cp ${.IMPSRC} ${.TARGET}
87281760Ssjg
88281760Ssjgissue11.h issue11.first issue11.second:
89281760Ssjg	touch ${.TARGET}
90