xref: /freebsd/contrib/bmake/unit-tests/depsrc-usebefore.mk (revision cfd6422a5217410fbd66f7a7a8a64d9d85e61229)
1# $NetBSD: depsrc-usebefore.mk,v 1.6 2020/11/15 20:20:58 rillig Exp $
2#
3# Tests for the special source .USEBEFORE in dependency declarations,
4# which allows to prepend common commands to other targets.
5#
6# See also:
7#	.USE
8#	depsrc-use.mk
9
10all: action directly
11
12first: .USEBEFORE
13	@echo first 1		# Using ${.TARGET} here would expand to "action"
14	@echo first 2		# Using ${.TARGET} here would expand to "action"
15
16second: .USEBEFORE
17	@echo second 1
18	@echo second 2
19
20# It is possible but uncommon to have a .USEBEFORE target with no commands.
21# This may happen as the result of expanding a .for loop.
22empty: .USEBEFORE
23
24# It is possible but uncommon to directly make a .USEBEFORE target.
25directly: .USEBEFORE
26	@echo directly
27
28action: second first empty
29