forked from omnetpp/omnetpp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile.inc.in
392 lines (342 loc) · 11.3 KB
/
Makefile.inc.in
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
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
#
# Do not edit this file -- it gets generated from Makefile.inc.in.
# Your changes will be lost the next time ./configure is run.
#
OMNETPP_PRODUCT = @OMNETPP_PRODUCT@
OMNETPP_RELEASE = @OMNETPP_RELEASE@
OMNETPP_VERSION = @OMNETPP_VERSION@
OMNETPP_BUILDID = @OMNETPP_BUILDID@
OMNETPP_EDITION = @OMNETPP_EDITION@
#
# Optional features (set to "yes" to enable the feature)
#
WITH_QTENV = @WITH_QTENV@
WITH_OSG = @WITH_OSG@
WITH_OSGEARTH = @WITH_OSGEARTH@
WITH_NETBUILDER = @WITH_NETBUILDER@
WITH_LIBXML = @WITH_LIBXML@
WITH_PARSIM = @WITH_PARSIM@
WITH_SYSTEMC = @WITH_SYSTEMC@
PREFER_SQLITE_RESULT_FILES = @PREFER_SQLITE_RESULT_FILES@
#
# SHARED_LIBS determines whether omnetpp is built as shared or static libs
# By default we use shared libs
#
SHARED_LIBS = @SHARED_LIBS@
#
# Configure MODE specific flags/suffixes. You can add new modes at will.
# Do not forget to run ./configure after editing this file.
#
# Each mode will have a different subdirectory in the output folder (out/).
# $D is a suffix which will be appended to the names of the binaries.
#
# add custom modes
ALL_MODES = release debug sanitize
# this is the default mode
MODE = release
ifeq ($(MODE),release)
CFLAGS = $(CFLAGS_RELEASE)
D=
else ifeq ($(MODE),debug)
CFLAGS = $(CFLAGS_DEBUG)
D=_dbg
else ifeq ($(MODE),sanitize)
CFLAGS = $(CFLAGS_DEBUG) $(SANITIZE_FLAGS)
LDFLAGS = $(SANITIZE_FLAGS)
D=_sanitize
else
$(error Unknown mode: '$(MODE)'. Accepted modes: $(ALL_MODES); or define your own mode in 'Makefile.inc.in')
endif
CLEANALL_COMMAND=$(foreach m, $(ALL_MODES), $(MAKE) -s clean MODE=$m; )
#
# Directories
#
# NOTE: it is important to evaluate the current path immediately in this file using :=
OMNETPP_ROOT := $(abspath $(dir $(lastword $(MAKEFILE_LIST))))
OMNETPP_IMAGE_PATH := $(OMNETPP_ROOT)/images
OMNETPP_BIN_DIR = $(OMNETPP_ROOT)/bin
OMNETPP_INCL_DIR = $(OMNETPP_ROOT)/include
OMNETPP_LIB_DIR = $(OMNETPP_ROOT)/lib$(OUTPUT_PREFIX)
OMNETPP_OUT_DIR = $(OMNETPP_ROOT)/out$(OUTPUT_PREFIX)
OMNETPP_SRC_DIR = $(OMNETPP_ROOT)/src
OMNETPP_UTILS_DIR = $(OMNETPP_SRC_DIR)/utils
OMNETPP_UI_DIR = $(OMNETPP_ROOT)/ui
OMNETPP_DOC_DIR = $(OMNETPP_ROOT)/doc
OMNETPP_SAMPLES_DIR = $(OMNETPP_ROOT)/samples
OMNETPP_TEST_DIR = $(OMNETPP_ROOT)/test
PLATFORM = @PLATFORM@
# platform specific code
ifeq ($(PLATFORM),win32.x86_64)
OMNETPP_TOOLS_DIR = $(OMNETPP_ROOT)/tools/win64
OMNETPP_IMAGE_PATH := $(shell cygpath -p -m '$(OMNETPP_IMAGE_PATH)')
else ifeq ($(PLATFORM),macosx)
OMNETPP_TOOLS_DIR = $(OMNETPP_ROOT)/tools/macosx
else
# Linux and other platforms do not have a tools directory
endif
# use statically built omnetpp if we are building the IDE native helper library
ifeq ($(BUILDING_UILIBS),yes)
SHARED_LIBS=no
OUTPUT_PREFIX=/ui
endif
#
# Configname determines where (in which subdirectory of out/)
# makemake-generated makefiles create object files and other
# build artifacts.
#
CONFIGNAME = $(TOOLCHAIN_NAME)-$(MODE)
#
# Control verbosity. Specifiying V=1 will make the build output verbose. You can use:
# $(Q) to hide commands only in quiet mode
# $(qecho) to print out something only in quite mode
# $(vecho) to print out something only in verbose mode
#
ifeq ($(V),1)
Q :=
vecho = @echo
qecho = @true
else
Q := @
vecho = @true
qecho = @echo
endif
# Recursive wildcard function. Call like: $(call opp_rwildcard, src/, *.c *.h)
opp_rwildcard=$(foreach d,$(wildcard $1*),$(call opp_rwildcard,$d/,$2) $(filter $(subst *,%,$2),$d))
#
# tools, libraries and compiler flags detected by ./configure
#
PERL = @PERL@
YACC = @YACC@
LEX = @LEX@
CC = @CC@
CXX = @CXX@
TOOLCHAIN_NAME = @TOOLCHAIN_NAME@
DEFINES =@DEFINES@
SANITIZE_FLAGS = @SANITIZE_FLAGS@
CFLAGS_DEBUG = @CFLAGS_DEBUG@
CFLAGS_RELEASE = @CFLAGS_RELEASE@
CFLAGS += $(CFLAGS_EXTRA) @CFLAGS@
CXXFLAGS = @CXXFLAGS@
LDFLAG_LIBPATH = @LDFLAG_LIBPATH@
LDFLAG_INCLUDE = @LDFLAG_INCLUDE@
LDFLAG_LIB = @LDFLAG_LIB@
LDFLAG_IMPLIB = @LDFLAG_IMPLIB@
LDFLAG_IMPDEF = @LDFLAG_IMPDEF@
LDFLAGS += $(LDFLAGS_EXTRA) @LDFLAGS@
WHOLE_ARCHIVE_ON = @WHOLE_ARCHIVE_ON@
WHOLE_ARCHIVE_OFF = @WHOLE_ARCHIVE_OFF@
AS_NEEDED_ON = @AS_NEEDED_ON@
AS_NEEDED_OFF = @AS_NEEDED_OFF@
PIC_FLAGS = @PIC_FLAGS@
MSGC = @MSGC@
SMC = @SMC@
NEDTOOL = @NEDTOOL@
AS = @AS@
AR = @AR@
ARFLAG_OUT = @ARFLAG_OUT@
RANLIB = @RANLIB@
SHLIB_LD = @SHLIB_LD@
DLLTOOL = @DLLTOOL@
STRIP = @STRIP@
LN = @LN@
MKPATH = @MKPATH@
SHLIB_POSTPROCESS = @SHLIB_POSTPROCESS@
SWIG = @SWIG@
QMAKE = @QMAKE@
MOC=@MOC@
UIC=@UIC@
RCC=@RCC@
HAVE_DLOPEN = @HAVE_DLOPEN@
SYS_LIBS = @SYS_LIBS@
QT_CFLAGS = @QT_CFLAGS@
QT_LIBS = @QT_LIBS@
QTENV_LDFLAGS = @QTENV_LDFLAGS@
OSG_CFLAGS = @OSG_CFLAGS@
OSG_LIBS = @OSG_LIBS@
OSGEARTH_CFLAGS = @OSGEARTH_CFLAGS@
OSGEARTH_LIBS = @OSGEARTH_LIBS@
ZLIB_CFLAGS = @ZLIB_CFLAGS@
ZLIB_LIBS = @ZLIB_LIBS@
OPENMP_FLAGS = @OPENMP_CXXFLAGS@
MPI_CFLAGS = @MPI_CFLAGS@
MPI_LIBS = @MPI_LIBS@
PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
PTHREAD_LIBS = @PTHREAD_LIBS@
LIBXML_CFLAGS = @LIBXML_CFLAGS@
LIBXML_LIBS = @LIBXML_LIBS@
AKAROA_CFLAGS = @AKAROA_CFLAGS@
AKAROA_LIBS = @AKAROA_LIBS@
JNILIBS_IF_POSSIBLE = @JNILIBS_IF_POSSIBLE@
JAVA_CFLAGS = @JAVA_CFLAGS@
JAVA_LIBS = @JAVA_LIBS@
#
# platform specific library and executable prefixes and extensions
#
A_LIB_SUFFIX = @A_LIB_SUFFIX@
SO_LIB_SUFFIX = @SO_LIB_SUFFIX@
DLL_LIB_SUFFIX = @DLL_LIB_SUFFIX@
IMPLIB_SUFFIX = @IMPLIB_SUFFIX@
IMPDEF_SUFFIX = @IMPDEF_SUFFIX@
JNI_LIB_SUFFIX = @JNI_LIB_SUFFIX@
EXE_SUFFIX = @EXE_SUFFIX@
LIB_PREFIX = @LIB_PREFIX@
SHARED_LIB_SUFFIX = @SHARED_LIB_SUFFIX@
#
# omnetpp and system libraries linked with the simulations
#
QTENV_LIBS = $(LDFLAG_INCLUDE)_qtenv_lib $(AS_NEEDED_OFF) $(QTENV_LDFLAGS) -loppqtenv$D -loppenvir$D -lopplayout$D
CMDENV_LIBS = $(LDFLAG_INCLUDE)_cmdenv_lib $(AS_NEEDED_OFF) -loppcmdenv$D -loppenvir$D
ALL_ENV_LIBS = $(CMDENV_LIBS)
KERNEL_LIBS = -loppsim$D
OPPMAIN_LIB = $(LDFLAG_LIB)oppmain$D
#
# flags and libraries required for Qtenv
#
ifeq ($(WITH_QTENV),yes)
DEFINES += -DWITH_QTENV
# libraries required for static linking
ifneq ($(SHARED_LIBS),yes)
QTENV_LIBS += $(QT_LIBS)
ifeq ($(WITH_OSG),yes)
QTENV_LIBS += $(OSG_LIBS)
KERNEL_LIBS += -losg -lOpenThreads
endif
ifeq ($(WITH_OSGEARTH),yes)
QTENV_LIBS += $(OSGEARTH_LIBS)
KERNEL_LIBS += -losgEarth
endif
ifeq ($(PLATFORM),macosx)
QTENV_LIBS += -framework Carbon
endif
endif
ALL_ENV_LIBS += $(QTENV_LIBS)
endif
#
# Other defines
#
ifeq ($(WITH_PARSIM),yes)
DEFINES += -DWITH_PARSIM
# extra libs needed during static building
ifneq ($(SHARED_LIBS),yes)
KERNEL_LIBS += $(MPI_LIBS)
endif
endif
ifeq ($(WITH_NETBUILDER),yes)
DEFINES += -DWITH_NETBUILDER
endif
ifeq ($(WITH_LIBXML),yes)
DEFINES += -DWITH_LIBXML
endif
# note: defines for OSG and osgEarth must be available even if WITH_QTENV=no
ifeq ($(WITH_OSG),yes)
DEFINES += -DWITH_OSG
endif
ifeq ($(WITH_OSGEARTH),yes)
DEFINES += -DWITH_OSGEARTH
endif
# this macro can be used to pass EXPORT macros to the compiler if omnet is built as shared library
ifeq ($(SHARED_LIBS),yes)
IMPORT_DEFINES = -DOMNETPPLIBS_IMPORT
EXPORT_DEFINES = $(EXPORT_MACRO)
endif
#
# handle differences between shared and static lib builds
#
ifeq ($(SHARED_LIBS),yes)
LIB_SUFFIX = $(SHARED_LIB_SUFFIX)
else
LIB_SUFFIX = $(A_LIB_SUFFIX)
# extra libraries needed when statically linking (because of indirect dependencies)
KERNEL_LIBS += -loppnedxml$D -loppcommon$D $(LIBXML_LIBS)
endif
#
# Messages for the HELP target
#
define HELP_SYNOPSYS
SYNOPSYS
make [TARGET] [VARIABLE1=value1 ...] [make-options]
endef
export HELP_SYNOPSYS
define HELP_TARGETS
TARGETS
all Build the simulation. (This is the default target.)
If the MODE variable is not specified, both release and debug mode
binaries will be created.
clean Clean build artifacts belonging to the selected mode
(MODE=<modename>, or 'release' by default).
cleanall Clean build artifacts for all modes.
endef
export HELP_TARGETS
define HELP_OPP_TARGETS
all Build the simulator and the samples. (This is the default target.)
If the MODE variable is not specified, both release and debug mode
binaries will be created.
clean Clean build artifacts belonging to the selected mode
(MODE=<modename>, or 'release' by default).
cleanall Clean build artifacts for all modes.
apis Build the API documentation.
doc Build the User Guide and the Manual.
tests Build and run the automated tests.
samples Build only the samples.
endef
export HELP_OPP_TARGETS
define HELP_VARIABLES
VARIABLES
MODE 'release', 'debug', 'sanitize' or any other user defined string.
Modes specify what compiler and linker flags are used during the
build. User defined modes must be added in the 'Makefile.inc.in' file.
(Look for the 'Configure MODE specific flags/suffixes' section.)
After adding a new mode, run './configure' again to re-create
the Makefile.inc file. The output will be available in the
'out/$${TOOLCHAIN}-$${MODE}' folder.
Predefined modes are:
- release: Generate optimized code without debugging info.
- debug: Generate code for debugging.
- sanitize: Generate code which is instrumented with various
sanitizers. The list of available sanitizers depend on the
compiler. For example, Clang provides AddressSanitizer,
MemorySanitizer, etc.
Default options: $(SANITIZE_FLAGS)
V Use V=1 to echo all build commands on the console. This is useful
for debugging the build process.
CFLAGS_RELEASE, CFLAGS_DEBUG, SANITIZE_FLAGS
Various flags used by default in 'release', 'debug' or 'sanitize'
mode. Specifying these on the command line will override the
default values for the given mode.
CFLAGS_EXTRA, LDFLAGS_EXTRA
Allows adding compiler and linker flags to the default command line
options.
CFLAGS, LDFLAGS
Allows overriding the compiler and linker flags.
CXXFLAGS Compiler flags that should be passed to the C++ compiler
only (e.g. -std=c++11).
endef
export HELP_VARIABLES
define HELP_OPP_VARIABLES
SHARED_LIBS
Use 'no' to build static libraries.
WITH_QTENV, WITH_OSG, WITH_OSGEARTH, WITH_NETBUILDER, WITH_LIBXML, WITH_PARSIM, WITH_SYSTEMC
Turn off features by specifying 'no' for these variables.
PREFER_SQLITE_RESULT_FILES
Specify 'yes' to write result files in SQLite database file
format by default.
endef
export HELP_OPP_VARIABLES
define HELP_EXAMPLES
EXAMPLES
$$ make MODE=debug
Build in debug mode.
$$ make MODE=release V=1
Build in release mode, show compiler and linker command lines.
$$ make SHARED_LIBS=no
Build static instead of dynamic libraries.
$$ make MODE=release CFLAGS_RELEASE='-O0 -DNDEBUG=1'
Build in release mode, but do not optimize.
$$ make MODE=sanitize CFLAGS_EXTRA=-fsanitize-trap=undefined
Build with the default sanitizers, and in addition, generate
traps where the code relies on undefined C/C++ language behavior.
$$ make MODE=sanitize SANITIZE_FLAGS=-fsanitize=memory
Instrument the code with the memory sanitizer only instead of the
default sanitizers.
endef
export HELP_EXAMPLES