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