xref: /freebsd/contrib/bmake/unit-tests/sh-leading-hyphen.mk (revision d9a42747950146bf03cda7f6e25d219253f8a57a)
1# $NetBSD: sh-leading-hyphen.mk,v 1.4 2023/01/19 19:55:27 rillig Exp $
2#
3# Tests for shell commands preceded by a '-', to ignore the exit status of
4# the command line.
5#
6# See also:
7#	.IGNORE
8#	depsrc-ignore.mk
9#	opt-ignore.mk
10
11# TODO: Implementation
12
13all:
14	-true
15	-false
16
17	# An undefined variable expands to an empty string, without warning.
18	# This is used in practice for prefixing tool names or for DESTDIR.
19	# The '-' before 'unknown' is interpreted by make as '.IGNORE' flag.
20	${UNDEF}-unknown-command 'needed for needshell in compat.c'
21
22	# Expanding undefined variables may lead to strange error messages
23	# when the shell interprets single-character options as commands
24	# instead.
25	${UNDEF} --unknown-long-option 'needed for needshell in compat.c'
26
27	# Since 2023-01-17, the leading '@', '+' and '-' may contain
28	# whitespace, for compatibility with GNU make.
29	- - - @echo 'whitespace in leading part'
30