Commit | Line | Data |
---|---|---|
970ed795 EL |
1 | ############################################################################### |
2 | # Copyright (c) 2000-2014 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 | CXXFLAGS += -fprofile-arcs -ftest-coverage -g | |
146 | LDFLAGS += -fprofile-arcs -ftest-coverage -g -lgcov | |
147 | endif | |
148 | ||
149 | ||
150 | # Utility for finding patterns: | |
151 | ifeq ($(PLATFORM1), SunOS) | |
152 | GREP := /usr/xpg4/bin/grep | |
153 | else | |
154 | GREP := grep | |
155 | endif # SunOS | |
156 | export GREP | |
157 | ||
158 | # Suffix of executables | |
159 | ifeq ($(PLATFORM), WIN32) | |
160 | EXESUFFIX := .exe | |
161 | else | |
162 | EXESUFFIX := | |
163 | endif # WIN32 | |
164 | ||
165 | SOLARIS_LIBS = -lxnet -L${XMLDIR}/lib -lxml2 -lresolv | |
166 | SOLARIS8_LIBS = $(SOLARIS_LIBS) -lresolv | |
167 | LINUX_LIBS = -L${XMLDIR}/lib -lxml2 -lpthread -lrt | |
168 | FREEBSD_LIBS = | |
169 | WIN32_LIBS = -L${XMLDIR}/lib -lxml2 | |
170 | INTERIX_LIBS = -L${XMLDIR}/lib -lxml2 -liconv | |
171 | ||
172 | ||
173 | # | |
174 | # Include local preferences | |
175 | # | |
176 | -include $(TOPDIR)/Makefile.personal | |
177 | ||
178 | ifeq (${XMLDIR}, default) | |
179 | CPPFLAGS += -I/usr/include/libxml2 | |
180 | else | |
181 | CPPFLAGS += -I${XMLDIR}/include/libxml2 | |
182 | endif | |
183 | ||
184 | ||
185 | ||
186 | # Quiet down a bit | |
187 | CXXFLAGS += -Wno-deprecated-declarations | |
188 | ||
189 | # At least ASN1/errorMessages needs ASN1_COMPILER in the environment | |
190 | export ASN1_COMPILER TTCN3_COMPILER | |
191 | ||
192 | print-%: | |
193 | @echo $* = \"$($*)\" from $(origin $*) | |
194 | ||
195 | # | |
196 | # Define SRCDIR for OOBE. It should point to the original regression_test dir. | |
197 | # | |
198 | ifdef SRCDIR | |
199 | TOP_SRC := $(SRCDIR) | |
200 | ||
201 | # absolute path to "regression_test" in the build dir | |
202 | ABS_TOP := $(abspath $(TOPDIR))/ | |
203 | ||
204 | # relative path from "regression_test" to current dir | |
205 | REL_DIR := $(subst $(ABS_TOP),,$(CURDIR)) | |
206 | ||
207 | # absolute path to the equivalent of current dir | |
208 | ABS_SRC := $(SRCDIR)/$(REL_DIR)/ | |
209 | ||
210 | vpath %.ttcnpp $(ABS_SRC) | |
211 | vpath %.inc $(ABS_SRC) | |
212 | vpath %.ttcn $(ABS_SRC) | |
213 | vpath %.asn $(ABS_SRC) | |
214 | vpath %.ttcnin $(ABS_TOP)/XML | |
215 | ||
216 | $(foreach src, $(USER_SOURCES), $(eval vpath $(src) $(ABS_SRC))) | |
217 | ||
218 | CPPFLAGS += -I. -I$(ABS_SRC) | |
219 | ||
220 | else | |
221 | TOP_SRC := $(TOPDIR) | |
222 | ||
223 | ABS_SRC := $(abspath .) | |
224 | ifeq "${ABS_SRC}" "" | |
225 | ABS_SRC :=$(shell pwd) | |
226 | endif | |
227 | ||
228 | endif | |
229 | ||
230 | export ABS_SRC | |
231 | ||
232 | vpath %.cfg $(ABS_SRC) |