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