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