1 ###############################################################################
2 # Copyright (c) 2000-2014 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 ###############################################################################
9 include ..
/..
/Makefile.regression
15 #$(warning yes SRC, $(ORIGSRC))
18 #$(warning no SRC, $(ORIGSRC))
21 # WARNING! This Makefile can be used with GNU make only.
22 # Other versions of make may report syntax errors in it.
25 # Do NOT touch this line...
27 .PHONY
: all check clean dep objects preprocess
31 # Set these variables...
34 # C preprocessor used for TTCN-3 files:
37 # Flags for the C++ preprocessor (and makedepend as well):
38 CPPFLAGS
+= -D
$(PLATFORM
)
40 # Flags for the C++ compiler: (-Wall already in)
41 CXXFLAGS
+= -g
-W
-Wformat
=2
43 # Flags for the linker:
44 LDFLAGS
+= -g
-rdynamic
46 FREEBSD_LIBS
+= -liconv
48 # Local flags for Titan (can be overridden from the environment or commandline)
51 # Flags for the TTCN-3 and ASN.1 compiler
52 # (common flags already set in Makefile.regression)
53 COMPILER_FLAGS
+= $(TTCNFLAGS
)
55 # $(sort ) also eliminates duplicates
56 COMPILER_FLAGS
:= $(sort $(COMPILER_FLAGS
))
58 # Execution mode: (either ttcn3 or ttcn3-parallel)
59 TTCN3_LIB
:= ttcn3
$(RT2_SUFFIX
)$(DYNAMIC_SUFFIX
)
62 # You may change these variables. Add your files if necessary...
65 # TTCN-3 modules to preprocess:
66 TTCN3_PP_MODULES
:= $(wildcard $(ORIGSRC
)/..
/TTCNandXML
/*.ttcnpp
)
68 # Files to include in TTCN-3 preprocessed modules:
69 TTCN3_INCLUDES
:= $(TOP_SRC
)/XML
/macros.ttcnin
71 # ASN.1 modules of this project:
74 # TTCN-3 source files generated by the C preprocessor:
75 PREPROCESSED_TTCN3_MODULES
:= $(TTCN3_PP_MODULES
:.ttcnpp
=.ttcn
)
78 # TTCN-3 modules of this project:
79 ALL_TTCN3_MODULES
:= $(wildcard $(ORIGSRC
)/..
/TTCNandXML
/*.ttcn
)
80 # Eliminate preprocessed modules
81 TTCN3_MODULES
:= $(filter-out $(PREPROCESSED_TTCN3_MODULES
), $(ALL_TTCN3_MODULES
))
82 TTCN3_MODULES
+= $(TOP_SRC
)/iconv
/converter.ttcn
84 # C++ source & header files generated from the TTCN-3 & ASN.1 modules of
86 GENERATED_SOURCES
:= $(notdir $(TTCN3_MODULES
:.ttcn
=.
cc) $(PREPROCESSED_TTCN3_MODULES
:.ttcn
=.
cc) $(ASN1_MODULES
:.asn
=.
cc))
87 GENERATED_HEADERS
:= $(GENERATED_SOURCES
:.
cc=.hh
)
89 GENERATED_SOURCES
:= $(foreach file
, $(GENERATED_SOURCES
:.
cc=), $(addprefix $(file
), .
cc _seq.
cc _set.
cc _seqof.
cc _setof.
cc _union.
cc))
93 # C/C++ Source & header files of Test Ports, external functions and
95 USER_SOURCES
:= iconver.
cc Flatten.
cc
96 USER_HEADERS
:= $(USER_SOURCES
:.
cc=.hh
)
98 # Object files of this project that are needed for the executable test suite:
99 OBJECTS
= $(GENERATED_SOURCES
:.
cc=.o
) $(USER_SOURCES
:.
cc=.o
)
101 # The name of the executable test suite:
102 TARGET
= TTCNandXML
$(RT2_SUFFIX
)$(EXESUFFIX
)
106 # Rules for building the executable...
113 objects
: $(OBJECTS
) ;
115 ifeq ($(findstring dynamic
,$(TTCN3_LIB
)),)
117 CORELIB_BINARY
:= $(TTCN3_DIR
)/lib
/lib
$(TTCN3_LIB
).a
119 CORELIB_BINARY
:= $(TTCN3_DIR
)/lib
/lib
$(TTCN3_LIB
).so
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
)
130 @echo
'(C++)' $<; $(CXX
) -c
$(CPPFLAGS
) $(CXXFLAGS
) -o
$@
$<
133 @echo Creating dependency file for
'$<'; set
-e
; \
134 $(CXX
) -MM
$(CPPFLAGS
) $(CXXFLAGS
) $< \
135 | sed
's/\($*\)\.o[ :]*/\1.o $@ : /g' > $@
; \
136 [ -s
$@
] ||
rm -f
$@
138 %.ttcn
: %.ttcnpp
$(TTCN3_INCLUDES
)
139 $(CPP
) -x c
-nostdinc
$(CPPFLAGS_TTCN3
) $< $@
141 preprocess
: $(PREPROCESSED_TTCN3_MODULES
) ;
143 $(GENERATED_SOURCES
) $(GENERATED_HEADERS
): compile
144 @if
[ ! -f
$@
]; then
$(RM
) compile
; $(MAKE
) compile
; fi
147 ############################################################################
150 compile
: $(TTCN3_MODULES
) $(PREPROCESSED_TTCN3_MODULES
) $(ASN1_MODULES
) $(firstword $(TTCN3_COMPILER
))
151 $(TTCN3_COMPILER
) $(COMPILER_FLAGS
) $(filter-out $(TTCN3_COMPILER
), $^
)
155 -$(RM
) $(TARGET
) $(OBJECTS
) $(GENERATED_HEADERS
) \
156 $(GENERATED_SOURCES
) $(PREPROCESSED_TTCN3_MODULES
) compile \
157 tags *.log
*.stackdump
163 # Add your rules here if necessary...
167 @echo You cannot be serious
!
172 RUN
:= $(shell which colortitan
2>/dev
/null
)
173 ifeq ($(firstword $(RUN
)),no
)
174 # stupid /bin/which on Solaris writes errors to stdout instead of stderr
178 run
: $(TARGET
) config.cfg
182 $(MAKE
) run RUN
='gdb --args'
184 vpath
%.
cc $(TOP_SRC
)/iconv
189 DEPFILES
:= $(OBJECTS
:.o
=.d
)
191 ifeq (,$(findstring n
,$(MAKEFLAGS
)))
192 ifeq (,$(filter clean distclean,$(MAKECMDGOALS
)))
198 $(foreach src
, $(USER_SOURCES
), $(eval vpath
$(src
) $(ABS_SRC
)))