Debian Codegraph @

compiler2/Makefile

raw symbols SCIP
1 ##############################################################################
2 # Copyright (c) 2000-2021 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 v2.0
5 # which accompanies this distribution, and is available at
6 # https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.html
7 #
8 # Contributors:
9 #
10 # Baji, Laszlo
11 # Balasko, Jeno
12 # Baranyi, Botond
13 # Cserveni, Akos
14 # Delic, Adam
15 # Feher, Csaba
16 # Forstner, Matyas
17 # Kovacs, Ferenc
18 # Kremer, Peter
19 # Ormandi, Matyas
20 # Raduly, Csaba
21 # Szabados, Kristof
22 # Szabo, Janos Zoltan – initial implementation
23 # Szalai, Gabor
24 # Tatarka, Gabor
25 # Zalanyi, Balazs Andor
26 #
27 ##############################################################################
28 # Makefile for the integrated (TTCN-3 and ASN.1) compiler
29 # and the makefile generator
30
31 TOP := ..
32 include $(TOP)/Makefile.cfg
33
34 ifeq ($(USAGE_STATS), yes)
35 SOLARIS_LIBS := -lresolv -lsocket -lnsl
36 SOLARIS8_LIBS := -lresolv -lsocket -lnsl
37 LINUX_LIBS := -lpthread -lrt
38 endif
39
40 ifeq ($(findstring g++, $(CXX)), g++)
41 CXXFLAGS += -fno-exceptions
42 endif
43
44 ifdef REGEX_DIR
45 CPPFLAGS += -I$(REGEX_DIR)/include
46 endif
47
48 ifdef OPENSSL_DIR
49 ifneq ($(OPENSSL_DIR), default)
50 CPPFLAGS += -I$(OPENSSL_DIR)/include
51 LDFLAGS += -L$(OPENSSL_DIR)/lib
52 endif
53 endif
54
55 ifdef XMLDIR
56 ifeq ($(XMLDIR), default)
57 XMLDIR := /usr
58 # do not add -L/usr/lib to LDFLAGS, it's redundant
59 else
60 LDFLAGS += -L$(XMLDIR)/lib
61 endif
62
63 CPPFLAGS += -I$(XMLDIR)/include/libxml2
64 endif
65
66 ifdef SRCDIR
67 CPPFLAGS += -Iasn1
68 endif
69
70 # Too many "comparison between signed and unsigned"
71 CCFLAGS += -Wno-sign-compare
72
73 ifndef MINGW
74 TARGETS := compiler$(EXESUFFIX) ttcn3_makefilegen$(EXESUFFIX) tcov2lcov$(EXESUFFIX)
75 MANPAGES := compiler.1 ttcn3_makefilegen.1
76 else
77 TARGETS := compiler$(EXESUFFIX)
78 MANPAGES := compiler.1
79 MAYBE_PDFS := $(MANPAGES:.1=.pdf)
80 endif
81
82 PDFS := $(MANPAGES:.1=.pdf)
83
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 XSD_Types.cc
91
92 MFGEN_SOURCES := makefile.c xpather.cc ProjectGenHelper.cc
93
94 TCOV2LCOV_SOURCES := tcov2lcov.cc
95
96 SOURCES := $(COMPILER_SOURCES) $(MFGEN_SOURCES) $(TCOV2LCOV_SOURCES)
97
98 # All sources are static in this directory
99 STATIC_SOURCES := $(SOURCES)
100
101 COMPILER_OBJECTS := $(patsubst %.cc,%.o,$(patsubst %.c,%.o,$(COMPILER_SOURCES)))
102
103 MFGEN_OBJECTS := $(patsubst %.cc,%.o,$(patsubst %.c,%.o,$(MFGEN_SOURCES)))
104
105 TCOV2LCOV_OBJECTS := $(patsubst %.cc,%.o,$(patsubst %.c,%.o,$(TCOV2LCOV_SOURCES)))
106
107 OBJECTS := $(COMPILER_OBJECTS) $(MFGEN_OBJECTS) $(TCOV2LCOV_OBJECTS)
108
109 # Used by both the compiler and makefilegen
110 COMMON_OBJECTS := $(addprefix ../common/, memory.o path.o userinfo.o)
111
112 TCOV2LCOV_COMMON_OBJECTS := ../common/memory.o
113
114 ifeq ($(LICENSING), yes)
115 COMMON_OBJECTS += ../common/license.o
116 TCOV2LCOV_COMMON_OBJECTS += ../common/license.o
117 endif
118
119 ifdef REGEX_DIR
120 COMMON_OBJECTS += $(REGEX_DIR)/lib/regex.o
121 endif
122
123 COMPILER_COMMON_OBJECTS := $(COMMON_OBJECTS) \
124 $(addprefix ../common/, git_version.o new.o pattern_la.o pattern_p.o pattern_uni.o Quadruple.o \
125 ModuleVersion.o JSON_Tokenizer.o UnicharPattern.o openssl_version.o)
126
127 ifeq ($(USAGE_STATS), yes)
128 COMPILER_COMMON_OBJECTS += ../common/usage_stats.o
129 endif
130
131 MFGEN_COMMON_OBJECTS := $(COMMON_OBJECTS) ../common/new.o
132
133 DEPFILES := $(patsubst %.cc,%.d,$(patsubst %.c,%.d,$(COMPILER_SOURCES) \
134 $(MFGEN_SOURCES)))
135
136 SUBDIRS := asn1 ttcn3
137
138 .PHONY: asn1_dir ttcn3_dir
139
140 all run: $(TARGETS)
141
142 asn1/libasn1_compiler.a: asn1_dir ;
143
144 ttcn3/libttcn3_compiler.a: ttcn3_dir ;
145
146 asn1_dir:
147 $(MAKE) -C asn1
148
149 ttcn3_dir:
150 $(MAKE) -C ttcn3
151
152 pdf: $(PDFS)
153
154 install: $(TARGETS) $(MAYBE_PDFS)
155 ifeq ($(DEBUG), no)
156 $(STRIP) $(TARGETS)
157 endif
158 mkdir -p $(BINDIR)
159 cp $(TARGETS) $(BINDIR)
160 ifdef MINGW
161 mkdir -p $(MANDIR)
162 cp $(PDFS) $(MANDIR)
163 else
164 cp tcov.xsd tcov.xsl $(INCDIR)
165 cp titanver $(BINDIR)
166 chmod a+x $(BINDIR)/titanver
167 $(RM) $(BINDIR)/ttcn3_compiler$(EXESUFFIX) \
168 $(BINDIR)/asn1_compiler$(EXESUFFIX) $(BINDIR)/makefilegen$(EXESUFFIX)
169 ln -s compiler$(EXESUFFIX) $(BINDIR)/ttcn3_compiler$(EXESUFFIX)
170 ln -s compiler$(EXESUFFIX) $(BINDIR)/asn1_compiler$(EXESUFFIX)
171 ln -s ttcn3_makefilegen$(EXESUFFIX) $(BINDIR)/makefilegen$(EXESUFFIX)
172 mkdir -p $(MANDIR)/man1
173 cp $(MANPAGES) $(MANDIR)/man1
174 $(RM) $(MANDIR)/man1/ttcn3_compiler.1 $(MANDIR)/man1/asn1_compiler.1 \
175 $(MANDIR)/man1/makefilegen.1
176 ln -s compiler.1 $(MANDIR)/man1/ttcn3_compiler.1
177 ln -s compiler.1 $(MANDIR)/man1/asn1_compiler.1
178 ln -s ttcn3_makefilegen.1 $(MANDIR)/man1/makefilegen.1
179 endif
180
181 # The compiler always links to OpenSSL (even without LICENSING)
182 # because it uses bignums.
183 compiler$(EXESUFFIX): asn1/libasn1_compiler.a ttcn3/libttcn3_compiler.a \
184 $(COMPILER_OBJECTS) $(COMPILER_COMMON_OBJECTS)
185 $(CXX) $(LDFLAGS) -o $@ $(COMPILER_OBJECTS) $(COMPILER_COMMON_OBJECTS) \
186 asn1/libasn1_compiler.a ttcn3/libttcn3_compiler.a \
187 -lcrypto $(RSLICLIB) $(MINGW_LIBS) $($(PLATFORM)_LIBS)
188
189 ttcn3_makefilegen$(EXESUFFIX): $(MFGEN_OBJECTS) $(MFGEN_COMMON_OBJECTS) \
190 ttcn3/ttcn3_preparser.lex.o asn1/asn1_preparser.lex.o
191 $(CXX) $(LDFLAGS) -o $@ $^ -lxml2 $(LICENSE_LIBS) $(MINGW_LIBS)
192
193 tcov2lcov$(EXESUFFIX): $(TCOV2LCOV_OBJECTS) $(TCOV2LCOV_COMMON_OBJECTS)
194 $(CXX) $(LDFLAGS) -o $@ $^ -lxml2 $(LICENSE_LIBS) $(MINGW_LIBS)
195
196 include ../Makefile.genrules
197
198 # Target-specific variable alteration
199 # Target-specific += causes make 3.79.1 to crash, hence this old style
200 makefile.o: CPPFLAGS := $(CPPFLAGS) -DCXX='"$(CXX)"'
201
202 # Pre-seed dependencies. Value.cc and Valuestuff.cc include asn1/asn1p.tab.hh
203 # However, if asn1/asn1p.y is modified, these files are not rebuilt because
204 # the Value.d contains a dependency on asn1/asn1p.tab.hh, which is not yet
205 # regenerated.
206 #
207 # 1. asn1/asn1p.y is modified
208 # 2. "make" checks dependencies of Value.o; decides nothing to do
209 # 3. "make -C asn1" rebuilds asn1p.y, updating asn1p.tab.hh
210 # 4. Value.o is now out of date
211 # 5. "make" issued a second time decides that Value.o is out of date
212 Value.d Value.o : asn1/asn1p.tab.hh
213 Valuestuff.d Valuestuff.o : asn1/asn1p.tab.hh
214 Constraint.d Constraint.o : asn1/asn1p.tab.hh