xref: /freebsd/contrib/bmake/unit-tests/directive-hyphen-include.mk (revision 5ca8e32633c4ffbbcd6762e5888b6a4ba0708c6c)
1# $NetBSD: directive-hyphen-include.mk,v 1.3 2023/08/19 10:52:13 rillig Exp $
2#
3# Tests for the .-include directive, which includes another file,
4# silently skipping it if it cannot be opened.
5#
6# The 'silently skipping' only applies to the case where the file cannot be
7# opened.  Parse errors and other errors are handled the same way as in the
8# other .include directives.
9
10# No complaint that there is no such file.
11.-include "${.CURDIR}/directive-hyphen-include-nonexistent.inc"
12
13# No complaint either, even though the operating system error is ENOTDIR, not
14# ENOENT.
15.-include "${MAKEFILE}/subdir"
16
17# Errors that are not related to opening the file are still reported.
18# expect: make: "directive-hyphen-include-error.inc" line 1: Invalid line 'syntax error'
19_!=	echo 'syntax error' > directive-hyphen-include-error.inc
20.-include "${.CURDIR}/directive-hyphen-include-error.inc"
21_!=	rm directive-hyphen-include-error.inc
22
23all: .PHONY
24