xref: /freebsd/contrib/bmake/unit-tests/include-main.mk (revision a134ebd6e63f658f2d3d04ac0c60d23bcaa86dd7)
1# $NetBSD: include-main.mk,v 1.1 2020/05/17 12:36:26 rillig Exp $
2#
3# Demonstrates that the .INCLUDEDFROMFILE magic variable does 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 in reality it is the "filename in which the
8# latest .include happened".
9#
10
11.if !defined(.INCLUDEDFROMFILE)
12LOG+=		main-before-ok
13.else
14.  for f in ${.INCLUDEDFROMFILE}
15LOG+=		main-before-fail\(${f:Q}\)
16.  endfor
17.endif
18
19.include "include-sub.mk"
20
21.if !defined(.INCLUDEDFROMFILE)
22LOG+=		main-after-ok
23.else
24.  for f in ${.INCLUDEDFROMFILE}
25LOG+=		main-after-fail\(${f:Q}\)
26.  endfor
27.endif
28
29all:
30	@printf '%s\n' ${LOG}
31