/
GNUmakevars.inc
376 lines (211 loc) · 7.76 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
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
# Prerequisite: SEAPLUS_TOP must be set.
# Project section.
# PROJECT_NAME should be defined on a per-project basis.
ifndef PROJECT_NAME
PROJECT_NAME = Seaplus
endif
SEAPLUS_VERSION := 1.0
# PROJECT_VERSION should be defined on a per-project basis.
ifndef PROJECT_VERSION
PROJECT_VERSION = $(SEAPLUS_VERSION)
endif
ifndef PACKAGE_NAME
PACKAGE_NAME = Ceylan-Seaplus
endif
ifndef PACKAGE_TOP
PACKAGE_TOP = $(SEAPLUS_TOP)
endif
SEAPLUS_RELEASE_BASE := seaplus-$(PROJECT_VERSION)
SEAPLUS_RELEASE_ARCHIVE_ZIP := $(SEAPLUS_RELEASE_BASE).zip
SEAPLUS_RELEASE_ARCHIVE_BZ2 := $(SEAPLUS_RELEASE_BASE).tar.bz2
SEAPLUS_RELEASE_ARCHIVE_XZ := $(SEAPLUS_RELEASE_BASE).tar.xz
# Source section.
SEAPLUS_SRC := $(SEAPLUS_TOP)/src
# BEAM path section.
SEAPLUS_BEAM := $(SEAPLUS_SRC)
# Include path section.
SEAPLUS_INC = -I$(SEAPLUS_SRC)
# Library referencing section.
SEAPLUS_LIB = libseaplus-$(SEAPLUS_VERSION).so
SEAPLUS_LIB_DIR = $(SEAPLUS_TOP)/src
SEAPLUS_LIB_PATH = $(SEAPLUS_LIB_DIR)/$(SEAPLUS_LIB)
SEAPLUS_LIB_OPT = -L$(SEAPLUS_LIB_DIR) -lseaplus-$(SEAPLUS_VERSION)
DOC_ROOT = $(SEAPLUS_TOP)/doc
SEAPLUS_DOC_DIR = $(DOC_ROOT)/web/main/documentation/seaplus
INC += $(SEAPLUS_INC)
ifndef VM_TEST_NAME
VM_NAME := seaplus_debug
endif
ifndef VM_TEST_NAME
VM_TEST_NAME := seaplus_test
endif
# So that they can be fetched from outside
# (see the 'list-beam-dirs' target)
#
# ($(SEAPLUS_TOP)/examples not included here anymore)
#
SEAPLUS_BEAM_DIRS = $(SEAPLUS_TOP)/src
# We rely on Myriad as well:
BEAM_DIRS += $(SEAPLUS_BEAM_DIRS)
# 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_DEBUG=true
else ifeq ($(EXECUTION_TARGET),production)
#$(info Execution target is production)
ENABLE_DEBUG=false
else
$(error Invalid execution target '$(EXECUTION_TARGET)'; expecting either 'development' or 'production')
endif
#ENABLE_DEBUG=false
# By default, this debug mode is enabled:
ifndef ENABLE_DEBUG
ENABLE_DEBUG = true
endif
# Tells whether the debug mode will be activated for the next Seaplus classes to
# be built (maximum performance versus extended checkings).
#
ifeq ($(ENABLE_DEBUG),true)
SEAPLUS_DEBUG_OPT = -DDEBUG_SEAPLUS -DSEAPLUS_ENABLE_LOG=1
else
SEAPLUS_DEBUG_OPT = -DSEAPLUS_ENABLE_LOG=0
endif
# Build section.
# libtool not used anymore, was making the build degenerate in a mess:
#LIBTOOL = $(shell which libtool)
# This is a C-based (not C++) example:
#LIBTOOL_C_OPT += --tag=CC --verbose
# Compiler section.
SEAPLUS_BASE_NAME := seaplus
# C subsection.
ERL_INTERFACE_INC = -I$(ERL_INTERFACE)/include
ERL_INTERFACE_LIB = -L$(ERL_INTERFACE)/lib
C_COMPILER := $(shell which gcc)
C_INC = $(ERL_INTERFACE_INC) -I.
C_LIB = $(ERL_INTERFACE_LIB)
ifndef C_COMPILER_OPT
C_COMPILER_OPT = $(C_INC) $(SEAPLUS_DEBUG_OPT) -Wall -Werror -g
endif
ifndef C_COMPILER_OPT_FOR_OBJ
C_COMPILER_OPT_FOR_OBJ = $(C_COMPILER_OPT) -fPIC
endif
# Erlang subsection.
# Base Erlang installation either hardcoded or deduced from selected interpreter:
#
#ERL_BASE := $(HOME)/Software/Erlang/Erlang-current-install
ERL_BASE = $(shell dirname $(ERLANG_INTERPRETER) 2>/dev/null)/..
# Are version numbers are in the way:
ERL_INTERFACE = $(shell /bin/ls -d $(ERL_BASE)/lib/erlang/lib/erl_interface-* 2>/dev/null)
# Allows to ensure that we have a proper base installation (and not for example
# an empty directory due to a failed filtering):
#
ERL_BASE_CONTENT = $(ERL_BASE)/lib/erlang
# Modules needed for the bootstrapping for others (hence to be built first, and
# not parse-transformed; typically *used* by parse-transforms, or being a
# parse-transform themselves)
#
# (see the 'Bootstrap section' in GNUmakerules-explicit.inc for their
# special-cased build)
#
ifndef BOOTSTRAP_MODULES
# We want to bootstrap all relevant Seaplus modules (Myriad expected to be
# already fully built)
# We list here all the SEAPLUS-level prerequisites of the SEAPLUS
# parse-transform:
#
# - seaplus_info: to manage class-level information
#BOOTSTRAP_MODULES = $(SEAPLUS_TOP)/src/seaplus_info.beam
endif
ifndef COMPILER_OPT_FOR_SEAPLUS_CLASSES
COMPILER_OPT_FOR_SEAPLUS_CLASSES = \
$(ERLANG_COMPILER_OPT_BASE) \
$(ERLANG_COMPILER_PARSE_TRANSFORM_OPT_FOR_SEAPLUS)
endif
#ifndef ERLANG_COMPILER_PARSE_TRANSFORM_OPT_FOR_STANDARD_MODULES
# Standard (non-class) modules in Seaplus shall not be compiled with the
# Seaplus parse-transform, but with the Myriad one:
#
ERLANG_COMPILER_PARSE_TRANSFORM_OPT_FOR_STANDARD_MODULES = \
$(ERLANG_COMPILER_PARSE_TRANSFORM_OPT_FOR_SEAPLUS)
#endif
# Conditionally defined so that upper layer may update these settings (ex:
# adding pz directories):
#
ifndef ERLANG_COMPILER_OPT_FOR_STANDARD_MODULES
ERLANG_COMPILER_OPT_FOR_STANDARD_MODULES = \
$(ERLANG_COMPILER_OPT_BASE) \
$(ERLANG_COMPILER_PARSE_TRANSFORM_OPT_FOR_STANDARD_MODULES) \
$(SEAPLUS_DEBUG_OPT)
endif
## Parse-transform related section.
# List here all the directories expected to contain parse transforms:
#
# (to be overridden by each upper layer)
#
ifndef PARSE_TRANSFORM_DIRS
PARSE_TRANSFORM_DIRS = $(SEAPLUS_TOP)/src
endif
# So that the (compilation of the) Seaplus parse transform can benefit from the
# Myriad parse transform:
#
ERLANG_COMPILER_OPT_FOR_PT = $(ERLANG_COMPILER_PARSE_TRANSFORM_OPT_FOR_MYRIAD)
# Variable defined to be re-usable by upper layers, so that compiling their own
# parse transforms can take advantage of the Seaplus one:
#
ERLANG_COMPILER_PARSE_TRANSFORM_OPT_FOR_SEAPLUS = \
$(OVERALL_PZ_OPT) \
-DSEAPLUS_ROOT=\"$(SEAPLUS_TOP)\" \
-pz $(SEAPLUS_TOP)/src \
'+{parse_transform,seaplus_parse_transform}'
# We conditionally defined this option, as upper layers may want to trigger
# their own parse transforms *instead* (probably that will call directly, by
# themselves, at the Erlang level, this 'SEAPLUS' parse transform):
#
ifndef ERLANG_COMPILER_PARSE_TRANSFORM_OPT
ERLANG_COMPILER_PARSE_TRANSFORM_OPT = $(ERLANG_COMPILER_PARSE_TRANSFORM_OPT_FOR_SEAPLUS)
endif
# Variable defined to be re-usable by upper layers, so that compiling their own
# parse transforms can take advantage of the Seaplus one:
#
COMPILER_PARSE_TRANSFORM_FOR_SEAPLUS_CLASSES_OPT = \
'+{parse_transform,seaplus_parse_transform}'
# Linking section.
C_LINKER := $(C_COMPILER)
# -shared probably unwelcome with libtool:
C_LINKER_OPT := -g
C_LINKER_LIBS = $(ERL_INTERFACE_LIB) -lerl_interface -lei -lpthread
# Checking section.
# For later reuse in the next layer of the software stack:
SEAPLUS_PLT_FILE := $(SEAPLUS_TOP)/seaplus.plt
# This is the merged PLT of the level just below in the software stack.
# For 'SEAPLUS', it is the PLT of 'Myriad':
ifndef PREDECESSOR_PLT
PREDECESSOR_PLT = $(MYRIAD_PLT_FILE)
endif
# To use a generic rule to produce it (unless already defined):
ifndef PLT_FILE
PLT_FILE = $(PACKAGE_TOP)/$(PACKAGE_NAME).plt
endif
# Foobar-related section.
FOOBAR_ROOT = $(SEAPLUS_TOP)/tests/c-test/foobar
FOOBAR_INC = $(FOOBAR_ROOT)/inc
FOOBAR_INC_OPT = -I$(FOOBAR_INC)
FOOBAR_LIB_DIR = $(FOOBAR_ROOT)/lib
FOOBAR_LIBRARY = libfoobar.so
FOOBAR_LIB_PATH = $(FOOBAR_LIB_DIR)/$(FOOBAR_LIBRARY)
# We define the path to the Myriad layer:
#
# (it may be a symbolic link pointing to the actual Myriad package to be used,
# which itself may be either a 'Ceylan-Myriad' directory or a 'myriad' one)
#
ifneq ($(wildcard $(SEAPLUS_TOP)/../myriad),)
MYRIAD_TOP = $(SEAPLUS_TOP)/../myriad
else
# Default:
MYRIAD_TOP = $(SEAPLUS_TOP)/../Ceylan-Myriad
endif