Home | History | Annotate | Line # | Download | only in unit-tests
opt-no-action.mk revision 1.3
      1 # $NetBSD: opt-no-action.mk,v 1.3 2020/08/19 05:25:26 rillig Exp $
      2 #
      3 # Tests for the -n command line option, which runs almost no commands.
      4 # It just outputs them, to be inspected by human readers.
      5 # Only commands that are in a .MAKE target or prefixed by '+' are run.
      6 
      7 # This command cannot be prevented from being run since it is used at parse
      8 # time, and any later variable assignments may depend on its result.
      9 !=	echo 'command during parsing' 1>&2; echo
     10 
     11 all: main
     12 all: run-always
     13 
     14 # Both of these commands are printed, but only the '+' command is run.
     15 .BEGIN:
     16 	@echo '$@: hidden command'
     17 	@+echo '$@: run always'
     18 
     19 # Both of these commands are printed, but only the '+' command is run.
     20 main:
     21 	@echo '$@: hidden command'
     22 	@+echo '$@: run always'
     23 
     24 # None of these commands is printed, but both are run, because this target
     25 # depends on the special source ".MAKE".
     26 run-always: .MAKE
     27 	@echo '$@: hidden command'
     28 	@+echo '$@: run always'
     29 
     30 # Both of these commands are printed, but only the '+' command is run.
     31 .END:
     32 	@echo '$@: hidden command'
     33 	@+echo '$@: run always'
     34