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