aboutsummaryrefslogtreecommitdiff
path: root/unit-tests/opt.mk
diff options
context:
space:
mode:
Diffstat (limited to 'unit-tests/opt.mk')
-rw-r--r--unit-tests/opt.mk28
1 files changed, 24 insertions, 4 deletions
diff --git a/unit-tests/opt.mk b/unit-tests/opt.mk
index eae430965df7..0931a66d3d15 100644
--- a/unit-tests/opt.mk
+++ b/unit-tests/opt.mk
@@ -1,8 +1,28 @@
-# $NetBSD: opt.mk,v 1.2 2020/08/16 14:25:16 rillig Exp $
+# $NetBSD: opt.mk,v 1.6 2020/11/18 01:06:59 sjg Exp $
#
# Tests for the command line options.
-# TODO: Implementation
+.MAKEFLAGS: -d0 # make stdout line-buffered
-all:
- @:;
+all: .IGNORE
+ # The options from the top-level make are passed to the sub-makes via
+ # the environment variable MAKEFLAGS. This is where the " -r -k -d 0"
+ # comes from. See MainParseArg.
+ ${MAKE} -r -f /dev/null -V MAKEFLAGS
+ @echo
+
+ # Just to see how the custom argument parsing code reacts to a syntax
+ # error. The colon is used in the options string, marking an option
+ # that takes arguments. It is not an option by itself, though.
+ ${MAKE} -:
+ @echo
+
+ # See whether a '--' stops handling of command line options, like in
+ # standard getopt programs. Yes, it does, and it treats the
+ # second '-f' as a target to be created.
+ ${MAKE} -r -f /dev/null -- -VAR=value -f /dev/null
+ @echo
+
+ # This is the normal way to print the usage of a command.
+ ${MAKE} -?
+ @echo