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
22 # Szabo, Janos Zoltan – initial implementation
25 # Zalanyi, Balazs Andor
27 ##############################################################################
28 # Makefile for the integrated (TTCN-3 and ASN.1) compiler
29 # and the makefile generator
32 include $(TOP
)/Makefile.cfg
34 ifeq ($(USAGE_STATS
), yes
)
35 SOLARIS_LIBS
:= -lresolv
-lsocket
-lnsl
36 SOLARIS8_LIBS
:= -lresolv
-lsocket
-lnsl
37 LINUX_LIBS
:= -lpthread
-lrt
40 ifeq ($(findstring g
++, $(CXX
)), g
++)
41 CXXFLAGS
+= -fno-exceptions
45 CPPFLAGS
+= -I
$(REGEX_DIR
)/include
49 ifneq ($(OPENSSL_DIR
), default
)
50 CPPFLAGS
+= -I
$(OPENSSL_DIR
)/include
51 LDFLAGS
+= -L
$(OPENSSL_DIR
)/lib
56 ifeq ($(XMLDIR
), default
)
58 # do not add -L/usr/lib to LDFLAGS, it's redundant
60 LDFLAGS
+= -L
$(XMLDIR
)/lib
63 CPPFLAGS
+= -I
$(XMLDIR
)/include/libxml2
70 # Too many "comparison between signed and unsigned"
71 CCFLAGS
+= -Wno-sign-compare
74 TARGETS
:= compiler
$(EXESUFFIX
) ttcn3_makefilegen
$(EXESUFFIX
) tcov2lcov
$(EXESUFFIX
)
75 MANPAGES
:= compiler
.1 ttcn3_makefilegen
.1
77 TARGETS
:= compiler
$(EXESUFFIX
)
78 MANPAGES
:= compiler
.1
79 MAYBE_PDFS
:= $(MANPAGES
:.1=.pdf
)
82 PDFS
:= $(MANPAGES
:.1=.pdf
)
84 COMPILER_SOURCES
:= encdec.c enum.c functionref.c record.c record_of.c union.c \
85 PredefFunc.
cc AST.
cc Code.
cc Constraint.
cc CompilerError.
cc \
86 CompField.
cc CompType.
cc EnumItem.
cc Identifier.
cc Int.
cc \
87 main.
cc Real.
cc Setting.
cc SigParam.
cc string.
cc subtype.
cc Stopwatch.
cc \
88 Type.
cc Type_chk.
cc Type_codegen.
cc TypeCompat.
cc \
89 Typestuff.
cc ustring.
cc Value.
cc Valuestuff.
cc XerAttributes.
cc subtypestuff.
cc \
90 CodeGenHelper.
cc DebuggerStuff.
cc
92 MFGEN_SOURCES
:= makefile.c xpather.
cc ProjectGenHelper.
cc
94 TCOV2LCOV_SOURCES
:= tcov2lcov.
cc
96 SOURCES
:= $(COMPILER_SOURCES
) $(MFGEN_SOURCES
) $(TCOV2LCOV_SOURCES
)
98 # All sources are static in this directory
99 STATIC_SOURCES
:= $(SOURCES
)
101 COMPILER_OBJECTS
:= $(patsubst %.
cc,%.o
,$(patsubst %.c
,%.o
,$(COMPILER_SOURCES
)))
103 MFGEN_OBJECTS
:= $(patsubst %.
cc,%.o
,$(patsubst %.c
,%.o
,$(MFGEN_SOURCES
)))
105 TCOV2LCOV_OBJECTS
:= $(patsubst %.
cc,%.o
,$(patsubst %.c
,%.o
,$(TCOV2LCOV_SOURCES
)))
107 OBJECTS
:= $(COMPILER_OBJECTS
) $(MFGEN_OBJECTS
) $(TCOV2LCOV_OBJECTS
)
109 # Used by both the compiler and makefilegen
110 COMMON_OBJECTS
:= $(addprefix ..
/common
/, memory.o path.o userinfo.o JSON_Tokenizer.o
)
112 TCOV2LCOV_COMMON_OBJECTS
:= ..
/common
/memory.o
114 ifeq ($(LICENSING
), yes
)
115 COMMON_OBJECTS
+= ..
/common
/license.o
116 TCOV2LCOV_COMMON_OBJECTS
+= ..
/common
/license.o
120 COMMON_OBJECTS
+= $(REGEX_DIR
)/lib
/regex.o
123 COMPILER_COMMON_OBJECTS
:= $(COMMON_OBJECTS
) \
124 $(addprefix ..
/common
/, new.o pattern_la.o pattern_p.o pattern_uni.o Quadruple.o ModuleVersion.o
)
126 ifeq ($(USAGE_STATS
), yes
)
127 COMPILER_COMMON_OBJECTS
+= ..
/common
/usage_stats.o
130 MFGEN_COMMON_OBJECTS
:= $(COMMON_OBJECTS
) ..
/common
/new.o
132 DEPFILES
:= $(patsubst %.
cc,%.d
,$(patsubst %.c
,%.d
,$(COMPILER_SOURCES
) \
135 SUBDIRS
:= asn1 ttcn3
137 .PHONY
: asn1_dir ttcn3_dir
141 asn1
/libasn1_compiler.a
: asn1_dir
;
143 ttcn3
/libttcn3_compiler.a
: ttcn3_dir
;
153 install: $(TARGETS
) $(MAYBE_PDFS
)
158 cp
$(TARGETS
) $(BINDIR
)
163 cp tcov.xsd tcov.xsl
$(INCDIR
)
164 cp titanver
$(BINDIR
)
165 chmod a
+x
$(BINDIR
)/titanver
166 $(RM
) $(BINDIR
)/ttcn3_compiler
$(EXESUFFIX
) \
167 $(BINDIR
)/asn1_compiler
$(EXESUFFIX
) $(BINDIR
)/makefilegen
$(EXESUFFIX
)
168 ln
-s compiler
$(EXESUFFIX
) $(BINDIR
)/ttcn3_compiler
$(EXESUFFIX
)
169 ln
-s compiler
$(EXESUFFIX
) $(BINDIR
)/asn1_compiler
$(EXESUFFIX
)
170 ln
-s ttcn3_makefilegen
$(EXESUFFIX
) $(BINDIR
)/makefilegen
$(EXESUFFIX
)
171 mkdir
-p
$(MANDIR
)/man1
172 cp
$(MANPAGES
) $(MANDIR
)/man1
173 $(RM
) $(MANDIR
)/man1
/ttcn3_compiler
.1 $(MANDIR
)/man1
/asn1_compiler
.1 \
174 $(MANDIR
)/man1
/makefilegen
.1
175 ln
-s compiler
.1 $(MANDIR
)/man1
/ttcn3_compiler
.1
176 ln
-s compiler
.1 $(MANDIR
)/man1
/asn1_compiler
.1
177 ln
-s ttcn3_makefilegen
.1 $(MANDIR
)/man1
/makefilegen
.1
180 # The compiler always links to OpenSSL (even without LICENSING)
181 # because it uses bignums.
182 compiler
$(EXESUFFIX
): asn1
/libasn1_compiler.a ttcn3
/libttcn3_compiler.a \
183 $(COMPILER_OBJECTS
) $(COMPILER_COMMON_OBJECTS
)
184 $(CXX
) $(LDFLAGS
) -o
$@
$(COMPILER_OBJECTS
) $(COMPILER_COMMON_OBJECTS
) \
185 asn1
/libasn1_compiler.a ttcn3
/libttcn3_compiler.a \
186 -lcrypto
$(RSLICLIB
) $(MINGW_LIBS
) $($(PLATFORM
)_LIBS
)
188 ttcn3_makefilegen
$(EXESUFFIX
): $(MFGEN_OBJECTS
) $(MFGEN_COMMON_OBJECTS
) \
189 ttcn3
/ttcn3_preparser.
lex.o asn1
/asn1_preparser.
lex.o
190 $(CXX
) $(LDFLAGS
) -o
$@
$^
-lxml2
$(LICENSE_LIBS
) $(MINGW_LIBS
)
192 tcov2lcov
$(EXESUFFIX
): $(TCOV2LCOV_OBJECTS
) $(TCOV2LCOV_COMMON_OBJECTS
)
193 $(CXX
) $(LDFLAGS
) -o
$@
$^
-lxml2
$(LICENSE_LIBS
) $(MINGW_LIBS
)
195 include ..
/Makefile.genrules
197 # Target-specific variable alteration
198 # Target-specific += causes make 3.79.1 to crash, hence this old style
199 makefile.o
: CPPFLAGS
:= $(CPPFLAGS
) -DCXX
='"$(CXX)"'
201 # Pre-seed dependencies. Value.cc and Valuestuff.cc include asn1/asn1p.tab.hh
202 # However, if asn1/asn1p.y is modified, these files are not rebuilt because
203 # the Value.d contains a dependency on asn1/asn1p.tab.hh, which is not yet
206 # 1. asn1/asn1p.y is modified
207 # 2. "make" checks dependencies of Value.o; decides nothing to do
208 # 3. "make -C asn1" rebuilds asn1p.y, updating asn1p.tab.hh
209 # 4. Value.o is now out of date
210 # 5. "make" issued a second time decides that Value.o is out of date
211 Value.d Value.o
: asn1
/asn1p.tab.hh
212 Valuestuff.d Valuestuff.o
: asn1
/asn1p.tab.hh
213 Constraint.d Constraint.o
: asn1
/asn1p.tab.hh