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