Commit | Line | Data |
---|---|---|
d44e3c4f | 1 | ############################################################################## |
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 | # > | |
11 | # Balasko, Jeno | |
12 | # Beres, Szabolcs | |
13 | # Delic, Adam | |
14 | # Kovacs, Ferenc | |
15 | # Ormandi, Matyas | |
16 | # Raduly, Csaba | |
17 | # Szabados, Kristof | |
14e21cff | 18 | # Szabo, Bence Janos |
d44e3c4f | 19 | # |
20 | ############################################################################## | |
970ed795 EL |
21 | # |
22 | # Common settings for all regression tests (formerly passed through | |
23 | # the environment). | |
24 | # | |
25 | # Warning! This makefile is included at the beginning of other makefiles. | |
26 | # Do not put any targets here (they would override the default target). | |
27 | # | |
28 | ||
29 | ifndef TOPDIR | |
30 | $(error Please define TOPDIR in the including makefile) | |
31 | endif | |
32 | ||
33 | # hardcode a path for Jenkinks to workaround XML/XmlWorkflow/bin/prj2mk.pl | |
34 | ifneq ($(origin TTCN3_DIR), file) | |
35 | # The directory that the Test Executor is installed in: | |
36 | TTCN3_DIR := $(shell cd $(TOPDIR)/..; pwd)/Install | |
37 | export TTCN3_DIR | |
38 | # The following would be nicer, but abspath requires make 3.81 (rhea has only 3.79.1) | |
39 | #TTCN3_DIR := $(abspath $(TOPDIR)/../Install) | |
40 | endif | |
41 | ||
42 | # Command for compiling TTCN-3 and ASN.1 modules | |
43 | TTCN3_COMPILER := $(TTCN3_DIR)/bin/compiler | |
44 | ||
45 | # Many tests ignore COMPILER_FLAGS. Append any common options to the compiler name. | |
46 | TTCN3_COMPILER += -g -L | |
47 | ||
48 | # Use the alternative runtime when running the tests | |
49 | #RT2 := true | |
50 | ||
51 | # Use code splitting when running the tests | |
14e21cff | 52 | # DO NOT enable both CODE_SPLIT and SPLIT_TO_SLICES |
970ed795 | 53 | #CODE_SPLIT := true |
14e21cff | 54 | # Use code splitting into slices when running the tests |
55 | #SPLIT_TO_SLICES := 30 | |
970ed795 EL |
56 | |
57 | ifdef RT2 | |
58 | # add command line option to generate code for alternative runtime | |
59 | RT2_FLAG := -R | |
60 | TTCN3_COMPILER += $(RT2_FLAG) | |
61 | RT2_SUFFIX := -rt2 | |
62 | endif | |
63 | ||
64 | ifdef DYN | |
65 | DYNAMIC_SUFFIX = -dynamic | |
66 | ifeq ($(PLATFORM), WIN32) | |
1076e2d0 | 67 | export PATH+=:$(TTCN3_DIR)/lib: |
970ed795 | 68 | else |
1076e2d0 | 69 | export LD_LIBRARY_PATH+=:$(TTCN3_DIR)/lib: |
970ed795 EL |
70 | endif |
71 | endif | |
72 | ||
73 | ifdef CODE_SPLIT | |
74 | SPLIT_FLAG = -Utype | |
75 | # No space between -U and type ! | |
76 | TTCN3_COMPILER += $(SPLIT_FLAG) | |
14e21cff | 77 | export SPLIT_FLAG |
78 | else ifdef SPLIT_TO_SLICES | |
79 | SPLIT_FLAG := -U$(SPLIT_TO_SLICES) | |
80 | TTCN3_COMPILER += $(SPLIT_FLAG) | |
81 | SPLIT_TO_SLICES := $(shell echo $(SPLIT_TO_SLICES) - 1 | bc) | |
82 | SPLIT_TO_SLICES := $(shell seq 1 ${SPLIT_TO_SLICES}) | |
83 | export SPLIT_FLAG | |
970ed795 EL |
84 | endif |
85 | ||
86 | # Your platform. Allowed values: SOLARIS, SOLARIS8, LINUX, FREEBSD, WIN32 | |
87 | ifndef PLATFORM | |
88 | PLATFORM1 := $(shell uname -s) | |
89 | PLATFORM2 := $(shell uname -r) | |
90 | PLATFORM3 := $(shell uname -m) | |
91 | ||
92 | ifeq ($(PLATFORM1), SunOS) | |
93 | ifeq ($(PLATFORM2), 5.6) | |
94 | PLATFORM := SOLARIS | |
95 | else | |
96 | PLATFORM := SOLARIS8 | |
97 | endif # 5.6 | |
98 | endif # SunOS | |
99 | ifeq ($(PLATFORM1), Linux) | |
100 | PLATFORM := LINUX | |
101 | endif # Linux | |
102 | ifeq ($(PLATFORM1), FreeBSD) | |
103 | PLATFORM := FREEBSD | |
104 | endif # FreeBSD | |
105 | ifeq ($(findstring CYGWIN, $(PLATFORM1)), CYGWIN) | |
106 | PLATFORM := WIN32 | |
107 | endif # CYGWIN | |
108 | ifeq ($(PLATFORM1), Interix) | |
109 | PLATFORM := INTERIX | |
110 | endif # Interix | |
111 | endif # ifndef PLATFORM | |
112 | ifndef PLATFORM | |
113 | PLEASE CHECK THE ABOVE PLATFORM SETTINGS!!! | |
114 | endif # ifndef PLATFORM | |
115 | ||
116 | # Flags for the C++ preprocessor (and makedepend): | |
117 | # This must be recursively expanded (CPPFLAGS=), not simply expanded (CPPFLAGS:=) | |
118 | CPPFLAGS = -D$(PLATFORM) -I$(TTCN3_DIR)/include | |
119 | ifdef RT2 | |
120 | CPPFLAGS += -DTITAN_RUNTIME_2 | |
121 | endif | |
122 | ||
123 | # # # # Old naming and enum hack (uncomment to test) # # # # | |
124 | # TTCN3_COMPILER += -Nold -E | |
125 | # CPPFLAGS += -DOLD_NAMES | |
126 | ||
127 | ||
128 | # The C++ compiler used for building: | |
129 | CXX := g++ | |
130 | CC = $(CXX) | |
131 | ||
132 | # Flags for the C++ compiler: | |
133 | CXXFLAGS = -Wall | |
134 | ||
135 | # Flags for the linker: | |
136 | LDFLAGS = | |
137 | ||
138 | ifeq ($(PLATFORM), WIN32) | |
139 | EXESUFFIX := .exe | |
140 | LDFLAGS += -Wl,--enable-auto-import,--enable-runtime-pseudo-reloc | |
141 | else | |
142 | EXESUFFIX := | |
143 | ||
144 | ifdef MINGW | |
145 | $(error MingW not supported on $(PLATFORM)) | |
146 | endif | |
147 | endif | |
148 | ||
149 | ifeq ($(PLATFORM3), x86_64) | |
150 | CCFLAGS += -fPIC | |
151 | CXXFLAGS += -fPIC | |
152 | LDFLAGS += -fPIC | |
153 | endif | |
154 | ||
155 | ifeq ($(PLATFORM),INTERIX) | |
156 | # Pick up the right iconv | |
157 | CPPFLAGS += -I/usr/local/include | |
158 | endif | |
159 | ||
160 | # Path of OpenSSL installation: | |
161 | OPENSSL_DIR = /mnt/TTCN/Tools/openssl-0.9.8k | |
162 | ||
163 | LCOV_DIR := /mnt/TTCN/Tools/lcov-1.7/usr | |
164 | ||
165 | #LCOV=1 | |
166 | ||
167 | ifdef LCOV | |
3abe9331 | 168 | CPPFLAGS += -fprofile-arcs -ftest-coverage -g |
970ed795 EL |
169 | CXXFLAGS += -fprofile-arcs -ftest-coverage -g |
170 | LDFLAGS += -fprofile-arcs -ftest-coverage -g -lgcov | |
171 | endif | |
172 | ||
173 | ||
174 | # Utility for finding patterns: | |
175 | ifeq ($(PLATFORM1), SunOS) | |
176 | GREP := /usr/xpg4/bin/grep | |
177 | else | |
178 | GREP := grep | |
179 | endif # SunOS | |
180 | export GREP | |
181 | ||
182 | # Suffix of executables | |
183 | ifeq ($(PLATFORM), WIN32) | |
184 | EXESUFFIX := .exe | |
185 | else | |
186 | EXESUFFIX := | |
187 | endif # WIN32 | |
188 | ||
f08ff9ca BB |
189 | SOLARIS_LIBS = -lxnet -L${XMLDIR}/lib -lxml2 -lresolv -lcurses |
190 | SOLARIS8_LIBS = $(SOLARIS_LIBS) -lresolv -lcurses | |
191 | LINUX_LIBS = -L${XMLDIR}/lib -lxml2 -lpthread -lrt -lncurses | |
192 | FREEBSD_LIBS = -lncurses | |
193 | WIN32_LIBS = -L${XMLDIR}/lib -lxml2 -lncurses | |
194 | INTERIX_LIBS = -L${XMLDIR}/lib -lxml2 -liconv -lncurses | |
970ed795 EL |
195 | |
196 | ||
197 | # | |
198 | # Include local preferences | |
199 | # | |
200 | -include $(TOPDIR)/Makefile.personal | |
201 | ||
202 | ifeq (${XMLDIR}, default) | |
203 | CPPFLAGS += -I/usr/include/libxml2 | |
204 | else | |
205 | CPPFLAGS += -I${XMLDIR}/include/libxml2 | |
206 | endif | |
207 | ||
208 | ||
209 | ||
210 | # Quiet down a bit | |
211 | CXXFLAGS += -Wno-deprecated-declarations | |
212 | ||
213 | # At least ASN1/errorMessages needs ASN1_COMPILER in the environment | |
214 | export ASN1_COMPILER TTCN3_COMPILER | |
215 | ||
216 | print-%: | |
217 | @echo $* = \"$($*)\" from $(origin $*) | |
218 | ||
219 | # | |
220 | # Define SRCDIR for OOBE. It should point to the original regression_test dir. | |
221 | # | |
222 | ifdef SRCDIR | |
223 | TOP_SRC := $(SRCDIR) | |
224 | ||
225 | # absolute path to "regression_test" in the build dir | |
226 | ABS_TOP := $(abspath $(TOPDIR))/ | |
227 | ||
228 | # relative path from "regression_test" to current dir | |
229 | REL_DIR := $(subst $(ABS_TOP),,$(CURDIR)) | |
230 | ||
231 | # absolute path to the equivalent of current dir | |
232 | ABS_SRC := $(SRCDIR)/$(REL_DIR)/ | |
233 | ||
234 | vpath %.ttcnpp $(ABS_SRC) | |
235 | vpath %.inc $(ABS_SRC) | |
236 | vpath %.ttcn $(ABS_SRC) | |
237 | vpath %.asn $(ABS_SRC) | |
238 | vpath %.ttcnin $(ABS_TOP)/XML | |
239 | ||
240 | $(foreach src, $(USER_SOURCES), $(eval vpath $(src) $(ABS_SRC))) | |
241 | ||
242 | CPPFLAGS += -I. -I$(ABS_SRC) | |
243 | ||
244 | else | |
245 | TOP_SRC := $(TOPDIR) | |
246 | ||
247 | ABS_SRC := $(abspath .) | |
248 | ifeq "${ABS_SRC}" "" | |
249 | ABS_SRC :=$(shell pwd) | |
250 | endif | |
251 | ||
252 | endif | |
253 | ||
254 | export ABS_SRC | |
255 | ||
256 | vpath %.cfg $(ABS_SRC) |