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