xref: /freebsd/contrib/bmake/unit-tests/directive-hyphen-include.mk (revision 5956d97f4b3204318ceb6aa9c77bd0bc6ea87a41)
1# $NetBSD: directive-hyphen-include.mk,v 1.2 2022/01/23 21:48:59 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 type
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