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