Commit | Line | Data |
---|---|---|
970ed795 | 1 | ############################################################################### |
d44e3c4f | 2 | # Copyright (c) 2000-2016 Ericsson Telecom AB |
970ed795 EL |
3 | # All rights reserved. This program and the accompanying materials |
4 | # are made available under the terms of the Eclipse Public License v1.0 | |
5 | # which accompanies this distribution, and is available at | |
6 | # http://www.eclipse.org/legal/epl-v10.html | |
d44e3c4f | 7 | # |
8 | # Contributors: | |
9 | # > | |
10 | # Baji, Laszlo | |
11 | # Balasko, Jeno | |
12 | # Baranyi, Botond | |
13 | # Beres, Szabolcs | |
14 | # Delic, Adam | |
15 | # Feher, Csaba | |
16 | # Forstner, Matyas | |
17 | # Kovacs, Ferenc | |
18 | # Kremer, Peter | |
19 | # Lovassy, Arpad | |
20 | # Ormandi, Matyas | |
21 | # Pandi, Krisztian | |
22 | # Raduly, Csaba | |
23 | # Szabados, Kristof | |
24 | # Szabo, Janos Zoltan – initial implementation | |
25 | # Szalai, Endre | |
26 | # Zalanyi, Balazs Andor | |
27 | # | |
970ed795 EL |
28 | ############################################################################### |
29 | ifndef TOP | |
30 | $(error please define TOP) | |
31 | endif | |
32 | ||
33 | # Configurations for the Free Open Source Software version, if available | |
34 | ifneq ($(wildcard $(TOP)/MakefileFOSS.cfg), ) | |
35 | include $(TOP)/MakefileFOSS.cfg | |
36 | else | |
37 | # Set whether licensing is enabled: (yes or no) | |
38 | LICENSING := yes | |
39 | ||
40 | # Set whether to send usage statistics: (yes or no) | |
41 | USAGE_STATS := yes | |
42 | endif | |
43 | ||
44 | # Define SRCDIR to the root of Titan sources to enable out-of-tree build | |
45 | #SRCDIR := ${HOME}/workspace/TTCNv3 | |
46 | ||
47 | # Set these variables to fit your system: | |
48 | ||
49 | # The target directory where the Test Executor will be installed to: | |
50 | TTCN3_DIR := ${TOP}/Install | |
51 | ||
52 | # New installed files are run from make install, so they are added to the PATH | |
53 | PATH := ${PATH}:${TTCN3_DIR}/bin | |
54 | ||
55 | # Set it to 'yes' for developing or 'no' for release. | |
56 | DEBUG := no | |
57 | ||
58 | # Set it to 'yes' to generate coverage data (requires DEBUG=yes) | |
59 | COVERAGE := no | |
60 | ||
61 | # Your platform. Allowed values: SOLARIS, SOLARIS8, LINUX, FREEBSD, | |
62 | # WIN32. Decided automagically if not defined (recommended). | |
63 | # PLATFORM := | |
64 | ||
65 | # Uncomment the following for "native" Win32 | |
66 | #MINGW := -DMINGW -mno-cygwin | |
67 | ||
68 | # Utility for building lexical analyzers (tokenizers): | |
69 | FLEX := flex | |
70 | ||
71 | # Utility for building parsers: | |
72 | BISON := bison | |
73 | ||
74 | # The C compiler used for building: | |
75 | CC := gcc | |
76 | ||
77 | # The C++ compiler used for building: | |
78 | CXX := g++ | |
79 | ||
80 | # generate userguide at install ('make release' always generates it) | |
81 | GEN_PDF := no | |
82 | ||
83 | # Set whether to build the CLI for MC: (yes or no) | |
84 | CLI := yes | |
85 | ||
86 | # set whether to build the JNI native library: (yes or no) | |
87 | JNI := yes | |
88 | ||
89 | # Path of the Java Developement Kit installation | |
90 | # (must be at least version 1.5.0_10) | |
19700695 | 91 | JDKDIR := /usr/lib/jvm/default-java |
970ed795 EL |
92 | |
93 | # Path of OpenSSL installation: (always required) | |
94 | OPENSSL_DIR := default | |
95 | ||
96 | # Location of libxml2 | |
97 | XMLDIR := default | |
98 | ||
970ed795 EL |
99 | # Flags for the C(++) preprocessor: |
100 | # Prevent a warning about yyinput being defined but not used | |
101 | CPPFLAGS := -DYY_NO_INPUT | |
970ed795 EL |
102 | |
103 | # Flags shared between C and C++ | |
104 | COMPILERFLAGS := -Wall | |
105 | ||
106 | # 'Hardcore' settings | |
107 | # Unlikely to work for GCC below 4.x | |
108 | #COMPILERFLAGS += -Werror -pedantic -W -Wno-unused-parameter -O1 | |
109 | ||
110 | # Flags for the C compiler. | |
111 | # std=gnu9x shuts up warnings about long long and variadic macros | |
112 | CCFLAGS = $(COMPILERFLAGS) -std=gnu9x | |
3abe9331 | 113 | |
114 | # Flags for the C++ compiler: | |
115 | CXXFLAGS = $(COMPILERFLAGS) -Wno-long-long | |
116 | ||
117 | # The command for maintaining static libraries: | |
118 | AR := ar | |
119 | ||
120 | # The command for building the shared libraries: | |
121 | # It shall be set to either "$(CXX) -G" or "$(CXX) -shared" depending | |
122 | # on the linker you use. | |
123 | LD = $(CXX) -shared | |
124 | ||
125 | # Flags for linking binary executables (e.g. for profiling): | |
126 | LDFLAGS = $(MINGW) | |
127 | ||
128 | # The command for removing symbol table from the executables: | |
129 | STRIP := strip | |
130 | ||
131 | # Flags for flex: | |
132 | FLEXFLAGS := -B -s -Cr | |
133 | ||
134 | # Flags for bison: | |
135 | BISONFLAGS := -d | |
136 | ||
137 | # Override common settings with personal preferences if needed | |
138 | -include $(TOP)/Makefile.personal | |
139 | ||
140 | ## ## ## ## ## Variables below are automatically set ## ## ## ## ## | |
141 | ||
142 | ifeq ($(DEBUG), yes) | |
143 | CPPFLAGS += -DMEMORY_DEBUG -DFATAL_DEBUG | |
144 | else | |
145 | CPPFLAGS += -DNDEBUG | |
146 | endif | |
147 | ||
148 | # MingW flags need to be passed to the preprocessor during ctags configure | |
149 | CPPFLAGS += $(MINGW) | |
150 | ||
970ed795 EL |
151 | ifeq ($(DEBUG), yes) |
152 | CCFLAGS += -g | |
153 | CCFLAGS += -Wshadow -Wpointer-arith -Wcast-qual -Wcast-align \ | |
154 | -Wstrict-prototypes | |
3abe9331 | 155 | else |
156 | ifeq ($(COVERAGE), yes) | |
157 | CCFLAGS += -O0 | |
970ed795 EL |
158 | else |
159 | CCFLAGS += -O2 | |
160 | endif | |
3abe9331 | 161 | endif |
970ed795 EL |
162 | |
163 | # Only the default Cygwin compiler can be used for Mingw. | |
164 | # Its version is 3.4.4, too low. | |
165 | ifndef MINGW | |
166 | # Only GCC 4.x understands -Wno-variadic-macros, comment out for lower versions | |
167 | #CXXFLAGS += -Wno-variadic-macros | |
168 | endif | |
169 | ||
170 | ifeq ($(DEBUG), yes) | |
171 | CXXFLAGS += -g | |
172 | CXXFLAGS += -Wshadow -Wpointer-arith -Wcast-qual -Wcast-align | |
3abe9331 | 173 | else |
174 | ifeq ($(COVERAGE), yes) | |
175 | CXXFLAGS += -O0 | |
970ed795 EL |
176 | else |
177 | CXXFLAGS += -O2 | |
178 | endif | |
3abe9331 | 179 | endif |
970ed795 EL |
180 | |
181 | # Flags for the C/C++ compilers to generate dependency list (-M or -MM | |
182 | # for gcc or clang, -xM or -xM1 for Sun C compiler). | |
183 | ||
184 | ifneq ($(filter gcc% clang%, $(notdir $(CC))),) | |
185 | CCDEPFLAG := -MM | |
186 | CXXDEPFLAG := -MM | |
187 | else | |
188 | # Let's hope it's the Sun compiler | |
189 | CCDEPFLAG := -xM1 | |
190 | CXXDEPFLAG := -xM1 | |
191 | endif | |
192 | ||
970ed795 EL |
193 | ifeq ($(DEBUG), yes) |
194 | LDFLAGS += -g | |
195 | endif | |
196 | ||
970ed795 | 197 | |
970ed795 EL |
198 | ifeq ($(DEBUG), yes) |
199 | FLEXFLAGS += -b -p | |
200 | # FLEXFLAGS += -d | |
201 | else | |
202 | # Comment out the line below if flex version 2.5.4[a] is used. | |
203 | # This version does not support optimized tables together with yylineno. | |
204 | FLEXFLAGS += -Cfe | |
205 | endif | |
206 | ||
3abe9331 | 207 | |
970ed795 EL |
208 | ifeq ($(DEBUG), yes) |
209 | BISONFLAGS += -t -v | |
210 | endif | |
211 | ||
212 | ifeq ($(COVERAGE), yes) | |
970ed795 EL |
213 | CPPFLAGS += -DCOVERAGE_BUILD |
214 | COMPILERFLAGS += -fprofile-arcs -ftest-coverage | |
215 | LDFLAGS += -fprofile-arcs -ftest-coverage -lgcov | |
216 | endif | |
970ed795 EL |
217 | |
218 | # Directory which contains the code for POSIX regular expression handling. | |
219 | # It is needed on platforms where the system's libc does not support POSIX | |
220 | # regexps. This is the case for Mingw. | |
221 | ifdef MINGW | |
222 | # If your platform isn't Mingw but lacks POSIX regular expressions, | |
223 | # comment out the ifdef/endif | |
224 | REGEX_DIR := /mnt/TTCN/Tools/CPP/regex-glibc-2.5.1 | |
225 | endif | |
226 | ||
227 | # Warning! Never set the above directories to /usr. | |
228 | # If your OpenSSL, Qt is installed under /usr you'd better set | |
229 | # these variables to a fake (non-existent) directory. If this is the case, | |
230 | # gcc will find the required headers and libs anyway, but -I/usr/include | |
231 | # might confuse it. | |
232 | ||
233 | # This is especially true on Windows with Mingw installed as a Cygwin package. | |
234 | # -mno-cygwin alters the include serach path to find the Mingw headers. | |
235 | # Passing -I/usr/include would cause the Mingw compiler to read the Cygwin | |
236 | # headers, and the compilation will fail. | |
237 | ||
238 | # The path name where the LaTeX binaries can be found. (optional) | |
239 | # If this variable is not defined the User Documentation will not be built | |
240 | # or installed. | |
241 | TEXPATH := /usr/local/teTeX2.0.2/bin/sparc-sun-solaris2.8 | |
242 | ||
970ed795 EL |
243 | |
244 | ########################################################################### | |
245 | # You don't have to alter anything below this line. | |
246 | ||
247 | # Setting PLATFORM automagically if it is not defined. | |
248 | ifndef PLATFORM | |
249 | PLATFORM1 := $(shell uname -s) | |
250 | PLATFORM2 := $(shell uname -r) | |
251 | PLATFORM3 := $(shell uname -m) | |
252 | ifeq ($(PLATFORM1), SunOS) | |
253 | ifneq ($(PLATFORM2), 5.6) | |
254 | PLATFORM := SOLARIS8 | |
255 | PLATSUFFIX = -sol8 | |
256 | else | |
257 | PLATFORM := SOLARIS | |
258 | PLATSUFFIX = -sol6 | |
259 | endif # 5.8 | |
260 | endif # SunOS | |
261 | ifeq ($(PLATFORM1), Linux) | |
262 | PLATFORM := LINUX | |
263 | PLATSUFFIX = -linux | |
264 | endif # Linux | |
265 | ifeq ($(PLATFORM1), FreeBSD) | |
266 | PLATFORM := FREEBSD | |
267 | endif # FreeBSD | |
268 | ifeq ($(findstring CYGWIN, $(PLATFORM1)), CYGWIN) | |
269 | PLATFORM := WIN32 | |
270 | PLATSUFFIX = -cygwin | |
271 | endif # CYGWIN | |
272 | endif # ifndef PLATFORM | |
273 | ifndef PLATFORM | |
274 | PLATFORM := $(error PLEASE CHECK THE PLATFORM SETTINGS) | |
275 | endif # ifndef PLATFORM | |
276 | ||
277 | # Derived variables, which you should never change. | |
278 | ||
279 | ifdef MINGW | |
280 | ||
281 | # Target directory for binaries: | |
282 | BINDIR := $(TTCN3_DIR)/programs | |
283 | # Target directory for manual pages: | |
284 | MANDIR := $(TTCN3_DIR)/manuals | |
285 | # Target directory for other files (nedit/xemacs additions, etc.) | |
286 | ETCDIR := $(TTCN3_DIR) | |
287 | ||
288 | else | |
289 | ||
290 | # Target directory for binaries: | |
291 | BINDIR := $(TTCN3_DIR)/bin | |
292 | # Target directory for manual pages: | |
293 | MANDIR := $(TTCN3_DIR)/man | |
294 | # Target directory for other files (nedit/xemacs additions, etc.) | |
295 | ETCDIR := $(TTCN3_DIR)/etc | |
296 | ||
297 | endif | |
298 | ||
299 | # Target directory for header files: | |
300 | INCDIR := $(TTCN3_DIR)/include | |
301 | # Target directory for libraries: | |
302 | LIBDIR := $(TTCN3_DIR)/lib | |
303 | # Target directory for html help pages: | |
304 | HELPDIR := $(TTCN3_DIR)/help | |
305 | # Target directory for the documentation: | |
306 | DOCDIR := $(TTCN3_DIR)/doc | |
307 | # Target directory for the demo "Hello World!" | |
308 | DEMODIR := $(TTCN3_DIR)/demo | |
309 | ||
310 | CPPFLAGS += -D$(PLATFORM) | |
311 | ||
312 | ifeq ($(LICENSING), yes) | |
313 | CPPFLAGS += -DLICENSE | |
314 | LICENSE_LIBS = -L$(OPENSSL_DIR)/lib -lcrypto | |
315 | else | |
316 | LICENSE_LIBS := | |
317 | endif | |
318 | ||
319 | ifeq ($(USAGE_STATS), yes) | |
320 | CPPFLAGS += -DUSAGE_STATS | |
321 | endif | |
322 | ||
323 | # Windows/Cygwin specific settings | |
324 | ifeq ($(PLATFORM), WIN32) | |
325 | EXESUFFIX := .exe | |
326 | LDFLAGS += -Wl,--enable-auto-import,--enable-runtime-pseudo-reloc | |
327 | ||
328 | ifdef MINGW | |
329 | MINGW_LIBS := -lgdi32 | |
330 | endif | |
331 | else | |
332 | EXESUFFIX := | |
333 | ||
334 | ifdef MINGW | |
335 | $(error MingW not supported on $(PLATFORM)) | |
336 | endif | |
337 | ||
338 | CCFLAGS += -fPIC | |
339 | CXXFLAGS += -fPIC | |
340 | LDFLAGS += -fPIC | |
341 | endif | |
342 | ||
343 | # Try to use -isystem for Qt headers (this is a GCC feature). | |
344 | # This avoids the myriads of warnings issued for the Qt headers. | |
345 | ifneq (,$(findstring SOLARIS,$(PLATFORM))) | |
346 | # Avoid using it on Solaris, because | |
347 | # -isystem puts an implicit "extern C" around every system header, | |
348 | # which causes compilation of Qt headers to fail miserably :-( | |
349 | # (this could be fixed by recompiling GCC) | |
350 | INCLUDEQT := -I | |
351 | else | |
352 | # Not Solaris | |
353 | INCLUDEQT := -isystem | |
354 | endif | |
355 | ||
356 | # Setting EPOLL usage - It is Linux specific | |
357 | ifeq ($(PLATFORM), LINUX) | |
358 | CPPFLAGS += -DUSE_EPOLL | |
359 | endif | |
360 | ||
361 | #not useful in compiler2/asn1, for example | |
362 | #REL_DIR := $(notdir $(CURDIR)) | |
363 | ||
364 | export ABS_TOP := $(abspath $(TOP))/ | |
365 | ifeq "$(ABS_TOP)" "/" | |
366 | # abspath only from GNU make 3.81, here's a replacement | |
367 | ABS_TOP := $(shell cd $(TOP); pwd)/ | |
368 | endif | |
369 | ||
370 | ifdef SRCDIR | |
371 | ||
372 | REL_DIR := $(subst $(ABS_TOP),,$(CURDIR)) | |
373 | ||
374 | ABS_SRC := $(SRCDIR)/$(REL_DIR) | |
375 | ||
376 | CPPFLAGS += -I. -I$(ABS_SRC) | |
377 | ||
378 | SRC_TOP := $(SRCDIR) | |
379 | ||
380 | else | |
381 | ||
382 | ABS_SRC := $(abspath $(CURDIR)) | |
383 | ifeq "$(ABS_SRC)" "" | |
384 | ABS_SRC := $(shell cd $(CURDIR); pwd) | |
385 | endif | |
386 | ||
387 | SRC_TOP := $(TOP) | |
388 | ||
389 | endif | |
390 | ||
391 |