1 # $NetBSD: opt-no-action.mk,v 1.4 2020/11/09 20:50:56 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 .MAKEFLAGS: -n 8 9 # This command cannot be prevented from being run since it is used at parse 10 # time, and any later variable assignments may depend on its result. 11 != echo 'command during parsing' 1>&2; echo 12 13 all: main 14 all: run-always 15 16 # Both of these commands are printed, but only the '+' command is run. 17 .BEGIN: 18 @echo '$@: hidden command' 19 @+echo '$@: run always' 20 21 # Both of these commands are printed, but only the '+' command is run. 22 main: 23 @echo '$@: hidden command' 24 @+echo '$@: run always' 25 26 # None of these commands is printed, but both are run, because this target 27 # depends on the special source ".MAKE". 28 run-always: .MAKE 29 @echo '$@: hidden command' 30 @+echo '$@: run always' 31 32 # Both of these commands are printed, but only the '+' command is run. 33 .END: 34 @echo '$@: hidden command' 35 @+echo '$@: run always' 36