xref: /freebsd/contrib/bmake/unit-tests/directive-sinclude.mk (revision 988758838533b24f5893b36514fe2c68a3f911a2)
1*98875883SSimon J. Gerraty# $NetBSD: directive-sinclude.mk,v 1.5 2023/08/19 10:52:14 rillig Exp $
2956e45f6SSimon J. Gerraty#
3956e45f6SSimon J. Gerraty# Tests for the .sinclude directive, which includes another file,
4956e45f6SSimon J. Gerraty# silently skipping it if it cannot be opened.
5e2eeea75SSimon J. Gerraty#
6e2eeea75SSimon J. Gerraty# The 'silently skipping' only applies to the case where the file cannot be
7e2eeea75SSimon J. Gerraty# opened.  Parse errors and other errors are handled the same way as in the
8e2eeea75SSimon J. Gerraty# other .include directives.
9956e45f6SSimon J. Gerraty
109f45a3c8SSimon J. Gerraty# No complaint that there is no such file.
119f45a3c8SSimon J. Gerraty.sinclude "${.CURDIR}/directive-include-nonexistent.inc"
12956e45f6SSimon J. Gerraty
139f45a3c8SSimon J. Gerraty# No complaint either, even though the operating system error is ENOTDIR, not
149f45a3c8SSimon J. Gerraty# ENOENT.
159f45a3c8SSimon J. Gerraty.sinclude "${MAKEFILE}/subdir"
169f45a3c8SSimon J. Gerraty
179f45a3c8SSimon J. Gerraty# Errors that are not related to opening the file are still reported.
18*98875883SSimon J. Gerraty# expect: make: "directive-include-error.inc" line 1: Invalid line 'syntax error'
199f45a3c8SSimon J. Gerraty_!=	echo 'syntax error' > directive-include-error.inc
209f45a3c8SSimon J. Gerraty.sinclude "${.CURDIR}/directive-include-error.inc"
219f45a3c8SSimon J. Gerraty_!=	rm directive-include-error.inc
229f45a3c8SSimon J. Gerraty
239f45a3c8SSimon J. Gerratyall: .PHONY
24