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