1 1.7 rillig # $NetBSD: opt.mk,v 1.7 2023/02/25 00:07:08 rillig Exp $ 2 1.1 rillig # 3 1.2 rillig # Tests for the command line options. 4 1.1 rillig 5 1.3 rillig .MAKEFLAGS: -d0 # make stdout line-buffered 6 1.3 rillig 7 1.3 rillig all: .IGNORE 8 1.5 rillig # The options from the top-level make are passed to the sub-makes via 9 1.5 rillig # the environment variable MAKEFLAGS. This is where the " -r -k -d 0" 10 1.7 rillig # comes from. See MainParseOption. 11 1.6 sjg ${MAKE} -r -f /dev/null -V MAKEFLAGS 12 1.5 rillig @echo 13 1.5 rillig 14 1.3 rillig # Just to see how the custom argument parsing code reacts to a syntax 15 1.3 rillig # error. The colon is used in the options string, marking an option 16 1.3 rillig # that takes arguments. It is not an option by itself, though. 17 1.3 rillig ${MAKE} -: 18 1.3 rillig @echo 19 1.3 rillig 20 1.3 rillig # See whether a '--' stops handling of command line options, like in 21 1.4 sjg # standard getopt programs. Yes, it does, and it treats the 22 1.4 sjg # second '-f' as a target to be created. 23 1.4 sjg ${MAKE} -r -f /dev/null -- -VAR=value -f /dev/null 24 1.3 rillig @echo 25 1.3 rillig 26 1.3 rillig # This is the normal way to print the usage of a command. 27 1.3 rillig ${MAKE} -? 28 1.3 rillig @echo 29