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