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 ###############################################################################
8 # Makefile for the integrated (TTCN-3 and ASN.1) compiler
9 # and the makefile generator
12 include $(TOP
)/Makefile.cfg
14 ifeq ($(USAGE_STATS
), yes
)
15 SOLARIS_LIBS
:= -lresolv
-lsocket
-lnsl
16 SOLARIS8_LIBS
:= -lresolv
-lsocket
-lnsl
17 LINUX_LIBS
:= -lpthread
-lrt
20 ifeq ($(findstring g
++, $(CXX
)), g
++)
21 CXXFLAGS
+= -fno-exceptions
25 CPPFLAGS
+= -I
$(REGEX_DIR
)/include
29 ifneq ($(OPENSSL_DIR
), default
)
30 CPPFLAGS
+= -I
$(OPENSSL_DIR
)/include
31 LDFLAGS
+= -L
$(OPENSSL_DIR
)/lib
36 ifeq ($(XMLDIR
), default
)
38 # do not add -L/usr/lib to LDFLAGS, it's redundant
40 LDFLAGS
+= -L
$(XMLDIR
)/lib
43 CPPFLAGS
+= -I
$(XMLDIR
)/include/libxml2
50 # Too many "comparison between signed and unsigned"
51 CCFLAGS
+= -Wno-sign-compare
54 TARGETS
:= compiler
$(EXESUFFIX
) ttcn3_makefilegen
$(EXESUFFIX
) tcov2lcov
$(EXESUFFIX
)
55 MANPAGES
:= compiler
.1 ttcn3_makefilegen
.1
57 TARGETS
:= compiler
$(EXESUFFIX
)
58 MANPAGES
:= compiler
.1
59 MAYBE_PDFS
:= $(MANPAGES
:.1=.pdf
)
62 PDFS
:= $(MANPAGES
:.1=.pdf
)
64 COMPILER_SOURCES
:= encdec.c enum.c functionref.c record.c record_of.c union.c \
65 PredefFunc.
cc AST.
cc Code.
cc Constraint.
cc CompilerError.
cc \
66 CompField.
cc CompType.
cc EnumItem.
cc Identifier.
cc Int.
cc \
67 main.
cc Real.
cc Setting.
cc SigParam.
cc string.
cc subtype.
cc Stopwatch.
cc \
68 Type.
cc Type_chk.
cc Type_codegen.
cc TypeCompat.
cc \
69 Typestuff.
cc ustring.
cc Value.
cc Valuestuff.
cc XerAttributes.
cc subtypestuff.
cc CodeGenHelper.
cc
71 MFGEN_SOURCES
:= makefile.c xpather.
cc
73 TCOV2LCOV_SOURCES
:= tcov2lcov.
cc
75 SOURCES
:= $(COMPILER_SOURCES
) $(MFGEN_SOURCES
) $(TCOV2LCOV_SOURCES
)
77 # All sources are static in this directory
78 STATIC_SOURCES
:= $(SOURCES
)
80 COMPILER_OBJECTS
:= $(patsubst %.
cc,%.o
,$(patsubst %.c
,%.o
,$(COMPILER_SOURCES
)))
82 MFGEN_OBJECTS
:= $(patsubst %.
cc,%.o
,$(patsubst %.c
,%.o
,$(MFGEN_SOURCES
)))
84 TCOV2LCOV_OBJECTS
:= $(patsubst %.
cc,%.o
,$(patsubst %.c
,%.o
,$(TCOV2LCOV_SOURCES
)))
86 OBJECTS
:= $(COMPILER_OBJECTS
) $(MFGEN_OBJECTS
) $(TCOV2LCOV_OBJECTS
)
88 # Used by both the compiler and makefilegen
89 COMMON_OBJECTS
:= $(addprefix ..
/common
/, memory.o path.o userinfo.o JSON_Tokenizer.o
)
91 TCOV2LCOV_COMMON_OBJECTS
:= ..
/common
/memory.o
93 ifeq ($(LICENSING
), yes
)
94 COMMON_OBJECTS
+= ..
/common
/license.o
95 TCOV2LCOV_COMMON_OBJECTS
+= ..
/common
/license.o
99 COMMON_OBJECTS
+= $(REGEX_DIR
)/lib
/regex.o
102 COMPILER_COMMON_OBJECTS
:= $(COMMON_OBJECTS
) \
103 $(addprefix ..
/common
/, new.o pattern_la.o pattern_p.o pattern_uni.o Quadruple.o ModuleVersion.o
)
105 ifeq ($(USAGE_STATS
), yes
)
106 COMPILER_COMMON_OBJECTS
+= ..
/common
/usage_stats.o
109 MFGEN_COMMON_OBJECTS
:= $(COMMON_OBJECTS
) ..
/common
/new.o
111 DEPFILES
:= $(patsubst %.
cc,%.d
,$(patsubst %.c
,%.d
,$(COMPILER_SOURCES
) \
114 SUBDIRS
:= asn1 ttcn3
116 .PHONY
: asn1_dir ttcn3_dir
120 asn1
/libasn1_compiler.a
: asn1_dir
;
122 ttcn3
/libttcn3_compiler.a
: ttcn3_dir
;
132 install: $(TARGETS
) $(MAYBE_PDFS
)
137 cp
$(TARGETS
) $(BINDIR
)
142 cp tcov.xsd tcov.xsl
$(INCDIR
)
143 cp titanver
$(BINDIR
)
144 chmod a
+x
$(BINDIR
)/titanver
145 $(RM
) $(BINDIR
)/ttcn3_compiler
$(EXESUFFIX
) \
146 $(BINDIR
)/asn1_compiler
$(EXESUFFIX
) $(BINDIR
)/makefilegen
$(EXESUFFIX
)
147 ln
-s compiler
$(EXESUFFIX
) $(BINDIR
)/ttcn3_compiler
$(EXESUFFIX
)
148 ln
-s compiler
$(EXESUFFIX
) $(BINDIR
)/asn1_compiler
$(EXESUFFIX
)
149 ln
-s ttcn3_makefilegen
$(EXESUFFIX
) $(BINDIR
)/makefilegen
$(EXESUFFIX
)
150 mkdir
-p
$(MANDIR
)/man1
151 cp
$(MANPAGES
) $(MANDIR
)/man1
152 $(RM
) $(MANDIR
)/man1
/ttcn3_compiler
.1 $(MANDIR
)/man1
/asn1_compiler
.1 \
153 $(MANDIR
)/man1
/makefilegen
.1
154 ln
-s compiler
.1 $(MANDIR
)/man1
/ttcn3_compiler
.1
155 ln
-s compiler
.1 $(MANDIR
)/man1
/asn1_compiler
.1
156 ln
-s ttcn3_makefilegen
.1 $(MANDIR
)/man1
/makefilegen
.1
159 # The compiler always links to OpenSSL (even without LICENSING)
160 # because it uses bignums.
161 compiler
$(EXESUFFIX
): asn1
/libasn1_compiler.a ttcn3
/libttcn3_compiler.a \
162 $(COMPILER_OBJECTS
) $(COMPILER_COMMON_OBJECTS
)
163 $(CXX
) $(LDFLAGS
) -o
$@
$(COMPILER_OBJECTS
) $(COMPILER_COMMON_OBJECTS
) \
164 asn1
/libasn1_compiler.a ttcn3
/libttcn3_compiler.a \
165 -lcrypto
$(RSLICLIB
) $(MINGW_LIBS
) $($(PLATFORM
)_LIBS
)
167 ttcn3_makefilegen
$(EXESUFFIX
): $(MFGEN_OBJECTS
) $(MFGEN_COMMON_OBJECTS
) \
168 ttcn3
/ttcn3_preparser.
lex.o asn1
/asn1_preparser.
lex.o
169 $(CXX
) $(LDFLAGS
) -o
$@
$^
-lxml2
$(LICENSE_LIBS
) $(MINGW_LIBS
)
171 tcov2lcov
$(EXESUFFIX
): $(TCOV2LCOV_OBJECTS
) $(TCOV2LCOV_COMMON_OBJECTS
)
172 $(CXX
) $(LDFLAGS
) -o
$@
$^
-lxml2
$(LICENSE_LIBS
) $(MINGW_LIBS
)
174 include ..
/Makefile.genrules
176 # Target-specific variable alteration
177 # Target-specific += causes make 3.79.1 to crash, hence this old style
178 makefile.o
: CPPFLAGS
:= $(CPPFLAGS
) -DCXX
='"$(CXX)"'
180 # Pre-seed dependencies. Value.cc and Valuestuff.cc include asn1/asn1p.tab.hh
181 # However, if asn1/asn1p.y is modified, these files are not rebuilt because
182 # the Value.d contains a dependency on asn1/asn1p.tab.hh, which is not yet
185 # 1. asn1/asn1p.y is modified
186 # 2. "make" checks dependencies of Value.o; decides nothing to do
187 # 3. "make -C asn1" rebuilds asn1p.y, updating asn1p.tab.hh
188 # 4. Value.o is now out of date
189 # 5. "make" issued a second time decides that Value.o is out of date
190 Value.d Value.o
: asn1
/asn1p.tab.hh
191 Valuestuff.d Valuestuff.o
: asn1
/asn1p.tab.hh
192 Constraint.d Constraint.o
: asn1
/asn1p.tab.hh