directive-include-fatal.mk revision 1.6
11.6Srillig# $NetBSD: directive-include-fatal.mk,v 1.6 2025/01/11 21:21:33 rillig Exp $
21.1Srillig#
31.1Srillig# Test for the .include directive combined with fatal errors.
41.1Srillig#
51.1Srillig# At 2020-09-13, the code in Parse_File that sets "fatals = 0" looked
61.1Srillig# suspicious, as if it were possible to suppress fatal errors by including
71.1Srillig# another file.  It was a false alarm though, since Parse_File only handles
81.1Srillig# the top-level makefiles from the command line.  Any included files are
91.3Srillig# handled by IncludeFile instead, and that function does not reset
101.1Srillig# the "fatals" counter.
111.1Srillig
121.1Srillig# Using an undefined variable in a condition generates a fatal error.
131.6Srillig# expect+1: Variable "UNDEF" is undefined
141.1Srillig.if ${UNDEF}
151.1Srillig.endif
161.1Srillig
171.1Srillig# Including another file does not reset the global variable "fatals".
181.1Srillig# The exit status will be 1.
191.1Srillig.include "/dev/null"
201.1Srillig
211.2Srillig# Adding another file to be included has no effect either.
221.2Srillig# When the command line is parsed, the additional file is only enqueued
231.2Srillig# in the global "makefiles" variable, but not immediately run through
241.2Srillig# Parse_File.
251.2Srillig.MAKEFLAGS: -f "/dev/null"
261.2Srillig
271.1Srilligall:
281.1Srillig	@:;
29