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.
13not-a-main-candidate: .USE
14
15all: action directly
16
17first: .USE first-first first-second
18          @echo first 1                 # Using ${.TARGET} here would expand to "action"
19          @echo first 2
20first-first: .USE
21          @echo first-first 1
22          @echo first-first 2
23first-second: .USE
24          @echo first-second 1
25          @echo first-second 2
26
27second: .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.
33empty: .USE
34
35# It's possible but uncommon to directly make a .USE target.
36directly: .USE
37          @echo directly
38
39action: first second empty
40