aboutsummaryrefslogtreecommitdiff
path: root/contrib/bmake/unit-tests/sh-leading-hyphen.mk
blob: 08b50a2ddc425c6b7f4b14ab9533552eb3670733 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# $NetBSD: sh-leading-hyphen.mk,v 1.4 2023/01/19 19:55:27 rillig Exp $
#
# Tests for shell commands preceded by a '-', to ignore the exit status of
# the command line.
#
# See also:
#	.IGNORE
#	depsrc-ignore.mk
#	opt-ignore.mk

# TODO: Implementation

all:
	-true
	-false

	# An undefined variable expands to an empty string, without warning.
	# This is used in practice for prefixing tool names or for DESTDIR.
	# The '-' before 'unknown' is interpreted by make as '.IGNORE' flag.
	${UNDEF}-unknown-command 'needed for needshell in compat.c'

	# Expanding undefined variables may lead to strange error messages
	# when the shell interprets single-character options as commands
	# instead.
	${UNDEF} --unknown-long-option 'needed for needshell in compat.c'

	# Since 2023-01-17, the leading '@', '+' and '-' may contain
	# whitespace, for compatibility with GNU make.
	- - - @echo 'whitespace in leading part'