implemented new code splitting mechanism (split to equal slices)
[deliverable/titan.core.git] / regression_test / XML / TTCNandXML / Makefile
CommitLineData
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
17TOPDIR := ../..
18include ../../Makefile.regression
19
20ORIG ?= .
21
22ifdef SRCDIR
23ORIGSRC := $(ABS_SRC)
24#$(warning yes SRC, $(ORIGSRC))
25else
26ORIGSRC := $(ORIG)
27#$(warning no SRC, $(ORIGSRC))
28endif
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:
44CPP = cpp
45
46# Flags for the C++ preprocessor (and makedepend as well):
47CPPFLAGS += -D$(PLATFORM)
48
49# Flags for the C++ compiler: (-Wall already in)
50CXXFLAGS += -g -W -Wformat=2
51
52# Flags for the linker:
a38c6d4c 53#LDFLAGS += -g -rdynamic
970ed795
EL
54WIN32_LIBS += -liconv
55FREEBSD_LIBS += -liconv
56
57# Local flags for Titan (can be overridden from the environment or commandline)
58TTCNFLAGS += -b -r -x
59
60# Flags for the TTCN-3 and ASN.1 compiler
61# (common flags already set in Makefile.regression)
62COMPILER_FLAGS += $(TTCNFLAGS)
63
64# $(sort ) also eliminates duplicates
65COMPILER_FLAGS := $(sort $(COMPILER_FLAGS))
66
67# Execution mode: (either ttcn3 or ttcn3-parallel)
68TTCN3_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:
75TTCN3_PP_MODULES := $(wildcard $(ORIGSRC)/../TTCNandXML/*.ttcnpp)
76
77# Files to include in TTCN-3 preprocessed modules:
78TTCN3_INCLUDES := $(TOP_SRC)/XML/macros.ttcnin
79
80# ASN.1 modules of this project:
81ASN1_MODULES :=
82
83# TTCN-3 source files generated by the C preprocessor:
84PREPROCESSED_TTCN3_MODULES := $(TTCN3_PP_MODULES:.ttcnpp=.ttcn)
85
86
87# TTCN-3 modules of this project:
88ALL_TTCN3_MODULES := $(wildcard $(ORIGSRC)/../TTCNandXML/*.ttcn)
89# Eliminate preprocessed modules
90TTCN3_MODULES := $(filter-out $(PREPROCESSED_TTCN3_MODULES), $(ALL_TTCN3_MODULES))
91TTCN3_MODULES += $(TOP_SRC)/iconv/converter.ttcn
92
93# C++ source & header files generated from the TTCN-3 & ASN.1 modules of
94# this project:
95GENERATED_SOURCES := $(notdir $(TTCN3_MODULES:.ttcn=.cc) $(PREPROCESSED_TTCN3_MODULES:.ttcn=.cc) $(ASN1_MODULES:.asn=.cc))
96GENERATED_HEADERS := $(GENERATED_SOURCES:.cc=.hh)
97ifdef CODE_SPLIT
98GENERATED_SOURCES := $(foreach file, $(GENERATED_SOURCES:.cc=), $(addprefix $(file), .cc _seq.cc _set.cc _seqof.cc _setof.cc _union.cc))
14e21cff 99else ifdef SPLIT_TO_SLICES
100POSTFIXES := $(foreach file, $(SPLIT_TO_SLICES), $(addsuffix $(file), _part_))
101POSTFIXES := $(foreach file, $(POSTFIXES), $(addprefix $(file), .cc))
102GENERATED_SOURCES2 := $(foreach file, $(GENERATED_SOURCES:.cc=), $(addprefix $(file), $(POSTFIXES)))
103GENERATED_SOURCES += $(GENERATED_SOURCES2)
970ed795
EL
104endif
105
106
107# C/C++ Source & header files of Test Ports, external functions and
108# other modules:
109USER_SOURCES := iconver.cc Flatten.cc
110USER_HEADERS := $(USER_SOURCES:.cc=.hh)
111
112# Object files of this project that are needed for the executable test suite:
113OBJECTS = $(GENERATED_SOURCES:.cc=.o) $(USER_SOURCES:.cc=.o)
114
115# The name of the executable test suite:
116TARGET = TTCNandXML$(RT2_SUFFIX)$(EXESUFFIX)
117
118
119#
120# Rules for building the executable...
121#
122
123all: $(TARGET) ;
124
125target: $(TARGET) ;
126
127objects: $(OBJECTS) ;
128
129ifeq ($(findstring dynamic,$(TTCN3_LIB)),)
130# not dynamic
131CORELIB_BINARY := $(TTCN3_DIR)/lib/lib$(TTCN3_LIB).a
132else
133CORELIB_BINARY := $(TTCN3_DIR)/lib/lib$(TTCN3_LIB).so
134endif
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
155preprocess: $(PREPROCESSED_TTCN3_MODULES) ;
156
157$(GENERATED_SOURCES) $(GENERATED_HEADERS): compile
158 @if [ ! -f $@ ]; then $(RM) compile; $(MAKE) compile; fi
159
160#
161############################################################################
162#
163
164compile: $(TTCN3_MODULES) $(PREPROCESSED_TTCN3_MODULES) $(ASN1_MODULES) $(firstword $(TTCN3_COMPILER))
165 $(TTCN3_COMPILER) $(COMPILER_FLAGS) $(filter-out $(TTCN3_COMPILER), $^)
166 touch $@
167
168clean:
169 -$(RM) $(TARGET) $(OBJECTS) $(GENERATED_HEADERS) \
170 $(GENERATED_SOURCES) $(PREPROCESSED_TTCN3_MODULES) compile \
171 tags *.log *.stackdump
172
173distclean: clean
174 -$(RM) $(DEPFILES)
175
176#
177# Add your rules here if necessary...
178#
179
180install:
181 @echo You cannot be serious!
182
183re:
184 rm -f compile
185
186RUN := $(shell which colortitan 2>/dev/null)
187ifeq ($(firstword $(RUN)),no)
188# stupid /bin/which on Solaris writes errors to stdout instead of stderr
189RUN :=
190endif
191
192run: $(TARGET) config.cfg
193 $(RUN) ./$^
194
195debug:
196 $(MAKE) run RUN='gdb --args'
197
198vpath %.cc $(TOP_SRC)/iconv
199
200
201dep: ;
202
203DEPFILES := $(OBJECTS:.o=.d)
204
205ifeq (,$(findstring n,$(MAKEFLAGS)))
206ifeq (,$(filter clean distclean,$(MAKECMDGOALS)))
207-include $(DEPFILES)
208endif
209endif
210
211ifdef SRCDIR
212$(foreach src, $(USER_SOURCES), $(eval vpath $(src) $(ABS_SRC)))
213endif
This page took 0.034251 seconds and 5 git commands to generate.