1 1.7 rillig # $NetBSD: depsrc-usebefore.mk,v 1.7 2021/12/28 14:22:51 rillig Exp $ 2 1.1 rillig # 3 1.3 rillig # Tests for the special source .USEBEFORE in dependency declarations, 4 1.3 rillig # which allows to prepend common commands to other targets. 5 1.6 rillig # 6 1.6 rillig # See also: 7 1.6 rillig # .USE 8 1.6 rillig # depsrc-use.mk 9 1.1 rillig 10 1.7 rillig # Before make.h 1.280 from 2021-12-28, a .USEBEFORE target was accidentally 11 1.7 rillig # regarded as a candidate for the main target. On the other hand, a .USE 12 1.7 rillig # target was not. 13 1.7 rillig not-a-main-candidate: .USEBEFORE 14 1.7 rillig 15 1.3 rillig all: action directly 16 1.1 rillig 17 1.3 rillig first: .USEBEFORE 18 1.5 rillig @echo first 1 # Using ${.TARGET} here would expand to "action" 19 1.5 rillig @echo first 2 # Using ${.TARGET} here would expand to "action" 20 1.3 rillig 21 1.3 rillig second: .USEBEFORE 22 1.5 rillig @echo second 1 23 1.5 rillig @echo second 2 24 1.3 rillig 25 1.5 rillig # It is possible but uncommon to have a .USEBEFORE target with no commands. 26 1.4 rillig # This may happen as the result of expanding a .for loop. 27 1.3 rillig empty: .USEBEFORE 28 1.3 rillig 29 1.5 rillig # It is possible but uncommon to directly make a .USEBEFORE target. 30 1.3 rillig directly: .USEBEFORE 31 1.3 rillig @echo directly 32 1.3 rillig 33 1.3 rillig action: second first empty 34