xref: /freebsd/contrib/bmake/unit-tests/suff-main-several.mk (revision 06b9b3e0ad0dc3f0166b3e8f26ced68c271cf527)
1# $NetBSD: suff-main-several.mk,v 1.1 2020/11/22 20:36:17 rillig Exp $
2#
3# Demonstrate that an inference rule is considered the main target if its
4# suffixes are not known at the point of declaration.
5
6.MAKEFLAGS: -dmps
7
8.1.2 .1.3 .1.4:
9	: Making ${.TARGET} from ${.IMPSRC}.
10
11# At this point, the above targets are normal targets.
12# The target '.1.2' is now the default main target.
13
14next-main:
15	: Making ${.TARGET}
16
17# At this point, 'next-main' is just a regular target.
18
19.SUFFIXES: .1 .2 .3 .4
20
21# Since the targets '.1.2', '.1.3' and '.1.4' have now been turned into
22# transformation rules, 'next-main' is the default main target now.
23
24.SUFFIXES: # clear all
25
26# At this point, 'next-main' is still the default main target, even though
27# it is not the first regular target anymore.
28
29# Define and undefine the suffixes, changing their order.
30# XXX: This should have no effect, but as of 2020-11-22, it does.
31# For some reason, mentioning the suffixes in reverse order disables them.
32.SUFFIXES: .4 .3 .2 .1
33.SUFFIXES: # none
34.SUFFIXES: .1 .2 .3 .4
35.SUFFIXES: # none
36.SUFFIXES: .4 .3 .2 .1
37
38suff-main-several.1:
39	: Making ${.TARGET} out of nothing.
40next-main: suff-main-several.{2,3,4}
41
42.MAKEFLAGS: -d0 -dg1
43