-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGNUmakevars.inc
330 lines (219 loc) · 9.02 KB
/
GNUmakevars.inc
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
# Prerequisite: TRACES_TOP must be set.
# To understand why taking into account such conditionals requires to specify
# them first, and in each layer, rather than at the end of the last one, refer
# to the section about conditionals at the top of the GNUmakevars.inc of Myriad.
# Overall settings section.
#EXECUTION_TARGET = production
ifndef EXECUTION_TARGET
# Other possible value: production
EXECUTION_TARGET = development
endif
ifeq ($(EXECUTION_TARGET),development)
#$(info Execution target is development)
ENABLE_TRACES = true
ENABLE_DEBUG = true
else ifeq ($(EXECUTION_TARGET),production)
#$(info Execution target is production)
ENABLE_TRACES = false
ENABLE_DEBUG = false
else
$(error Invalid Traces execution target '$(EXECUTION_TARGET)'; expecting either 'development' or 'production')
endif
# Enforce default values:
# To selectively force any (de)activation:
#ENABLE_TRACES := false
# Should already be set through EXECUTION_TARGET above:
ifndef ENABLE_TRACES
ENABLE_TRACES := true
endif
# Tells whether traces will be activated for the next modules to be built.
# By default, they are enabled.
#
ifeq ($(ENABLE_TRACES),true)
ENABLE_TRACES_OPT := -Dtracing_activated
else
ENABLE_TRACES_OPT :=
endif
# Preformatting implies the use to the 'advanced_traces' type, but should lessen
# considerably the overall traces overhead, so this is worth it:
#
TRACES_OPT_FLAGS = -Dtraces_are_preformatted
#TRACES_OPT_FLAGS =
# Defining (optional) layer-specific flags, typically used by in-code
# conditional compilation primitives (see cond_utils for their management):
# Topics covered by flags:
#
# - registration: regarding the naming registration/look-up, notably of the
# trace aggregator
#
# - types: regarding the overhead induced by the traces system (useful to ensure
# a good efficiency/compactness is met)
#
# Defining debug flags (at least the most verbose are by default commented-out):
ifeq ($(ENABLE_DEBUG),true)
#TRACES_DEBUG_FLAGS += -Dtraces_debug_registration
endif
# Defining check flags:
ifeq ($(EXECUTION_TARGET),development)
# To be left commented in general terms (as checking is expensive):
#TRACES_CHECK_FLAGS += -Dtraces_check_types
endif
# As soon as Traces is used, no need to ellipse traces anymore, they can be
# fully preserved:
#
ERLANG_COMPILER_OPT_BASE += -Dtraces_version=\"$(TRACES_VERSION)\" \
$(TRACES_OPT_FLAGS) \
$(TRACES_DEBUG_FLAGS) \
$(TRACES_CHECK_FLAGS) \
-Dwooper_preserve_traces
# Useful to target for example the root of the current layer (e.g. to locate the
# relevant, layer-local '_build' directory):
#
ifndef LAYER_TOP
LAYER_TOP := $(TRACES_TOP)
endif
# Project section.
# PROJECT_NAME should be defined on a per-project basis.
ifndef PROJECT_NAME
PROJECT_NAME := Ceylan-Traces
endif
# PROJECT_SHORT_NAME should be defined on a per-project basis.
ifndef PROJECT_SHORT_NAME
PROJECT_SHORT_NAME := traces
endif
# PROJECT_NAME_FOR_OTP should be defined on a per-project basis.
ifndef PROJECT_NAME_FOR_OTP
PROJECT_NAME_FOR_OTP := $(PROJECT_SHORT_NAME)
endif
# The uniquely-defined version of this layer, for all uses (including rebar, hex
# and the code itself, see traces_utils:get_traces_version{_string,}/0):
#
TRACES_VERSION := 1.0.24
# PROJECT_VERSION should be defined on a per-project basis.
ifndef PROJECT_VERSION
PROJECT_VERSION := $(TRACES_VERSION)
endif
ifndef PACKAGE_TOP
PACKAGE_TOP := $(TRACES_TOP)
endif
# For any quick, local, non release-packaged update thereof:
WOOPER_CHECKOUT_BUILD = $(LAYER_TOP)/_checkouts/wooper
WOOPER_SIBLING_BUILD = $(LAYER_TOP)/../wooper
# The OTP tree of the WOOPER application within a local OTP _build tree:
WOOPER_LOCAL_APP := $(LAYER_TOP)/_build/default/lib/wooper
# Where WOOPER BEAMs are to lie when used as an OTP application:
WOOPER_LOCAL_EBIN := $(WOOPER_LOCAL_APP)/ebin/
TRACES_RELEASE_BASE := Traces-$(PROJECT_VERSION)
TRACES_RELEASE_ARCHIVE_ZIP := $(TRACES_RELEASE_BASE).zip
TRACES_RELEASE_ARCHIVE_BZ2 := $(TRACES_RELEASE_BASE).tar.bz2
TRACES_RELEASE_ARCHIVE_XZ := $(TRACES_RELEASE_BASE).tar.xz
# Source section.
TRACES_SRC := $(TRACES_TOP)/src
# BEAM path section.
TRACES_BEAM_DIR := $(TRACES_TOP)/src
# Defined so that full traces are kept in messages (as the user of Traces can
# properly consult longer ones):
#
# (note: only taken into account in an integrated build, i.e. when the WOOPER
# build happens whereas this GNUmakevars.inc has been included)
#
WOOPER_UNELLIPSED_TRACES_OPT= -Dwooper_unellipsed_traces
# See Myriad counterpart variable (MYRIAD_BEAM_DIRS) for explanations:
TRACES_BEAM_DIRS := $(TRACES_BEAM_DIR) $(TRACES_TOP)/..
# We rely on Myriad and WOOPER as well:
BEAM_DIRS += $(TRACES_BEAM_DIRS)
ifndef VM_TEST_NAME
VM_NAME := traces_debug
endif
ifndef VM_TEST_NAME
VM_TEST_NAME := traces_test
endif
ERLANG_COMPILER_OPT_BASE += $(ENABLE_TRACES_OPT)
# Strangely not taken into account by the compiler, hence commented-out here and
# replaced by a in-file -compile/1 directive (in class_TraceEmitter.hrl):
#
# (same for {test,app}_trace_disabled/{1,2} and al)
#
#ERLANG_COMPILER_OPT_BASE += "+{nowarn_unused_function,[{trace_disabled,1},{trace_disabled,2},{trace_disabled,3},{trace_disabled,4},{trace_disabled,5},{test_trace_disabled,1},{test_trace_disabled,2}]}"
# Not wanting to trigger WOOPER-specific settings (e.g. the modules bootstrapped
# for it, like wooper_info), hence we define the corresponding Make variables
# with an empty value (otherwise if using 'MY_VAR= ', MY_VAR would be deemed not
# defined); however of course most rules/variables still apply.
#ifndef ERLANG_COMPILER_PARSE_TRANSFORM_OPT_FOR_STANDARD_MODULES
# ERLANG_COMPILER_PARSE_TRANSFORM_OPT_FOR_STANDARD_MODULES = $(empty)
#endif
ifndef PARSE_TRANSFORM_DIRS
PARSE_TRANSFORM_DIRS = $(empty)
endif
#ifndef ERLANG_COMPILER_PARSE_TRANSFORM_OPT
# ERLANG_COMPILER_PARSE_TRANSFORM_OPT = $(empty)
#endif
ifndef BOOTSTRAP_MODULES
BOOTSTRAP_MODULES = $(empty)
endif
# To be available from a Makefile despite not being in the user's PATH:
KILL_TRACE_SUPERVISION_TOOL = $(TRACES_TOP)/priv/bin/kill-trace-supervision-tool.sh
ifndef EDOC_OPTS
EDOC_OPTS = '[{dir,"$(API_DOC_ROOT)"}, {def,{vsn,"$(PROJECT_VERSION)"}}, {preprocess,true}, {macros,[{$(PROJECT_EDOC_VERSION_KEY),"$(PROJECT_VERSION)"}]}, {includes,["$(LAYER_TOP)/include", "$(MYRIAD_TOP)/.."]}, {overview, "$(LAYER_TOP)/overview.edoc"}]'
endif
TRACES_FILES = $(wildcard *.traces)
AUX_GENERATED_FILES := $(AUX_GENERATED_FILES) \
$(patsubst %.traces,%.aux,$(TRACES_FILES))
TEX_GENERATED_FILES := $(TEX_GENERATED_FILES) \
$(patsubst %.traces,%.tex,$(TRACES_FILES))
OUT_GENERATED_FILES := $(OUT_GENERATED_FILES) \
$(patsubst %.traces,%.out,$(TRACES_FILES))
LOG_GENERATED_FILES := $(LOG_GENERATED_FILES) \
$(patsubst %.traces,%.log,$(TRACES_FILES))
HTML_GENERATED_FILES := $(HTML_GENERATED_FILES) \
$(patsubst %.traces,%.html,$(TRACES_FILES))
PDF_GENERATED_FILES := $(PDF_GENERATED_FILES) \
$(patsubst %.traces,%.pdf,$(TRACES_FILES))
TRACES_GENERATED_FILES := $(AUX_GENERATED_FILES) $(TEX_GENERATED_FILES) \
$(OUT_GENERATED_FILES) $(LOG_GENERATED_FILES) $(HTML_GENERATED_FILES) \
$(PDF_GENERATED_FILES) $(GENERATOR_LOG_FILE) Listener-*.traces
# Used by the clean-override target in Myriad:
FILES_TO_CLEAN += $(TRACES_FILES) $(TRACES_GENERATED_FILES)
# For later reuse in the next layer of the software stack:
TRACES_PLT_FILE := $(TRACES_TOP)/Ceylan-Traces.plt
# This is the merged PLT of the level just below in the software stack.
# For Traces, it is the PLT of 'WOOPER':
#
ifndef PREDECESSOR_PLT_FILE
PREDECESSOR_PLT_FILE = $(WOOPER_PLT_FILE)
endif
# We define the path to the WOOPER layer (possibly available as a symbolic
# link).
#
# For the sake of these build-related makefiles, Ceylan dependencies will be
# searched (in that order, the one enforced in otp_utils) in a local _checkouts
# child directory (if checkout directories are used and if the top-level package
# of interest is the current one), otherwise in sibling directories (i.e. whose
# build root is at the same level as this one).
#
# This last case happens notably if not using checkout directories, or if using
# them and if all the packages mentioned here are themselves dependencies (in
# which case they are all sitting together in the _checkouts child directory).
#
# Note also we rely on the names of build roots (e.g. myriad) as opposed to
# project/repository names (e.g. Ceylan-Myriad):
#
# First priority is an existing checkout directory:
ifneq ($(wildcard $(TRACES_TOP)/_checkouts/wooper/.),)
WOOPER_TOP = $(TRACES_TOP)/_checkouts/wooper
else
# Second, a sibling one is searched for:
ifneq ($(wildcard $(TRACES_TOP)/../wooper/.),)
WOOPER_TOP = $(TRACES_TOP)/../wooper
else
# Otherwise most probably in a 'rebar3 compile' context:
ifneq ($(wildcard $(TRACES_TOP)/_build/default/lib/wooper/.),)
WOOPER_TOP = $(TRACES_TOP)/_build/default/lib/wooper
else
FORCE_EVAL := $(error Unable to find the build root of Ceylan-WOOPER from '$(realpath .)'.)
endif
endif
endif
ifndef PREDECESSOR_LAYER_TOPS
PREDECESSOR_LAYER_TOPS := $(WOOPER_TOP)
endif