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