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 | # Baji, Laszlo | |
11 | # Balasko, Jeno | |
12 | # Raduly, Csaba | |
14e21cff | 13 | # Szabo, Bence Janos |
d44e3c4f | 14 | # |
15 | ############################################################################## | |
970ed795 EL |
16 | TOPDIR := ../.. |
17 | include ../../Makefile.regression | |
18 | ||
19 | ORIG ?= . | |
20 | ||
21 | CPP := cpp | |
22 | ||
23 | # WARNING! This Makefile can be used with GNU make only. | |
24 | # Other versions of make may report syntax errors in it. | |
25 | ||
26 | # | |
27 | # Do NOT touch this line... | |
28 | # | |
29 | .PHONY: all archive check clean distclean dep objects preprocess | |
30 | ||
31 | .SUFFIXES: .d | |
32 | ||
33 | # | |
34 | # Set these variables... | |
35 | # | |
36 | ||
37 | # C preprocessor used for TTCN-3 files: | |
38 | CPP = cpp | |
39 | ||
40 | # Flags for the C++ preprocessor (and makedepend as well): | |
41 | #CPPFLAGS += | |
42 | ||
43 | # Flags for dependency generation | |
44 | CXXDEPFLAGS = -MM | |
45 | ||
46 | # Flags for preprocessing TTCN-3 files: | |
47 | CPPFLAGS_TTCN3 += | |
48 | ||
49 | # Flags for the C++ compiler: | |
50 | #CXXFLAGS = -Wall | |
51 | ||
52 | # Flags for the linker: | |
53 | LDFLAGS += | |
54 | ||
55 | ifeq ($(PLATFORM), WIN32) | |
56 | # Silence linker warnings. | |
57 | LDFLAGS += -Wl,--enable-auto-import,--enable-runtime-pseudo-reloc | |
58 | endif | |
59 | ||
60 | # Flags for the TTCN-3 and ASN.1 compiler: | |
61 | COMPILER_FLAGS += -brx | |
62 | COMPILER_FLAGS := $(sort $(COMPILER_FLAGS)) | |
63 | # $(sort ) removes duplicates | |
64 | ||
65 | # Execution mode: (either ttcn3 or ttcn3-parallel) | |
66 | TTCN3_LIB := ttcn3$(RT2_SUFFIX)$(DYNAMIC_SUFFIX) | |
67 | ||
68 | # | |
69 | # You may change these variables. Add your files if necessary... | |
70 | # | |
71 | ||
72 | # TTCN-3 modules of this project: | |
73 | TTCN3_MODULES := UsefulTtcn3Types.ttcn XSD.ttcn \ | |
74 | www_example_com_POQ.ttcn www_example_com_POU.ttcn \ | |
75 | www_example_com_POQAQ.ttcn www_example_com_POUAQ.ttcn \ | |
76 | converter.ttcn www_example_org_all.ttcn | |
77 | ||
78 | vpath %.cc $(TOP_SRC)/iconv | |
79 | vpath %.ttcn $(TOP_SRC)/iconv | |
80 | vpath %.xsd $(ABS_SRC) | |
81 | ||
82 | # TTCN-3 modules to preprocess: | |
83 | TTCN3_PP_MODULES = POtest.ttcnpp | |
84 | ||
85 | # Files to include in TTCN-3 preprocessed modules: | |
86 | TTCN3_INCLUDES = $(TOP_SRC)/XML/macros.ttcnin | |
87 | ||
88 | # ASN.1 modules of this project: | |
89 | ASN1_MODULES = | |
90 | ||
91 | # TTCN-3 source files generated by the C preprocessor: | |
92 | PREPROCESSED_TTCN3_MODULES = $(notdir $(TTCN3_PP_MODULES:.ttcnpp=.ttcn)) | |
93 | ||
94 | # C++ source & header files generated from the TTCN-3 & ASN.1 modules of | |
95 | # this project: | |
96 | GENERATED_SOURCES := $(TTCN3_MODULES:.ttcn=.cc) $(TTCN3_PP_MODULES:.ttcnpp=.cc) $(ASN1_MODULES:.asn=.cc) | |
97 | GENERATED_HEADERS := $(GENERATED_SOURCES:.cc=.hh) | |
98 | ifdef CODE_SPLIT | |
99 | GENERATED_SOURCES := $(foreach file, $(GENERATED_SOURCES:.cc=), $(addprefix $(file), .cc _seq.cc _set.cc _seqof.cc _setof.cc _union.cc)) | |
14e21cff | 100 | else ifdef SPLIT_TO_SLICES |
101 | POSTFIXES := $(foreach file, $(SPLIT_TO_SLICES), $(addsuffix $(file), _part_)) | |
102 | POSTFIXES := $(foreach file, $(POSTFIXES), $(addprefix $(file), .cc)) | |
103 | GENERATED_SOURCES2 := $(foreach file, $(GENERATED_SOURCES:.cc=), $(addprefix $(file), $(POSTFIXES))) | |
104 | GENERATED_SOURCES += $(GENERATED_SOURCES2) | |
970ed795 EL |
105 | endif |
106 | ||
107 | # C/C++ Source & header files of Test Ports, external functions and | |
108 | # other modules: | |
109 | USER_SOURCES = iconver.cc | |
110 | USER_HEADERS = $(USER_SOURCES:.cc=.hh) | |
111 | ||
112 | # Object files of this project that are needed for the executable test suite: | |
113 | OBJECTS = $(GENERATED_SOURCES:.cc=.o) $(USER_SOURCES:.cc=.o) | |
114 | ||
115 | DEPFILES = $(OBJECTS:.o=.d) | |
116 | ||
117 | # Other files of the project (Makefile, configuration files, etc.) | |
118 | # that will be added to the archived source files: | |
119 | OTHER_FILES = po_qual_default.xml po_qual_explicit.xml po_unqual.xml \ | |
120 | po_qual.xsd po_qual_atr.xsd po_qual_both.xsd po_unqual.xsd \ | |
121 | config.cfg Makefile | |
122 | ||
123 | # The name of the executable test suite: | |
124 | TARGET = POtest$(EXESUFFIX) | |
125 | ||
126 | # | |
127 | # Do not modify these unless you know what you are doing... | |
128 | # Platform specific additional libraries: | |
129 | # | |
f08ff9ca BB |
130 | SOLARIS_LIBS = -lsocket -lnsl -lxml2 -lresolv -lcurses |
131 | SOLARIS8_LIBS = -lsocket -lnsl -lxml2 -lresolv -lcurses | |
132 | LINUX_LIBS = -lxml2 -lpthread -lrt -lncurses | |
133 | FREEBSD_LIBS = -lxml2 -liconv -lncurses | |
134 | WIN32_LIBS = -lxml2 -liconv -lncurses | |
970ed795 EL |
135 | |
136 | # | |
137 | # Rules for building the executable... | |
138 | # | |
139 | ||
140 | all: $(TARGET) ; | |
141 | ||
142 | shared_objects: $(SHARED_OBJECTS) ; | |
143 | ||
144 | objects: $(OBJECTS) ; | |
145 | ||
146 | ifeq ($(findstring dynamic,$(TTCN3_LIB)),) | |
147 | # not dynamic | |
148 | CORELIB_BINARY := $(TTCN3_DIR)/lib/lib$(TTCN3_LIB).a | |
149 | else | |
150 | CORELIB_BINARY := $(TTCN3_DIR)/lib/lib$(TTCN3_LIB).so | |
151 | endif | |
152 | ||
153 | $(TARGET): $(OBJECTS) $(CORELIB_BINARY) | |
154 | $(CXX) $(LDFLAGS) -o $@ $(OBJECTS) \ | |
155 | -L$(TTCN3_DIR)/lib -l$(TTCN3_LIB) \ | |
156 | -L$(OPENSSL_DIR)/lib -lcrypto \ | |
157 | -L$(XMLDIR)/lib $($(PLATFORM)_LIBS) \ | |
158 | || $(TTCN3_DIR)/bin/titanver $(OBJECTS) | |
159 | ||
160 | .cc.o .c.o: | |
161 | $(CXX) -c $(CPPFLAGS) $(CXXFLAGS) -o $@ $< | |
162 | ||
163 | .cc.d .c.d: | |
164 | @echo Creating dependency file for '$<'; set -e; \ | |
165 | $(CXX) $(CXXDEPFLAGS) $(CPPFLAGS) $(CXXFLAGS) $< \ | |
166 | | sed 's/\($*\)\.o[ :]*/\1.o $@ : /g' > $@; \ | |
167 | [ -s $@ ] || rm -f $@ | |
168 | ||
169 | %.ttcn: %.ttcnpp $(TTCN3_INCLUDES) | |
170 | $(CPP) -x c -nostdinc $(CPPFLAGS_TTCN3) $< $@ | |
171 | ||
172 | preprocess: $(PREPROCESSED_TTCN3_MODULES) ; | |
173 | ||
174 | $(GENERATED_SOURCES) $(GENERATED_HEADERS): compile | |
175 | @if [ ! -f $@ ]; then $(RM) compile; $(MAKE) compile; fi | |
176 | ||
177 | check: $(TTCN3_MODULES) $(PREPROCESSED_TTCN3_MODULES) $(ASN1_MODULES) | |
178 | $(TTCN3_COMPILER) -s $(COMPILER_FLAGS) $^ | |
179 | ||
180 | compile:: $(firstword $(TTCN3_COMPILER)) | |
181 | @if [ -f $@ ]; then $(RM) compile; $(MAKE) compile; fi | |
182 | ||
183 | compile:: $(TTCN3_MODULES) $(PREPROCESSED_TTCN3_MODULES) $(ASN1_MODULES) | |
184 | $(TTCN3_COMPILER) $(COMPILER_FLAGS) $^ - $? | |
185 | touch $@ | |
186 | ||
187 | clean distclean: | |
188 | -$(RM) $(TARGET) $(OBJECTS) $(GENERATED_HEADERS) \ | |
189 | $(GENERATED_SOURCES) $(PREPROCESSED_TTCN3_MODULES) compile \ | |
190 | tags *.log $(DEPFILES) \ | |
191 | www_example*.ttcn UsefulTtcn3Types.ttcn XSD.ttcn | |
192 | ||
193 | dep: $(GENERATED_SOURCES) $(USER_SOURCES) $(DEPFILES); | |
194 | ||
195 | ifeq (,$(findstring n,$(MAKEFLAGS))) | |
196 | ifeq (,$(findstring clean,$(MAKECMDGOALS))) | |
197 | ifeq (,$(findstring preprocess,$(MAKECMDGOALS))) | |
198 | -include $(DEPFILES) | |
199 | endif | |
200 | endif | |
201 | endif | |
202 | ||
203 | ||
204 | # | |
205 | # Add your rules here if necessary... | |
206 | # | |
207 | ||
208 | RUN := $(shell which colortitan 2>/dev/null) | |
209 | ifeq ($(firstword $(RUN)),no) | |
210 | # stupid /bin/which on Solaris writes errors to stdout instead of stderr | |
211 | RUN := | |
212 | endif | |
213 | ||
214 | run: $(TARGET) config.cfg | |
215 | $(RUN) ./$^ | |
216 | ||
217 | ||
218 | # # # # # # # # # # # # # # # | |
219 | # | |
220 | # xsd2ttcn *.xsd renames the various PurchaseOrder types | |
221 | # to prevent name clashes. To avoid this, compile each xsd separately. | |
222 | # | |
223 | UsefulTtcn3Types.ttcn XSD.ttcn www_example_com_POUAQ.ttcn:: po_qual_atr.xsd | |
224 | $(TTCN3_DIR)/bin/xsd2ttcn -z $< | |
225 | ||
226 | UsefulTtcn3Types.ttcn XSD.ttcn www_example_com_POQAQ.ttcn:: po_qual_both.xsd | |
227 | $(TTCN3_DIR)/bin/xsd2ttcn -z $< | |
228 | ||
229 | UsefulTtcn3Types.ttcn XSD.ttcn www_example_com_POU.ttcn:: po_unqual.xsd | |
230 | $(TTCN3_DIR)/bin/xsd2ttcn -z $< | |
231 | ||
232 | UsefulTtcn3Types.ttcn XSD.ttcn www_example_com_POQ.ttcn:: po_qual.xsd | |
233 | $(TTCN3_DIR)/bin/xsd2ttcn -z $< | |
234 | ||
235 | UsefulTtcn3Types.ttcn XSD.ttcn www_example_org_all.ttcn:: globall.xsd | |
236 | $(TTCN3_DIR)/bin/xsd2ttcn -z $< | |
237 |