make(1): extend test for .USEBEFORE

When several .USEBEFORE targets are added to another target, they are
added in reverse order.  But the commands of each .USEBEFORE target are
added in normal order.
This commit is contained in:
rillig 2020-08-22 11:53:18 +00:00
parent e997d2617b
commit d0ec70b66a
2 changed files with 11 additions and 7 deletions

View File

@ -1,4 +1,6 @@
first
second
first 1
first 2
second 1
second 2
directly
exit status 0

View File

@ -1,4 +1,4 @@
# $NetBSD: depsrc-usebefore.mk,v 1.4 2020/08/22 07:49:44 rillig Exp $
# $NetBSD: depsrc-usebefore.mk,v 1.5 2020/08/22 11:53:18 rillig Exp $
#
# Tests for the special source .USEBEFORE in dependency declarations,
# which allows to prepend common commands to other targets.
@ -6,16 +6,18 @@
all: action directly
first: .USEBEFORE
@echo first # Using ${.TARGET} here would expand to "action"
@echo first 1 # Using ${.TARGET} here would expand to "action"
@echo first 2 # Using ${.TARGET} here would expand to "action"
second: .USEBEFORE
@echo second
@echo second 1
@echo second 2
# It's possible but uncommon to have a .USEBEFORE target with no commands.
# It is possible but uncommon to have a .USEBEFORE target with no commands.
# This may happen as the result of expanding a .for loop.
empty: .USEBEFORE
# It's possible but uncommon to directly make a .USEBEFORE target.
# It is possible but uncommon to directly make a .USEBEFORE target.
directly: .USEBEFORE
@echo directly