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