xref: /freebsd/contrib/bmake/unit-tests/suff-main.mk (revision 956e45f6fb3e18b8e89b1341708db60c30bb9f27)
1*956e45f6SSimon J. Gerraty# $NetBSD: suff-main.mk,v 1.1 2020/10/18 16:33:18 rillig Exp $
2*956e45f6SSimon J. Gerraty#
3*956e45f6SSimon J. Gerraty# Demonstrate that an inference rule is considered the main target if its
4*956e45f6SSimon J. Gerraty# suffixes are not known at the point of declaration.
5*956e45f6SSimon J. Gerraty
6*956e45f6SSimon J. Gerraty.1.2:
7*956e45f6SSimon J. Gerraty	: Making ${.TARGET} from ${.IMPSRC}.
8*956e45f6SSimon J. Gerraty
9*956e45f6SSimon J. Gerraty# At this point, the target '.1.2' is a normal target.
10*956e45f6SSimon J. Gerraty# Since it is the first target in the first dependency declaration,
11*956e45f6SSimon J. Gerraty# it becomes the main target.
12*956e45f6SSimon J. Gerraty
13*956e45f6SSimon J. Gerratynext-main:
14*956e45f6SSimon J. Gerraty	: Making ${.TARGET}
15*956e45f6SSimon J. Gerraty
16*956e45f6SSimon J. Gerraty# At this point, 'next-main' is effectively ignored.
17*956e45f6SSimon J. Gerraty
18*956e45f6SSimon J. Gerraty# Declaring both '.1' and '.2' as suffixes turns the '.1.2' target into an
19*956e45f6SSimon J. Gerraty# inference rule (OP_TRANSFORM).  As a side effect, this target is no longer
20*956e45f6SSimon J. Gerraty# a candidate for the main target.  Therefore the next target is selected as
21*956e45f6SSimon J. Gerraty# the main target, which in this case is 'next-main'.
22*956e45f6SSimon J. Gerraty.SUFFIXES: .1 .2
23