xref: /freebsd/contrib/bmake/unit-tests/directive-dinclude.mk (revision 988758838533b24f5893b36514fe2c68a3f911a2)
1*98875883SSimon J. Gerraty# $NetBSD: directive-dinclude.mk,v 1.3 2023/08/19 10:52:13 rillig Exp $
2956e45f6SSimon J. Gerraty#
3956e45f6SSimon J. Gerraty# Tests for the .dinclude directive, which includes another file,
49f45a3c8SSimon J. Gerraty# silently skipping it if it cannot be opened.  This is primarily used for
59f45a3c8SSimon J. Gerraty# including '.depend' files, that's where the 'd' comes from.
69f45a3c8SSimon J. Gerraty#
79f45a3c8SSimon J. Gerraty# The 'silently skipping' only applies to the case where the file cannot be
89f45a3c8SSimon J. Gerraty# opened.  Parse errors and other errors are handled the same way as in the
99f45a3c8SSimon J. Gerraty# other .include directives.
10956e45f6SSimon J. Gerraty
119f45a3c8SSimon J. Gerraty# No complaint that there is no such file.
129f45a3c8SSimon J. Gerraty.dinclude "${.CURDIR}/directive-dinclude-nonexistent.inc"
13956e45f6SSimon J. Gerraty
149f45a3c8SSimon J. Gerraty# No complaint either, even though the operating system error is ENOTDIR, not
159f45a3c8SSimon J. Gerraty# ENOENT.
169f45a3c8SSimon J. Gerraty.dinclude "${MAKEFILE}/subdir"
179f45a3c8SSimon J. Gerraty
189f45a3c8SSimon J. Gerraty# Errors that are not related to opening the file are still reported.
19*98875883SSimon J. Gerraty# expect: make: "directive-dinclude-error.inc" line 1: Invalid line 'syntax error'
209f45a3c8SSimon J. Gerraty_!=	echo 'syntax error' > directive-dinclude-error.inc
219f45a3c8SSimon J. Gerraty.dinclude "${.CURDIR}/directive-dinclude-error.inc"
229f45a3c8SSimon J. Gerraty_!=	rm directive-dinclude-error.inc
239f45a3c8SSimon J. Gerraty
249f45a3c8SSimon J. Gerratyall: .PHONY
25