Home | History | Annotate | Line # | Download | only in unit-tests
depsrc-usebefore.mk revision 1.6
      1 # $NetBSD: depsrc-usebefore.mk,v 1.6 2020/11/15 20:20:58 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 all: action directly
     11 
     12 first: .USEBEFORE
     13 	@echo first 1		# Using ${.TARGET} here would expand to "action"
     14 	@echo first 2		# Using ${.TARGET} here would expand to "action"
     15 
     16 second: .USEBEFORE
     17 	@echo second 1
     18 	@echo second 2
     19 
     20 # It is possible but uncommon to have a .USEBEFORE target with no commands.
     21 # This may happen as the result of expanding a .for loop.
     22 empty: .USEBEFORE
     23 
     24 # It is possible but uncommon to directly make a .USEBEFORE target.
     25 directly: .USEBEFORE
     26 	@echo directly
     27 
     28 action: second first empty
     29