depsrc-use.mk revision 1.6 1 # $NetBSD: depsrc-use.mk,v 1.6 2022/04/18 14:38:24 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 # See also:
7 # .USEBEFORE
8 # depsrc-usebefore.mk
9
10 # Before make.h 1.280 from 2021-12-28, a .USEBEFORE target was accidentally
11 # regarded as a candidate for the main target. On the other hand, a .USE
12 # target was not.
13 not-a-main-candidate: .USE
14
15 all: action directly
16
17 first: .USE first-first first-second
18 @echo first 1 # Using ${.TARGET} here would expand to "action"
19 @echo first 2
20 first-first: .USE
21 @echo first-first 1
22 @echo first-first 2
23 first-second: .USE
24 @echo first-second 1
25 @echo first-second 2
26
27 second: .USE
28 @echo second 1
29 @echo second 2
30
31 # It's possible but uncommon to have a .USE target with no commands.
32 # This may happen as the result of expanding a .for loop.
33 empty: .USE
34
35 # It's possible but uncommon to directly make a .USE target.
36 directly: .USE
37 @echo directly
38
39 action: first second empty
40