xref: /freebsd/contrib/bmake/unit-tests/directive-dinclude.mk (revision 9f45a3c8c82ffead7044ae836d9257113c630d3b)
1*9f45a3c8SSimon J. Gerraty# $NetBSD: directive-dinclude.mk,v 1.2 2022/01/23 21:48:59 rillig Exp $
2956e45f6SSimon J. Gerraty#
3956e45f6SSimon J. Gerraty# Tests for the .dinclude directive, which includes another file,
4*9f45a3c8SSimon J. Gerraty# silently skipping it if it cannot be opened.  This is primarily used for
5*9f45a3c8SSimon J. Gerraty# including '.depend' files, that's where the 'd' comes from.
6*9f45a3c8SSimon J. Gerraty#
7*9f45a3c8SSimon J. Gerraty# The 'silently skipping' only applies to the case where the file cannot be
8*9f45a3c8SSimon J. Gerraty# opened.  Parse errors and other errors are handled the same way as in the
9*9f45a3c8SSimon J. Gerraty# other .include directives.
10956e45f6SSimon J. Gerraty
11*9f45a3c8SSimon J. Gerraty# No complaint that there is no such file.
12*9f45a3c8SSimon J. Gerraty.dinclude "${.CURDIR}/directive-dinclude-nonexistent.inc"
13956e45f6SSimon J. Gerraty
14*9f45a3c8SSimon J. Gerraty# No complaint either, even though the operating system error is ENOTDIR, not
15*9f45a3c8SSimon J. Gerraty# ENOENT.
16*9f45a3c8SSimon J. Gerraty.dinclude "${MAKEFILE}/subdir"
17*9f45a3c8SSimon J. Gerraty
18*9f45a3c8SSimon J. Gerraty# Errors that are not related to opening the file are still reported.
19*9f45a3c8SSimon J. Gerraty# expect: make: "directive-dinclude-error.inc" line 1: Invalid line type
20*9f45a3c8SSimon J. Gerraty_!=	echo 'syntax error' > directive-dinclude-error.inc
21*9f45a3c8SSimon J. Gerraty.dinclude "${.CURDIR}/directive-dinclude-error.inc"
22*9f45a3c8SSimon J. Gerraty_!=	rm directive-dinclude-error.inc
23*9f45a3c8SSimon J. Gerraty
24*9f45a3c8SSimon J. Gerratyall: .PHONY
25