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