1# $NetBSD: suffixes.mk,v 1.3 2014/08/30 22:21:08 sjg Exp $
2
3# Issues from PR 49086
4
5# Issue 3: single suffix rules remain active after .SUFFIXES is cleared
6#
7# There's a rule for issue3.a, but .a is no longer a known suffix when
8# targets are being made, so issue3 should not get made.
9all: issue3
10
11# Issue 4: suffix rules do not become regular rules when .SUFFIXES is cleared
12#
13# When the rules were encountered, .a and .b were known suffices, but later
14# on they were forgotten.  These should get created as regular targets.
15all: .a .a.b .b.a
16
17# Issue 5: adding more suffixes does not make existing rules into suffix rules
18#
19# When the targets .c.d, .d.c, .d, .d.e, and .e.d were encountered, only .a,
20# .b and .c were known suffixes, so all of them were regular rules.  Later
21# rest of the suffixes were made known, so they should all be suffix
22# transformation rules.
23all: issue5a.d issue5b.c issue5c issue5d.e issue5e.d
24
25# Issue 6: transformation search can end up in an infinite loop
26#
27# There is no file or target from which issue6.f could be made from so
28# this should fail.  The bug was that because rules .e.f, .d.e and .e.d
29# exist, make would try to make .f from .e and then infinitely try
30# to do .e from .d and vice versa.
31all: issue6.f
32
33# Issue 10: explicit dependencies affect transformation rule selection
34#
35# If issue10.e is wanted and both issue10.d and issue10.f are available,
36# make should choose the .d.e rule, because .d is before .f in .SUFFIXES.
37# The bug was that if issue10.d had an explicit dependency on issue10.f,
38# it would choose .f.e instead.
39all: issue10.e
40
41# Issue 11: sources from transformation rules are expanded incorrectly
42#
43# issue11.j should depend on issue11.i and issue11.second and issue11.i
44# should depend on issue11.h and issue11.first.  The bug was that
45# the dynamic sources were expanded before ${.PREFIX} and ${.TARGET} were
46# available, so they would have expanded to a null string.
47all: issue11.j
48
49# we need to clean for repeatable results
50.BEGIN: clean
51clean:
52	@rm -f issue* .[ab]*
53
54.SUFFIXES: .a .b .c
55
56.a .a.b .b.a:
57	@echo 'There should be no text after the colon: ${.IMPSRC}'
58	touch ${.TARGET}
59
60.c.d .d.c .d .d.e .e.d:
61	@echo 'first set'
62	cp ${.IMPSRC} ${.TARGET}
63
64.SUFFIXES:
65.SUFFIXES: .c .d .e .f .g
66
67.e .e.f .f.e:
68	@echo 'second set'
69	cp ${.IMPSRC} ${.TARGET}
70
71issue3.a:
72	@echo 'There is a bug if you see this.'
73	touch ${.TARGET}
74
75issue5a.c issue5b.d issue5c.d issue5d.d issue5e.e issue10.d issue10.f:
76	touch ${.TARGET}
77
78.SUFFIXES: .h .i .j
79
80.h.i: ${.PREFIX}.first
81	@echo '.ALLSRC: ${.ALLSRC}'
82	cp ${.IMPSRC} ${.TARGET}
83
84.i.j: ${.PREFIX}.second
85	@echo '.ALLSRC: ${.ALLSRC}'
86	cp ${.IMPSRC} ${.TARGET}
87
88issue11.h issue11.first issue11.second:
89	touch ${.TARGET}
90