xref: /freebsd/contrib/bmake/unit-tests/depsrc-use.mk (revision 13ec1e3155c7e9bf037b12af186351b7fa9b9450)
1# $NetBSD: depsrc-use.mk,v 1.5 2021/12/28 14:22:51 rillig Exp $
2#
3# Tests for the special source .USE in dependency declarations,
4# which allows to append common commands to other targets.
5
6# Before make.h 1.280 from 2021-12-28, a .USEBEFORE target was accidentally
7# regarded as a candidate for the main target.  On the other hand, a .USE
8# target was not.
9not-a-main-candidate: .USE
10
11all: action directly
12
13first: .USE
14	@echo first 1		# Using ${.TARGET} here would expand to "action"
15	@echo first 2
16
17second: .USE
18	@echo second 1
19	@echo second 2
20
21# It's possible but uncommon to have a .USE target with no commands.
22# This may happen as the result of expanding a .for loop.
23empty: .USE
24
25# It's possible but uncommon to directly make a .USEBEFORE target.
26directly: .USE
27	@echo directly
28
29action: first second empty
30