freebsd-src/unit-tests/include-main.mk
Simon J. Gerraty cdde9e894d Import bmake-20220204
Features of interest:

Allow setting target local variables (similar to gmake)

In META_MODE .MAKE.META.CMP_FILTER can be used for filtering commands
before comparion.

contrib/bmake/mk/cc-wrap.mk is an example of using these

See ChangeLog for the gory details.
2022-02-05 12:03:50 -08:00

44 lines
1.1 KiB
Makefile

# $NetBSD: include-main.mk,v 1.7 2022/01/08 23:41:43 rillig Exp $
#
# Until 2020-09-05, the .INCLUDEDFROMFILE magic variable did not behave
# as described in the manual page.
#
# The manual page says that it is the "filename of the file this Makefile
# was included from", while before 2020-09-05 it was the "filename in which
# the latest .include happened". See parse.c, function SetParseFile.
#
# Since 2020-09-05, the .INCLUDEDFROMDIR and .INCLUDEDFROMFILE variables
# properly handle nested includes and even .for loops.
.if !defined(.INCLUDEDFROMFILE)
. info main-before-ok
.else
. warning main-before-fail(${.INCLUDEDFROMFILE})
.endif
.for i in once
. if !defined(.INCLUDEDFROMFILE)
. info main-before-for-ok
. else
. warning main-before-for-fail(${.INCLUDEDFROMFILE})
. endif
.endfor
.include "include-sub.mk"
.if !defined(.INCLUDEDFROMFILE)
. info main-after-ok
.else
. warning main-after-fail(${.INCLUDEDFROMFILE})
.endif
.for i in once
. if !defined(.INCLUDEDFROMFILE)
. info main-after-for-ok
. else
. warning main-after-for-fail(${.INCLUDEDFROMFILE})
. endif
.endfor
all: # nothing