xref: /freebsd/contrib/bmake/unit-tests/opt-no-action.mk (revision e2eeea75eb8b6dd50c1298067a0655880d186734)
1*e2eeea75SSimon J. Gerraty# $NetBSD: opt-no-action.mk,v 1.4 2020/11/09 20:50:56 rillig Exp $
22c3632d1SSimon J. Gerraty#
32c3632d1SSimon J. Gerraty# Tests for the -n command line option, which runs almost no commands.
42c3632d1SSimon J. Gerraty# It just outputs them, to be inspected by human readers.
52c3632d1SSimon J. Gerraty# Only commands that are in a .MAKE target or prefixed by '+' are run.
62c3632d1SSimon J. Gerraty
7*e2eeea75SSimon J. Gerraty.MAKEFLAGS: -n
8*e2eeea75SSimon J. Gerraty
92c3632d1SSimon J. Gerraty# This command cannot be prevented from being run since it is used at parse
102c3632d1SSimon J. Gerraty# time, and any later variable assignments may depend on its result.
112c3632d1SSimon J. Gerraty!=	echo 'command during parsing' 1>&2; echo
122c3632d1SSimon J. Gerraty
132c3632d1SSimon J. Gerratyall: main
142c3632d1SSimon J. Gerratyall: run-always
152c3632d1SSimon J. Gerraty
162c3632d1SSimon J. Gerraty# Both of these commands are printed, but only the '+' command is run.
172c3632d1SSimon J. Gerraty.BEGIN:
182c3632d1SSimon J. Gerraty	@echo '$@: hidden command'
192c3632d1SSimon J. Gerraty	@+echo '$@: run always'
202c3632d1SSimon J. Gerraty
212c3632d1SSimon J. Gerraty# Both of these commands are printed, but only the '+' command is run.
222c3632d1SSimon J. Gerratymain:
232c3632d1SSimon J. Gerraty	@echo '$@: hidden command'
242c3632d1SSimon J. Gerraty	@+echo '$@: run always'
252c3632d1SSimon J. Gerraty
262c3632d1SSimon J. Gerraty# None of these commands is printed, but both are run, because this target
272c3632d1SSimon J. Gerraty# depends on the special source ".MAKE".
282c3632d1SSimon J. Gerratyrun-always: .MAKE
292c3632d1SSimon J. Gerraty	@echo '$@: hidden command'
302c3632d1SSimon J. Gerraty	@+echo '$@: run always'
312c3632d1SSimon J. Gerraty
322c3632d1SSimon J. Gerraty# Both of these commands are printed, but only the '+' command is run.
332c3632d1SSimon J. Gerraty.END:
342c3632d1SSimon J. Gerraty	@echo '$@: hidden command'
352c3632d1SSimon J. Gerraty	@+echo '$@: run always'
36