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
15 ##############################################################################
17 include ..
/..
/Makefile.regression
23 #$(warning yes SRC, $(ORIGSRC))
26 #$(warning no SRC, $(ORIGSRC))
29 # WARNING! This Makefile can be used with GNU make only.
30 # Other versions of make may report syntax errors in it.
33 # Do NOT touch this line...
35 .PHONY
: all check clean dep objects preprocess
39 # Set these variables...
42 # C preprocessor used for TTCN-3 files:
45 # Flags for the C++ preprocessor (and makedepend as well):
46 CPPFLAGS
+= -D
$(PLATFORM
)
48 # Flags for the C++ compiler: (-Wall already in)
49 CXXFLAGS
+= -g
-W
-Wformat
=2
51 # Flags for the linker:
52 #LDFLAGS += -g -rdynamic
54 FREEBSD_LIBS
+= -liconv
56 # Local flags for Titan (can be overridden from the environment or commandline)
59 # Flags for the TTCN-3 and ASN.1 compiler
60 # (common flags already set in Makefile.regression)
61 COMPILER_FLAGS
+= $(TTCNFLAGS
)
63 # $(sort ) also eliminates duplicates
64 COMPILER_FLAGS
:= $(sort $(COMPILER_FLAGS
))
66 # Execution mode: (either ttcn3 or ttcn3-parallel)
67 TTCN3_LIB
:= ttcn3
$(RT2_SUFFIX
)$(DYNAMIC_SUFFIX
)
70 # You may change these variables. Add your files if necessary...
73 # TTCN-3 modules to preprocess:
74 TTCN3_PP_MODULES
:= $(wildcard $(ORIGSRC
)/..
/TTCNandXML
/*.ttcnpp
)
76 # Files to include in TTCN-3 preprocessed modules:
77 TTCN3_INCLUDES
:= $(TOP_SRC
)/XML
/macros.ttcnin
79 # ASN.1 modules of this project:
82 # TTCN-3 source files generated by the C preprocessor:
83 PREPROCESSED_TTCN3_MODULES
:= $(TTCN3_PP_MODULES
:.ttcnpp
=.ttcn
)
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
92 # C++ source & header files generated from the TTCN-3 & ASN.1 modules of
94 GENERATED_SOURCES
:= $(notdir $(TTCN3_MODULES
:.ttcn
=.
cc) $(PREPROCESSED_TTCN3_MODULES
:.ttcn
=.
cc) $(ASN1_MODULES
:.asn
=.
cc))
95 GENERATED_HEADERS
:= $(GENERATED_SOURCES
:.
cc=.hh
)
97 GENERATED_SOURCES
:= $(foreach file
, $(GENERATED_SOURCES
:.
cc=), $(addprefix $(file
), .
cc _seq.
cc _set.
cc _seqof.
cc _setof.
cc _union.
cc))
101 # C/C++ Source & header files of Test Ports, external functions and
103 USER_SOURCES
:= iconver.
cc Flatten.
cc
104 USER_HEADERS
:= $(USER_SOURCES
:.
cc=.hh
)
106 # Object files of this project that are needed for the executable test suite:
107 OBJECTS
= $(GENERATED_SOURCES
:.
cc=.o
) $(USER_SOURCES
:.
cc=.o
)
109 # The name of the executable test suite:
110 TARGET
= TTCNandXML
$(RT2_SUFFIX
)$(EXESUFFIX
)
114 # Rules for building the executable...
121 objects
: $(OBJECTS
) ;
123 ifeq ($(findstring dynamic
,$(TTCN3_LIB
)),)
125 CORELIB_BINARY
:= $(TTCN3_DIR
)/lib
/lib
$(TTCN3_LIB
).a
127 CORELIB_BINARY
:= $(TTCN3_DIR
)/lib
/lib
$(TTCN3_LIB
).so
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
)
138 @echo
'(C++)' $<; $(CXX
) -c
$(CPPFLAGS
) $(CXXFLAGS
) -o
$@
$<
141 @echo Creating dependency file for
'$<'; set
-e
; \
142 $(CXX
) -MM
$(CPPFLAGS
) $(CXXFLAGS
) $< \
143 | sed
's/\($*\)\.o[ :]*/\1.o $@ : /g' > $@
; \
144 [ -s
$@
] ||
rm -f
$@
146 %.ttcn
: %.ttcnpp
$(TTCN3_INCLUDES
)
147 $(CPP
) -x c
-nostdinc
$(CPPFLAGS_TTCN3
) $< $@
149 preprocess
: $(PREPROCESSED_TTCN3_MODULES
) ;
151 $(GENERATED_SOURCES
) $(GENERATED_HEADERS
): compile
152 @if
[ ! -f
$@
]; then
$(RM
) compile
; $(MAKE
) compile
; fi
155 ############################################################################
158 compile
: $(TTCN3_MODULES
) $(PREPROCESSED_TTCN3_MODULES
) $(ASN1_MODULES
) $(firstword $(TTCN3_COMPILER
))
159 $(TTCN3_COMPILER
) $(COMPILER_FLAGS
) $(filter-out $(TTCN3_COMPILER
), $^
)
163 -$(RM
) $(TARGET
) $(OBJECTS
) $(GENERATED_HEADERS
) \
164 $(GENERATED_SOURCES
) $(PREPROCESSED_TTCN3_MODULES
) compile \
165 tags *.log
*.stackdump
171 # Add your rules here if necessary...
175 @echo You cannot be serious
!
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
186 run
: $(TARGET
) config.cfg
190 $(MAKE
) run RUN
='gdb --args'
192 vpath
%.
cc $(TOP_SRC
)/iconv
197 DEPFILES
:= $(OBJECTS
:.o
=.d
)
199 ifeq (,$(findstring n
,$(MAKEFLAGS
)))
200 ifeq (,$(filter clean distclean,$(MAKECMDGOALS
)))
206 $(foreach src
, $(USER_SOURCES
), $(eval vpath
$(src
) $(ABS_SRC
)))