Debian Codegraph @

regression_test/Makefile.regression

raw
1 ##############################################################################
2 # Copyright (c) 2000-2021 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 v2.0
5 # which accompanies this distribution, and is available at
6 # https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.html
7 #
8 # Contributors:
9 #
10 # Balasko, Jeno
11 # Baranyi, Botond
12 # Beres, Szabolcs
13 # Delic, Adam
14 # Kovacs, Ferenc
15 # Ormandi, Matyas
16 # Raduly, Csaba
17 # Szabados, Kristof
18 # Szabo, Bence Janos
19 #
20 ##############################################################################
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 # Enable tests for the LTTng UST Logger plug-in
52 LTTNGUSTLOGGER := no
53
54 # Use code splitting when running the tests
55 # DO NOT enable both CODE_SPLIT and SPLIT_TO_SLICES
56 #CODE_SPLIT := true
57 # Use code splitting into slices when running the tests
58 #SPLIT_TO_SLICES := 30
59
60 # Use legacy codec handling when running the tests
61 #LEGACY_CODEC_HANDLING := yes
62
63 ifdef RT2
64 # add command line option to generate code for alternative runtime
65 RT2_FLAG := -R
66 TTCN3_COMPILER += $(RT2_FLAG)
67 RT2_SUFFIX := -rt2
68 endif
69
70 ifdef DYN
71 DYNAMIC_SUFFIX = -dynamic
72 ifeq ($(PLATFORM), WIN32)
73 export PATH:=$(PATH):$(TTCN3_DIR)/lib:
74 else
75 export LD_LIBRARY_PATH:=$(LD_LIBRARY_PATH):$(TTCN3_DIR)/lib:
76 endif
77 endif
78
79 ifdef CODE_SPLIT
80 SPLIT_FLAG = -Utype
81 # No space between -U and type !
82 TTCN3_COMPILER += $(SPLIT_FLAG)
83 export SPLIT_FLAG
84 else ifdef SPLIT_TO_SLICES
85 SPLIT_FLAG := -U$(SPLIT_TO_SLICES)
86 TTCN3_COMPILER += $(SPLIT_FLAG)
87 SPLIT_TO_SLICES := $(shell echo $(SPLIT_TO_SLICES) - 1 | bc)
88 SPLIT_TO_SLICES := $(shell seq 1 ${SPLIT_TO_SLICES})
89 export SPLIT_FLAG
90 endif
91
92 # Your platform. Allowed values: SOLARIS, SOLARIS8, LINUX, FREEBSD, WIN32
93 ifndef PLATFORM
94 PLATFORM1 := $(shell uname -s)
95 PLATFORM2 := $(shell uname -r)
96 PLATFORM3 := $(shell uname -m)
97
98 ifeq ($(PLATFORM1), SunOS)
99 ifeq ($(PLATFORM2), 5.6)
100 PLATFORM := SOLARIS
101 else
102 PLATFORM := SOLARIS8
103 endif # 5.6
104 endif # SunOS
105 ifeq ($(PLATFORM1), Linux)
106 PLATFORM := LINUX
107 endif # Linux
108 ifeq ($(PLATFORM1), FreeBSD)
109 PLATFORM := FREEBSD
110 endif # FreeBSD
111 ifeq ($(findstring CYGWIN, $(PLATFORM1)), CYGWIN)
112 PLATFORM := WIN32
113 endif # CYGWIN
114 ifeq ($(PLATFORM1), Interix)
115 PLATFORM := INTERIX
116 endif # Interix
117 endif # ifndef PLATFORM
118 ifndef PLATFORM
119 PLEASE CHECK THE ABOVE PLATFORM SETTINGS!!!
120 endif # ifndef PLATFORM
121
122 # Flags for the C++ preprocessor (and makedepend):
123 # This must be recursively expanded (CPPFLAGS=), not simply expanded (CPPFLAGS:=)
124 CPPFLAGS = -D$(PLATFORM) -I$(TTCN3_DIR)/include
125 ifdef RT2
126 CPPFLAGS += -DTITAN_RUNTIME_2
127 endif
128
129 # # # # Old naming and enum hack (uncomment to test) # # # #
130 # TTCN3_COMPILER += -Nold -E
131 # CPPFLAGS += -DOLD_NAMES
132
133
134 # The C++ compiler used for building:
135 CXX := g++
136 CC = $(CXX)
137
138 # Flags for the C++ compiler:
139 CXXFLAGS = -Wall
140
141 # Flags for the linker:
142 LDFLAGS =
143
144 ifeq ($(PLATFORM), WIN32)
145 EXESUFFIX := .exe
146 LDFLAGS += -Wl,--enable-auto-import,--enable-runtime-pseudo-reloc
147 else
148 EXESUFFIX :=
149
150 ifdef MINGW
151 $(error MingW not supported on $(PLATFORM))
152 endif
153 endif
154
155 ifeq ($(PLATFORM3), x86_64)
156 CCFLAGS += -fPIC
157 CXXFLAGS += -fPIC
158 LDFLAGS += -fPIC
159 endif
160
161 ifeq ($(PLATFORM),INTERIX)
162 # Pick up the right iconv
163 CPPFLAGS += -I/usr/local/include
164 endif
165
166 # Path of OpenSSL installation:
167 OPENSSL_DIR = /mnt/TTCN/Tools/openssl-0.9.8k
168
169 LCOV_DIR := /mnt/TTCN/Tools/lcov-1.7/usr
170
171 #LCOV=1
172
173 ifdef LCOV
174 CPPFLAGS += -fprofile-arcs -ftest-coverage -g
175 CXXFLAGS += -fprofile-arcs -ftest-coverage -g
176 LDFLAGS += -fprofile-arcs -ftest-coverage -g -lgcov
177 endif
178
179
180 # Utility for finding patterns:
181 ifeq ($(PLATFORM1), SunOS)
182 GREP := /usr/xpg4/bin/grep
183 else
184 GREP := grep
185 endif # SunOS
186 export GREP
187
188 # Suffix of executables
189 ifeq ($(PLATFORM), WIN32)
190 EXESUFFIX := .exe
191 else
192 EXESUFFIX :=
193 endif # WIN32
194
195 SOLARIS_LIBS = -lxnet -L${XMLDIR}/lib -lxml2 -lresolv -lcurses -ledit
196 SOLARIS8_LIBS = $(SOLARIS_LIBS) -lresolv -lcurses -ledit
197 LINUX_LIBS = -L${XMLDIR}/lib -lxml2 -lpthread -lrt -lncurses -ledit
198 FREEBSD_LIBS = -lncurses -ledit
199 WIN32_LIBS = -L${XMLDIR}/lib -lxml2 -lncurses -ledit
200 INTERIX_LIBS = -L${XMLDIR}/lib -lxml2 -liconv -lncurses -ledit
201
202
203 #
204 # Include local preferences
205 #
206 -include $(TOPDIR)/Makefile.personal
207
208 ifdef LEGACY_CODEC_HANDLING
209 TTCN3_COMPILER += -e
210 endif
211
212 ifeq (${XMLDIR}, default)
213 CPPFLAGS += -I/usr/include/libxml2
214 else
215 CPPFLAGS += -I${XMLDIR}/include/libxml2
216 endif
217
218 ifeq ($(DEBUG), yes)
219 CPPFLAGS += -DMEMORY_DEBUG
220 CXXFLAGS += -g
221 endif
222
223
224 # Quiet down a bit
225 CXXFLAGS += -Wno-deprecated-declarations
226
227 # At least ASN1/errorMessages needs ASN1_COMPILER in the environment
228 export ASN1_COMPILER TTCN3_COMPILER
229
230 print-%:
231 @echo $* = \"$($*)\" from $(origin $*)
232
233 #
234 # Define SRCDIR for OOBE. It should point to the original regression_test dir.
235 #
236 ifdef SRCDIR
237 TOP_SRC := $(SRCDIR)
238
239 # absolute path to "regression_test" in the build dir
240 ABS_TOP := $(abspath $(TOPDIR))/
241
242 # relative path from "regression_test" to current dir
243 REL_DIR := $(subst $(ABS_TOP),,$(CURDIR))
244
245 # absolute path to the equivalent of current dir
246 ABS_SRC := $(SRCDIR)/$(REL_DIR)/
247
248 vpath %.ttcnpp $(ABS_SRC)
249 vpath %.inc $(ABS_SRC)
250 vpath %.ttcn $(ABS_SRC)
251 vpath %.asn $(ABS_SRC)
252 vpath %.ttcnin $(ABS_TOP)/XML
253
254 $(foreach src, $(USER_SOURCES), $(eval vpath $(src) $(ABS_SRC)))
255
256 CPPFLAGS += -I. -I$(ABS_SRC)
257
258 else
259 TOP_SRC := $(TOPDIR)
260
261 ABS_SRC := $(abspath .)
262 ifeq "${ABS_SRC}" ""
263 ABS_SRC :=$(shell pwd)
264 endif
265
266 endif
267
268 export ABS_SRC
269
270 vpath %.cfg $(ABS_SRC)