ViewVC Help
View File | Revision Log | Show Annotations | Download File | View Changeset | Root Listing
root/src/vendor/NetBSD/bmake/dist/mk/meta.sys.mk
Revision: 11138
Committed: Wed Jun 27 00:17:22 2018 UTC (5 years, 10 months ago) by laffer1
File size: 4263 byte(s)
Log Message:
update bmake to 20170720

File Contents

# Content
1 # $Id: meta.sys.mk,v 1.32 2017/06/11 03:24:04 sjg Exp $
2
3 #
4 # @(#) Copyright (c) 2010, Simon J. Gerraty
5 #
6 # This file is provided in the hope that it will
7 # be of use. There is absolutely NO WARRANTY.
8 # Permission to copy, redistribute or otherwise
9 # use this file is hereby granted provided that
10 # the above copyright notice and this notice are
11 # left intact.
12 #
13 # Please send copies of changes and bug-fixes to:
14 # sjg@crufty.net
15 #
16
17 # include this if you want to enable meta mode
18 # for maximum benefit, requires filemon(4) driver.
19
20 .if ${MAKE_VERSION:U0} > 20100901
21 .if !target(.ERROR)
22
23 .-include <local.meta.sys.mk>
24
25 # absoulte path to what we are reading.
26 _PARSEDIR = ${.PARSEDIR:tA}
27
28 .if !defined(SYS_MK_DIR)
29 SYS_MK_DIR := ${_PARSEDIR}
30 .endif
31
32 META_MODE += meta verbose
33 .MAKE.MODE ?= ${META_MODE}
34
35 .if ${.MAKE.LEVEL} == 0
36 _make_mode := ${.MAKE.MODE} ${META_MODE}
37 .if ${_make_mode:M*read*} != "" || ${_make_mode:M*nofilemon*} != ""
38 # tell everyone we are not updating Makefile.depend*
39 UPDATE_DEPENDFILE = NO
40 .export UPDATE_DEPENDFILE
41 .endif
42 .if ${UPDATE_DEPENDFILE:Uyes:tl} == "no" && !exists(/dev/filemon)
43 # we should not get upset
44 META_MODE += nofilemon
45 .export META_MODE
46 .endif
47 .endif
48
49 .if !defined(NO_SILENT)
50 .if ${MAKE_VERSION} > 20110818
51 # only be silent when we have a .meta file
52 META_MODE += silent=yes
53 .else
54 .SILENT:
55 .endif
56 .endif
57
58 # we use the pseudo machine "host" for the build host.
59 # this should be taken care of before we get here
60 .if ${OBJTOP:Ua} == ${HOST_OBJTOP:Ub}
61 MACHINE = host
62 .endif
63
64 .if ${.MAKE.LEVEL} == 0
65 # it can be handy to know which MACHINE kicked off the build
66 # for example, if using Makefild.depend for multiple machines,
67 # allowing only MACHINE0 to update can keep things simple.
68 MACHINE0 := ${MACHINE}
69 .export MACHINE0
70
71 .if defined(PYTHON) && exists(${PYTHON})
72 # we prefer the python version of this - it is much faster
73 META2DEPS ?= ${.PARSEDIR}/meta2deps.py
74 .else
75 META2DEPS ?= ${.PARSEDIR}/meta2deps.sh
76 .endif
77 META2DEPS := ${META2DEPS}
78 .export META2DEPS
79 .endif
80
81 MAKE_PRINT_VAR_ON_ERROR += \
82 .ERROR_TARGET \
83 .ERROR_META_FILE \
84 .MAKE.LEVEL \
85 MAKEFILE \
86 .MAKE.MODE
87
88 .if !defined(SB) && defined(SRCTOP)
89 SB = ${SRCTOP:H}
90 .endif
91 ERROR_LOGDIR ?= ${SB}/error
92 meta_error_log = ${ERROR_LOGDIR}/meta-${.MAKE.PID}.log
93
94 # we are not interested in make telling us a failure happened elsewhere
95 .ERROR: _metaError
96 _metaError: .NOMETA .NOTMAIN
97 -@[ "${.ERROR_META_FILE}" ] && { \
98 grep -q 'failure has been detected in another branch' ${.ERROR_META_FILE} && exit 0; \
99 mkdir -p ${meta_error_log:H}; \
100 cp ${.ERROR_META_FILE} ${meta_error_log}; \
101 echo "ERROR: log ${meta_error_log}" >&2; }; :
102
103 .endif
104
105 # Are we, after all, in meta mode?
106 .if ${.MAKE.MODE:Uno:Mmeta*} != ""
107 MKDEP_MK = meta.autodep.mk
108
109 .if ${.MAKE.MAKEFILES:M*sys.dependfile.mk} == ""
110 # this does all the smarts of setting .MAKE.DEPENDFILE
111 .-include <sys.dependfile.mk>
112 # check if we got anything sane
113 .if ${.MAKE.DEPENDFILE} == ".depend"
114 .undef .MAKE.DEPENDFILE
115 .endif
116 .MAKE.DEPENDFILE ?= Makefile.depend
117 .endif
118
119 # we can afford to use cookies to prevent some targets
120 # re-running needlessly
121 META_COOKIE_TOUCH?= touch ${COOKIE.${.TARGET}:U${.OBJDIR}/${.TARGET:T}}
122 META_NOPHONY=
123 META_NOECHO= :
124
125 # some targets involve old pre-built targets
126 # ignore mtime of shell
127 # and mtime of makefiles does not matter in meta mode
128 .MAKE.META.IGNORE_PATHS += \
129 ${MAKEFILE} \
130 ${SHELL} \
131 ${SYS_MK_DIR}
132
133 .if ${UPDATE_DEPENDFILE:Uyes:tl} != "no"
134 .if ${.MAKEFLAGS:Uno:M-k} != ""
135 # make this more obvious
136 .warning Setting UPDATE_DEPENDFILE=NO due to -k
137 UPDATE_DEPENDFILE= NO
138 .export UPDATE_DEPENDFILE
139 .elif !exists(/dev/filemon)
140 .error ${.newline}ERROR: The filemon module (/dev/filemon) is not loaded.
141 .endif
142 .endif
143
144 .if ${.MAKE.LEVEL} == 0
145 # make sure dirdeps target exists and do it first
146 all: dirdeps .WAIT
147 dirdeps:
148 .NOPATH: dirdeps
149
150 .if defined(ALL_MACHINES)
151 # the first .MAIN: is what counts
152 # by default dirdeps is all we want at level0
153 .MAIN: dirdeps
154 # tell dirdeps.mk what we want
155 BUILD_AT_LEVEL0 = no
156 .endif
157 .if ${.TARGETS:Nall} == ""
158 # it works best if we do everything via sub-makes
159 BUILD_AT_LEVEL0 ?= no
160 .endif
161
162 .endif
163 .else
164 META_COOKIE_TOUCH=
165 # some targets need to be .PHONY in non-meta mode
166 META_NOPHONY= .PHONY
167 META_NOECHO= echo
168 .endif
169 .endif