xref: /freebsd/contrib/bmake/unit-tests/opt.mk (revision bdd1243d)
1# $NetBSD: opt.mk,v 1.7 2023/02/25 00:07:08 rillig 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 MainParseOption.
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