aboutsummaryrefslogtreecommitdiff
path: root/unit-tests/include-main.mk
blob: d3f122aef718118c4315726ab4806430691b86ee (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# $NetBSD: include-main.mk,v 1.6 2021/01/22 00:44:55 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 ParseSetIncludeFile.
#
# 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