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