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