1# $NetBSD: include-main.mk,v 1.9 2023/06/01 20:56:35 rillig Exp $ 2# 3# Until 2020-09-05, the .INCLUDEDFROMFILE magic variable did not behave 4# as described in the manual page. 5# 6# The manual page says that it is the "filename of the file this Makefile 7# was included from", while before 2020-09-05 it was the "filename in which 8# the latest .include happened". See parse.c, function SetParseFile. 9# 10# Since 2020-09-05, the .INCLUDEDFROMDIR and .INCLUDEDFROMFILE variables 11# properly handle nested includes and even .for loops. 12 13.if !defined(.INCLUDEDFROMFILE) 14# expect+1: main-before-ok 15. info main-before-ok 16.else 17. warning main-before-fail(${.INCLUDEDFROMFILE}) 18.endif 19 20.for i in once 21. if !defined(.INCLUDEDFROMFILE) 22# expect+1: main-before-for-ok 23. info main-before-for-ok 24. else 25. warning main-before-for-fail(${.INCLUDEDFROMFILE}) 26. endif 27.endfor 28 29.include "include-sub.inc" 30 31.if !defined(.INCLUDEDFROMFILE) 32# expect+1: main-after-ok 33. info main-after-ok 34.else 35. warning main-after-fail(${.INCLUDEDFROMFILE}) 36.endif 37 38.for i in once 39. if !defined(.INCLUDEDFROMFILE) 40# expect+1: main-after-for-ok 41. info main-after-for-ok 42. else 43. warning main-after-for-fail(${.INCLUDEDFROMFILE}) 44. endif 45.endfor 46 47all: # nothing 48