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