xref: /freebsd/contrib/bmake/unit-tests/include-sub.inc (revision e6bfd18d21b225af6a0ed67ceeaf1293b7b9eba5)
1# $NetBSD: include-sub.inc,v 1.1 2023/01/19 23:26:14 rillig Exp $
2
3.if ${.INCLUDEDFROMFILE} == "include-main.mk"
4.  info sub-before-ok
5.else
6.  warning sub-before-fail(${.INCLUDEDFROMFILE})
7.endif
8
9# As of 2020-09-05, the .for loop is implemented as "including a file"
10# with a custom buffer.  Therefore this loop has side effects on these
11# variables.
12.for i in once
13.  if ${.INCLUDEDFROMFILE} == "include-main.mk"
14.    info sub-before-for-ok
15.  else
16.    warning sub-before-for-fail(${.INCLUDEDFROMFILE})
17.  endif
18.endfor
19
20# To see the variable 'includes' in action:
21#
22# Breakpoints:
23#	Parse_PushInput		at "Vector_Push(&includes)"
24#	HandleMessage		at entry
25# Watches:
26#	((const IncludedFile *[10])(*includes.items))
27#	*CurFile()
28
29.for i in deeply
30.  for i in nested
31.    for i in include
32.include "include-subsub.inc"
33.    endfor
34.  endfor
35.endfor
36
37.if ${.INCLUDEDFROMFILE} == "include-main.mk"
38.  info sub-after-ok
39.else
40.  warning sub-after-fail(${.INCLUDEDFROMFILE})
41.endif
42
43.for i in once
44.  if ${.INCLUDEDFROMFILE} == "include-main.mk"
45.    info sub-after-for-ok
46.  else
47.    warning sub-after-for-fail(${.INCLUDEDFROMFILE})
48.  endif
49.endfor
50