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