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