2c3632d14f
Lots of code refactoring, simplification and cleanup. Lots of new unit-tests providing much higher code coverage. All courtesy of rillig at netbsd. Other significant changes: o new read-only variable .SHELL which provides the path of the shell used to run scripts (as defined by the .SHELL target). o variable parsing detects more errors. o new debug option -dl: LINT mode, does the equivalent of := for all variable assignments so that file and line number are reported for variable parse errors.
31 lines
742 B
Makefile
31 lines
742 B
Makefile
# $NetBSD: include-main.mk,v 1.2 2020/07/27 20:55:59 rillig Exp $
|
|
#
|
|
# Demonstrates that the .INCLUDEDFROMFILE magic variable does 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 in reality it is the "filename in which the
|
|
# latest .include happened". See parse.c, function ParseSetIncludeFile.
|
|
#
|
|
|
|
.if !defined(.INCLUDEDFROMFILE)
|
|
LOG+= main-before-ok
|
|
.else
|
|
. for f in ${.INCLUDEDFROMFILE}
|
|
LOG+= main-before-fail\(${f:Q}\)
|
|
. endfor
|
|
.endif
|
|
|
|
.include "include-sub.mk"
|
|
|
|
.if !defined(.INCLUDEDFROMFILE)
|
|
LOG+= main-after-ok
|
|
.else
|
|
. for f in ${.INCLUDEDFROMFILE}
|
|
LOG+= main-after-fail\(${f:Q}\)
|
|
. endfor
|
|
.endif
|
|
|
|
all:
|
|
@printf '%s\n' ${LOG}
|