Home | History | Annotate | Line # | Download | only in unit-tests
      1  1.4  rillig # $NetBSD: sh-dots.mk,v 1.4 2023/11/19 21:47:52 rillig Exp $
      2  1.1  rillig #
      3  1.1  rillig # Tests for the special shell command line "...", which does not run the
      4  1.1  rillig # commands below it but appends them to the list of commands that are run
      5  1.1  rillig # at the end.
      6  1.1  rillig 
      7  1.2  rillig .MAKEFLAGS: -d0			# switch stdout to being line-buffered
      8  1.2  rillig 
      9  1.3  rillig all: first hidden repeated commented indirect indirect-space
     10  1.1  rillig 
     11  1.1  rillig # The ${.TARGET} correctly expands to the target name, even though the
     12  1.1  rillig # commands are run separately from the main commands.
     13  1.1  rillig first:
     14  1.1  rillig 	@echo first ${.TARGET}
     15  1.1  rillig 	...
     16  1.1  rillig 	@echo first delayed ${.TARGET}
     17  1.1  rillig 
     18  1.1  rillig # The dots cannot be prefixed by the usual @-+ characters.
     19  1.1  rillig # They must be written exactly as dots.
     20  1.1  rillig hidden: .IGNORE
     21  1.1  rillig 	@echo hidden ${.TARGET}
     22  1.1  rillig 	@...
     23  1.1  rillig 	@echo hidden delayed ${.TARGET}
     24  1.1  rillig 
     25  1.1  rillig # Since the shell command lines don't recognize '#' as comment character,
     26  1.1  rillig # the "..." is not interpreted specially here.
     27  1.1  rillig commented: .IGNORE
     28  1.1  rillig 	@echo commented ${.TARGET}
     29  1.1  rillig 	...	# Run the below commands later
     30  1.1  rillig 	@echo commented delayed ${.TARGET}
     31  1.1  rillig 
     32  1.4  rillig # The dots don't have to be written literally, they can also come from an
     33  1.4  rillig # expression.
     34  1.3  rillig indirect:
     35  1.3  rillig 	@echo indirect regular
     36  1.3  rillig 	${:U...}
     37  1.3  rillig 	@echo indirect deferred
     38  1.3  rillig 
     39  1.3  rillig # If the dots are followed by a space, that space is part of the command and
     40  1.3  rillig # thus does not defer the command below it.
     41  1.3  rillig indirect-space: .IGNORE
     42  1.3  rillig 	@echo indirect-space regular
     43  1.3  rillig 	${:U... }
     44  1.3  rillig 	@echo indirect-space deferred
     45  1.3  rillig 
     46  1.3  rillig 
     47  1.1  rillig # The "..." can appear more than once, even though that doesn't make sense.
     48  1.1  rillig # The second "..." is a no-op.
     49  1.1  rillig repeated: .IGNORE
     50  1.1  rillig 	@echo repeated ${.TARGET}
     51  1.1  rillig 	...
     52  1.1  rillig 	@echo repeated delayed ${.TARGET}
     53  1.1  rillig 	...
     54  1.1  rillig 	@echo repeated delayed twice ${.TARGET}
     55