Commit | Line | Data |
---|---|---|
d44e3c4f | 1 | ############################################################################## |
2 | # Copyright (c) 2000-2016 Ericsson Telecom AB | |
970ed795 EL |
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 | |
d44e3c4f | 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 | ############################################################################## | |
970ed795 EL |
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 \ | |
7329404e BB |
89 | Typestuff.cc ustring.cc Value.cc Valuestuff.cc XerAttributes.cc subtypestuff.cc \ |
90 | CodeGenHelper.cc DebuggerStuff.cc | |
970ed795 | 91 | |
af710487 | 92 | MFGEN_SOURCES := makefile.c xpather.cc ProjectGenHelper.cc |
970ed795 EL |
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 JSON_Tokenizer.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/, new.o pattern_la.o pattern_p.o pattern_uni.o Quadruple.o ModuleVersion.o) | |
125 | ||
126 | ifeq ($(USAGE_STATS), yes) | |
127 | COMPILER_COMMON_OBJECTS += ../common/usage_stats.o | |
128 | endif | |
129 | ||
130 | MFGEN_COMMON_OBJECTS := $(COMMON_OBJECTS) ../common/new.o | |
131 | ||
132 | DEPFILES := $(patsubst %.cc,%.d,$(patsubst %.c,%.d,$(COMPILER_SOURCES) \ | |
133 | $(MFGEN_SOURCES))) | |
134 | ||
135 | SUBDIRS := asn1 ttcn3 | |
136 | ||
137 | .PHONY: asn1_dir ttcn3_dir | |
138 | ||
139 | all run: $(TARGETS) | |
140 | ||
141 | asn1/libasn1_compiler.a: asn1_dir ; | |
142 | ||
143 | ttcn3/libttcn3_compiler.a: ttcn3_dir ; | |
144 | ||
145 | asn1_dir: | |
146 | $(MAKE) -C asn1 | |
147 | ||
148 | ttcn3_dir: | |
149 | $(MAKE) -C ttcn3 | |
150 | ||
151 | pdf: $(PDFS) | |
152 | ||
153 | install: $(TARGETS) $(MAYBE_PDFS) | |
154 | ifeq ($(DEBUG), no) | |
155 | $(STRIP) $(TARGETS) | |
156 | endif | |
157 | mkdir -p $(BINDIR) | |
158 | cp $(TARGETS) $(BINDIR) | |
159 | ifdef MINGW | |
160 | mkdir -p $(MANDIR) | |
161 | cp $(PDFS) $(MANDIR) | |
162 | else | |
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 | |
178 | endif | |
179 | ||
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) | |
187 | ||
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) | |
191 | ||
192 | tcov2lcov$(EXESUFFIX): $(TCOV2LCOV_OBJECTS) $(TCOV2LCOV_COMMON_OBJECTS) | |
193 | $(CXX) $(LDFLAGS) -o $@ $^ -lxml2 $(LICENSE_LIBS) $(MINGW_LIBS) | |
194 | ||
195 | include ../Makefile.genrules | |
196 | ||
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)"' | |
200 | ||
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 | |
204 | # regenerated. | |
205 | # | |
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 |