922a5a9e6d07d019eb0e25e2367afcced52b6023
[deliverable/titan.core.git] / regression_test / XML / EXER-whitepaper / Makefile
1 ##############################################################################
2 # Copyright (c) 2000-2016 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 # Contributors:
9 # Baji, Laszlo
10 # Balasko, Jeno
11 # Kovacs, Ferenc
12 # Raduly, Csaba
13 #
14 ##############################################################################
15 #
16 # Tests transcribed from "ASN.1, a schema language for XML"
17 #
18
19 TOPDIR := ../..
20 include ../../Makefile.regression
21
22 ORIG ?= .
23
24 ifdef SRCDIR
25 ORIGSRC := $(ABS_SRC)
26 else
27 ORIGSRC := $(ORIG)
28 endif
29
30 CPP := cpp
31
32 # Flags for the C++ preprocessor (and makedepend as well):
33 #CPPFLAGS +=
34
35 # Flags for preprocessing TTCN-3 files:
36 #CPPFLAGS_TTCN3 +=
37
38 # Flags for the C++ compiler:
39 CXXFLAGS += -g -fmessage-length=0
40
41 # Flags for the linker:
42 LDFLAGS += -g
43
44 WIN32_LIBS += -liconv
45 INTERIX_LIBS += -L/usr/local/lib -liconv
46 FREEBSD_LIBS += -liconv
47
48 # Local flags for Titan (can be overridden from the environment or commandline)
49 TTCNFLAGS := -b -r -x
50
51 # Flags for the TTCN-3 and ASN.1 compiler
52 # (common flags already set in Makefile.regression)
53 COMPILER_FLAGS += $(TTCNFLAGS) -a
54
55 # $(sort ) also eliminates duplicates
56 COMPILER_FLAGS := $(sort $(COMPILER_FLAGS))
57
58 # Execution mode: (either ttcn3 or ttcn3-parallel)
59 TTCN3_LIB := ttcn3$(RT2_SUFFIX)$(DYNAMIC_SUFFIX)
60
61 ##
62 ##
63
64 # TTCN-3 modules of this project:
65 TTCN3_MODULES = converter.ttcn
66 # UTF8.ttcn
67
68 # TTCN-3 modules to preprocess:
69 TTCN3_PP_MODULES := $(wildcard $(ORIGSRC)/*.ttcnpp)
70
71
72 # Files to include in TTCN-3 preprocessed modules:
73 TTCN3_INCLUDES = $(TOP_SRC)/XML/macros.ttcnin
74
75 # TTCN-3 source files generated by the C preprocessor:
76 PREPROCESSED_TTCN3_MODULES := $(notdir $(TTCN3_PP_MODULES:.ttcnpp=.ttcn))
77
78
79 # C++ source & header files generated from the TTCN-3 & ASN.1 modules of
80 # this project:
81 GENERATED_SOURCES := $(TTCN3_MODULES:.ttcn=.cc) $(PREPROCESSED_TTCN3_MODULES:.ttcn=.cc) $(ASN1_MODULES:.asn=.cc)
82 GENERATED_HEADERS := $(GENERATED_SOURCES:.cc=.hh)
83 ifdef CODE_SPLIT
84 GENERATED_SOURCES := $(foreach file, $(GENERATED_SOURCES:.cc=), $(addprefix $(file), .cc _seq.cc _set.cc _seqof.cc _setof.cc _union.cc))
85 endif
86
87 # C/C++ Source & header files of Test Ports, external functions and
88 # other modules:
89 USER_SOURCES := iconver.cc
90 USER_HEADERS := $(USER_SOURCES:.cc=.hh)
91
92 # Object files of this project that are needed for the executable test suite:
93 OBJECTS := $(GENERATED_SOURCES:.cc=.o) $(USER_SOURCES:.cc=.o)
94
95 # The name of the executable test suite:
96 TARGET := EXERtest$(RT2_SUFFIX)$(EXESUFFIX)
97
98 #
99 # Rules for building the executable...
100 #
101
102 all: $(TARGET)
103
104 objects: $(OBJECTS) ;
105
106 ifeq ($(findstring dynamic,$(TTCN3_LIB)),)
107 # not dynamic
108 CORELIB_BINARY := $(TTCN3_DIR)/lib/lib$(TTCN3_LIB).a
109 else
110 CORELIB_BINARY := $(TTCN3_DIR)/lib/lib$(TTCN3_LIB).so
111 endif
112
113 # libttcn3.a appears twice; this should be harmless
114 $(TARGET): $(OBJECTS) $(CORELIB_BINARY)
115 $(CXX) $(LDFLAGS) -o $@ $(OBJECTS) \
116 -L$(TTCN3_DIR)/lib -l$(TTCN3_LIB) \
117 -L$(OPENSSL_DIR)/lib -lcrypto $($(PLATFORM)_LIBS) \
118 || $(TTCN3_DIR)/bin/titanver $(OBJECTS)
119
120 %.o: %.cc
121 @echo '(C++)' $<; $(CXX) -c $(CPPFLAGS) $(CXXFLAGS) $<
122
123 %.d: %.cc
124 @echo '(dep)' $<; $(CXX) -MM -MP $(CPPFLAGS) $(CXXFLAGS) $< >$@
125
126 # The preprocessing step
127 %.ttcn: %.ttcnpp $(TTCN3_INCLUDES)
128 $(CPP) -x c -nostdinc $(CPPFLAGS_TTCN3) $< $@
129
130 preprocess: $(PREPROCESSED_TTCN3_MODULES) ;
131
132 $(GENERATED_SOURCES) $(GENERATED_HEADERS): compile
133 @if [ ! -f $@ ]; then $(RM) compile; $(MAKE) compile; fi
134
135 check: $(TTCN3_MODULES) $(PREPROCESSED_TTCN3_MODULES) $(ASN1_MODULES)
136 $(TTCN3_COMPILER) -s $(COMPILER_FLAGS) $^
137
138 compile:: $(firstword $(TTCN3_COMPILER))
139 @if [ -f $@ ]; then $(RM) compile; $(MAKE) compile; fi
140 # if [ -f $(GENERATED_SOURCES) ]; then rm -f $(GENERATED_SOURCES); $(MAKE) $(GENERATED_SOURCES); fi
141
142 compile:: $(TTCN3_MODULES) $(PREPROCESSED_TTCN3_MODULES) $(ASN1_MODULES)
143 # "modulepar boolean verbose" makes this unusable with old names
144 $(TTCN3_COMPILER) $(COMPILER_FLAGS) $^ - $?
145 touch $@
146
147 clean celan clena:
148 -$(RM) $(TARGET) $(OBJECTS) $(GENERATED_HEADERS) \
149 $(GENERATED_SOURCES) $(PREPROCESSED_TTCN3_MODULES) compile \
150 tags *.log
151
152 distclean: clean
153 -$(RM) $(DEPFILES)
154
155 #
156 # Add your rules here if necessary...
157 #
158
159 .SUFFIXES: .asn .ttcn .ttcnpp
160
161 RUN := $(shell which colortitan 2>/dev/null)
162 ifeq ($(firstword $(RUN)),no)
163 # stupid /bin/which on Solaris writes errors to stdout instead of stderr
164 RUN :=
165 endif
166
167 run: $(TARGET) config.cfg
168 $(RUN) ./$^
169
170 debug:
171 $(MAKE) run RUN='gdb --args'
172
173 vpath %.cc $(TOP_SRC)/iconv
174 vpath %.ttcn $(TOP_SRC)/iconv
175
176
177 dep: ;
178
179 DEPFILES := $(OBJECTS:.o=.d)
180
181 ifeq (,$(findstring n,$(MAKEFLAGS)))
182 ifeq (,$(filter clean distclean preprocess,$(MAKECMDGOALS)))
183 -include $(DEPFILES)
184 endif
185 endif
186
187 # Only ttcnpp files contain tests
188 TESTS := $(PREPROCESSED_TTCN3_MODULES:.ttcn=)
189
190 # Ability to run one control part
191 $(TESTS): $(TARGET) config.cfg
192 $(RUN) ./$^ $@
193
194 ifdef SRCDIR
195 $(foreach src, $(USER_SOURCES), $(eval vpath $(src) $(ABS_SRC)))
196 endif
This page took 0.03364 seconds and 4 git commands to generate.