1# $NetBSD: depsrc-usebefore.mk,v 1.7 2021/12/28 14:22:51 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 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: .USEBEFORE 14 15all: action directly 16 17first: .USEBEFORE 18 @echo first 1 # Using ${.TARGET} here would expand to "action" 19 @echo first 2 # Using ${.TARGET} here would expand to "action" 20 21second: .USEBEFORE 22 @echo second 1 23 @echo second 2 24 25# It is possible but uncommon to have a .USEBEFORE target with no commands. 26# This may happen as the result of expanding a .for loop. 27empty: .USEBEFORE 28 29# It is possible but uncommon to directly make a .USEBEFORE target. 30directly: .USEBEFORE 31 @echo directly 32 33action: second first empty 34