xref: /freebsd/contrib/bmake/unit-tests/suff-main.mk (revision e6bfd18d21b225af6a0ed67ceeaf1293b7b9eba5)
1# $NetBSD: suff-main.mk,v 1.1 2020/10/18 16:33:18 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.1.2:
7	: Making ${.TARGET} from ${.IMPSRC}.
8
9# At this point, the target '.1.2' is a normal target.
10# Since it is the first target in the first dependency declaration,
11# it becomes the main target.
12
13next-main:
14	: Making ${.TARGET}
15
16# At this point, 'next-main' is effectively ignored.
17
18# Declaring both '.1' and '.2' as suffixes turns the '.1.2' target into an
19# inference rule (OP_TRANSFORM).  As a side effect, this target is no longer
20# a candidate for the main target.  Therefore the next target is selected as
21# the main target, which in this case is 'next-main'.
22.SUFFIXES: .1 .2
23