Sync with 5.4.0
[deliverable/titan.core.git] / regression_test / XML / XER / Makefile
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 TOPDIR := ../..
9 include ../../Makefile.regression
10
11 ORIG ?= $(ABS_SRC)
12
13 #ifdef SRCDIR
14 #$(warning yes SRC=$(SRCDIR))
15 ORIGSRC := $(TOP_SRC)/XML/XER
16 #else
17 #$(warning no SRC)
18 #ORIGSRC := $(ORIG)
19 #endif
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 check clean dep objects preprocess
30
31 #
32 # Set these variables...
33 #
34
35
36 # Flags for the C++ preprocessor (and makedepend as well):
37 #CPPFLAGS +=
38
39 # Flags for preprocessing TTCN-3 files:
40 #CPPFLAGS_TTCN3 +=
41
42 # Flags for the C++ compiler:
43 CXXFLAGS += -g -W -Wformat=2
44
45 # Flags for the linker:
46 LDFLAGS += -g
47
48 WIN32_LIBS += -liconv
49 FREEBSD_LIBS += -liconv
50
51 # Local flags for Titan (can be overridden from the environment or commandline)
52 TTCNFLAGS := -b -r -x
53
54 # Flags for the TTCN-3 and ASN.1 compiler
55 # (common flags already set in Makefile.regression)
56 COMPILER_FLAGS += $(TTCNFLAGS) -a
57
58 # $(sort ) also eliminates duplicates
59 COMPILER_FLAGS := $(sort $(COMPILER_FLAGS))
60
61 # Execution mode: (either ttcn3 or ttcn3-parallel)
62 TTCN3_LIB := ttcn3$(RT2_SUFFIX)$(DYNAMIC_SUFFIX)
63
64 #
65 # You may change these variables. Add your files if necessary...
66 #
67
68 # TTCN-3 modules of this project:
69 TTCN3_MODULES := $(TOP_SRC)/iconv/converter.ttcn UTF8.ttcn
70
71 # TTCN-3 modules to preprocess:
72 TTCN3_PP_MODULES := $(wildcard $(ORIGSRC)/*.ttcnpp)
73 #Txerstring.ttcnpp
74
75 # Files to include in TTCN-3 preprocessed modules:
76 TTCN3_INCLUDES := $(TOP_SRC)/XML/macros.ttcnin
77
78 # ASN.1 modules of this project:
79 ASN1_MODULES := Asntypes.asn AsnValues.asn EmptyUnion.asn \
80 Sets.asn SetValues.asn ObjectClass.asn ObjectClassWithSyntax.asn
81
82 # TTCN-3 source files generated by the C preprocessor:
83 PREPROCESSED_TTCN3_MODULES := $(notdir $(TTCN3_PP_MODULES:.ttcnpp=.ttcn))
84 #Txerstring.ttcn
85
86 # C++ source & header files generated from the TTCN-3 & ASN.1 modules of
87 # this project:
88 GENERATED_SOURCES := $(notdir $(TTCN3_MODULES:.ttcn=.cc) $(PREPROCESSED_TTCN3_MODULES:.ttcn=.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 := Flatten.cc 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 # The name of the executable test suite:
103 TARGET := Xertest$(RT2_SUFFIX)$(EXESUFFIX)
104
105
106 #
107 # Rules for building the executable...
108 #
109
110 all: $(TARGET)
111
112
113 objects: $(OBJECTS) ;
114
115 ifeq ($(findstring dynamic,$(TTCN3_LIB)),)
116 # not dynamic
117 CORELIB_BINARY := $(TTCN3_DIR)/lib/lib$(TTCN3_LIB).a
118 else
119 CORELIB_BINARY := $(TTCN3_DIR)/lib/lib$(TTCN3_LIB).so
120 endif
121
122 # libttcn3.a appears twice; this should be harmless
123 $(TARGET): $(OBJECTS) $(CORELIB_BINARY)
124 $(CXX) $(LDFLAGS) -o $@ $(OBJECTS) \
125 -L$(TTCN3_DIR)/lib -l$(TTCN3_LIB) \
126 -L$(OPENSSL_DIR)/lib -lcrypto $($(PLATFORM)_LIBS) \
127 || $(TTCN3_DIR)/bin/titanver $(OBJECTS)
128
129 %.o: %.cc
130 @echo '(C++)' $<; $(CXX) -c $(CPPFLAGS) $(CXXFLAGS) $<
131
132 %.d: %.cc
133 @echo '(dep)' $<; $(CXX) -MM -MP $(CPPFLAGS) $(CXXFLAGS) $< >$@
134
135
136 # The preprocessing step
137 %.ttcn: %.ttcnpp $(TTCN3_INCLUDES)
138 $(CPP) -x c -nostdinc $(CPPFLAGS_TTCN3) $< $@
139
140 preprocess: $(PREPROCESSED_TTCN3_MODULES) ;
141
142 $(GENERATED_SOURCES) $(GENERATED_HEADERS): compile
143 @if [ ! -f $@ ]; then $(RM) compile; $(MAKE) compile; fi
144
145
146 compile:: $(firstword $(TTCN3_COMPILER))
147 @if [ -f $@ ]; then $(RM) compile; $(MAKE) compile; fi
148 # if [ -f $(GENERATED_SOURCES) ]; then rm -f $(GENERATED_SOURCES); $(MAKE) $(GENERATED_SOURCES); fi
149
150 compile:: $(TTCN3_MODULES) $(PREPROCESSED_TTCN3_MODULES) $(ASN1_MODULES)
151 $(TTCN3_COMPILER) $(COMPILER_FLAGS) -c $^ $(ORIG)/junk.ttcn3 2>&1 | $(ORIG)/checkit.pl
152 $(TTCN3_COMPILER) $(COMPILER_FLAGS) $^ - $?
153 touch $@
154
155 clean celan clena:
156 -$(RM) $(TARGET) $(OBJECTS) $(GENERATED_HEADERS) \
157 $(GENERATED_SOURCES) $(PREPROCESSED_TTCN3_MODULES) compile \
158 tags *.log
159
160 distclean: clean
161 -$(RM) $(DEPFILES)
162
163 #
164 # Add your rules here if necessary...
165 #
166
167 .SUFFIXES: .asn .ttcn .ttcnpp
168
169 RUN := $(shell which colortitan 2>/dev/null)
170 ifeq ($(firstword $(RUN)),no)
171 # stupid /bin/which on Solaris writes errors to stdout instead of stderr
172 RUN :=
173 endif
174
175 run: $(TARGET) config.cfg
176 ./$(TARGET) -v 2>&1 | $(ORIG)/checkit.pl
177 $(RUN) ./$^
178
179 debug:
180 $(MAKE) run RUN='gdb --args'
181
182
183 #################
184
185 xertest: xertest.o ../../core/libttcn3.a
186
187 xerun: xertest
188 -./$<
189
190 install:
191 @echo You cannot be serious!
192
193
194
195 vpath iconver.cc $(TOP_SRC)/iconv
196 vpath %.ttcn $(TOP_SRC)/iconv:$(TOP_SRC)/XML/TTCNandXML
197
198
199 dep: ;
200
201 DEPFILES := $(OBJECTS:.o=.d)
202
203 ifeq (,$(findstring n,$(MAKEFLAGS)))
204 ifeq (,$(filter clean distclean preprocess,$(MAKECMDGOALS)))
205 -include $(DEPFILES)
206 endif
207 endif
208
209 ifdef SRCDIR
210 $(foreach src, $(USER_SOURCES), $(eval vpath $(src) $(ABS_SRC)))
211 endif
This page took 0.041626 seconds and 6 git commands to generate.