]>
Commit | Line | Data |
---|---|---|
35485da9 | 1 | # Top level -*- makefile -*- fragment for libgccjit.so. |
8d9254fc | 2 | # Copyright (C) 2013-2020 Free Software Foundation, Inc. |
35485da9 DM |
3 | |
4 | #This file is part of GCC. | |
5 | ||
6 | #GCC is free software; you can redistribute it and/or modify | |
7 | #it under the terms of the GNU General Public License as published by | |
8 | #the Free Software Foundation; either version 3, or (at your option) | |
9 | #any later version. | |
10 | ||
11 | #GCC is distributed in the hope that it will be useful, | |
12 | #but WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 | #MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
14 | #GNU General Public License for more details. | |
15 | ||
16 | # You should have received a copy of the GNU General Public License | |
17 | # along with GCC; see the file COPYING3. If not see | |
18 | # <http://www.gnu.org/licenses/>. | |
19 | ||
20 | # This file provides the language dependent support in the main Makefile. | |
21 | # Each language makefile fragment must provide the following targets: | |
22 | # | |
23 | # foo.all.cross, foo.start.encap, foo.rest.encap, | |
24 | # foo.install-common, foo.install-man, foo.install-info, foo.install-pdf, | |
25 | # foo.install-html, foo.info, foo.dvi, foo.pdf, foo.html, foo.uninstall, | |
26 | # foo.mostlyclean, foo.clean, foo.distclean, | |
27 | # foo.maintainer-clean, foo.stage1, foo.stage2, foo.stage3, foo.stage4 | |
28 | # | |
29 | # where `foo' is the name of the language. | |
30 | # | |
31 | # It should also provide rules for: | |
32 | # | |
33 | # - making any compiler driver (eg: g++) | |
34 | # - the compiler proper (eg: cc1plus) | |
35 | # - define the names for selecting the language in LANGUAGES. | |
36 | ||
37 | #\f | |
38 | # Define the names for selecting jit in LANGUAGES. | |
39 | # Note that it would be nice to move the dependency on g++ | |
40 | # into the jit rule, but that needs a little bit of work | |
41 | # to do the right thing within all.cross. | |
42 | ||
43 | LIBGCCJIT_LINKER_NAME = libgccjit.so | |
44 | LIBGCCJIT_VERSION_NUM = 0 | |
45 | LIBGCCJIT_MINOR_NUM = 0 | |
46 | LIBGCCJIT_RELEASE_NUM = 1 | |
47 | LIBGCCJIT_SONAME = $(LIBGCCJIT_LINKER_NAME).$(LIBGCCJIT_VERSION_NUM) | |
48 | LIBGCCJIT_FILENAME = \ | |
49 | $(LIBGCCJIT_SONAME).$(LIBGCCJIT_MINOR_NUM).$(LIBGCCJIT_RELEASE_NUM) | |
50 | ||
51 | LIBGCCJIT_LINKER_NAME_SYMLINK = $(LIBGCCJIT_LINKER_NAME) | |
52 | LIBGCCJIT_SONAME_SYMLINK = $(LIBGCCJIT_SONAME) | |
53 | ||
deb3da39 DM |
54 | # Conditionalize the use of the LD_VERSION_SCRIPT_OPTION and |
55 | # LD_SONAME_OPTION depending if configure found them, using $(if) | |
56 | # We have to define a COMMA here, otherwise the commas in the "true" | |
57 | # result are treated as separators by the $(if). | |
58 | COMMA := , | |
59 | LIBGCCJIT_VERSION_SCRIPT_OPTION = \ | |
60 | $(if $(LD_VERSION_SCRIPT_OPTION),\ | |
61 | -Wl$(COMMA)$(LD_VERSION_SCRIPT_OPTION)$(COMMA)$(srcdir)/jit/libgccjit.map) | |
62 | ||
63 | LIBGCCJIT_SONAME_OPTION = \ | |
64 | $(if $(LD_SONAME_OPTION), \ | |
65 | -Wl$(COMMA)$(LD_SONAME_OPTION)$(COMMA)$(LIBGCCJIT_SONAME)) | |
66 | ||
35485da9 DM |
67 | jit: $(LIBGCCJIT_FILENAME) \ |
68 | $(LIBGCCJIT_SYMLINK) \ | |
69 | $(LIBGCCJIT_LINKER_NAME_SYMLINK) \ | |
70 | $(FULL_DRIVER_NAME) | |
71 | ||
72 | # Tell GNU make to ignore these if they exist. | |
73 | .PHONY: jit | |
74 | ||
75 | jit_OBJS = attribs.o \ | |
76 | jit/dummy-frontend.o \ | |
77 | jit/libgccjit.o \ | |
eb4c16eb | 78 | jit/jit-logging.o \ |
35485da9 DM |
79 | jit/jit-recording.o \ |
80 | jit/jit-playback.o \ | |
56dea35f | 81 | jit/jit-result.o \ |
d1e5f2c7 | 82 | jit/jit-tempdir.o \ |
2cb844ce DM |
83 | jit/jit-builtins.o \ |
84 | jit/jit-spec.o \ | |
85 | gcc.o | |
35485da9 DM |
86 | |
87 | # Use strict warnings for this front end. | |
88 | jit-warn = $(STRICT_WARN) | |
89 | ||
90 | # We avoid using $(BACKEND) from Makefile.in in order to avoid pulling | |
91 | # in main.o | |
92 | $(LIBGCCJIT_FILENAME): $(jit_OBJS) \ | |
93 | libbackend.a libcommon-target.a libcommon.a \ | |
94 | $(CPPLIB) $(LIBDECNUMBER) \ | |
2cb844ce DM |
95 | $(LIBDEPS) $(srcdir)/jit/libgccjit.map \ |
96 | $(EXTRA_GCC_OBJS) | |
35485da9 DM |
97 | +$(LLINKER) $(ALL_LINKERFLAGS) $(LDFLAGS) -o $@ -shared \ |
98 | $(jit_OBJS) libbackend.a libcommon-target.a libcommon.a \ | |
ea143da7 | 99 | $(CPPLIB) $(LIBDECNUMBER) $(EXTRA_GCC_LIBS) $(LIBS) $(BACKENDLIBS) \ |
2cb844ce | 100 | $(EXTRA_GCC_OBJS) \ |
deb3da39 DM |
101 | $(LIBGCCJIT_VERSION_SCRIPT_OPTION) \ |
102 | $(LIBGCCJIT_SONAME_OPTION) | |
35485da9 DM |
103 | |
104 | $(LIBGCCJIT_SONAME_SYMLINK): $(LIBGCCJIT_FILENAME) | |
105 | ln -sf $(LIBGCCJIT_FILENAME) $(LIBGCCJIT_SONAME_SYMLINK) | |
106 | ||
107 | $(LIBGCCJIT_LINKER_NAME_SYMLINK): $(LIBGCCJIT_SONAME_SYMLINK) | |
108 | ln -sf $(LIBGCCJIT_SONAME_SYMLINK) $(LIBGCCJIT_LINKER_NAME_SYMLINK) | |
109 | ||
110 | #\f | |
111 | # Build hooks: | |
112 | ||
113 | jit.all.cross: | |
114 | jit.start.encap: | |
115 | jit.rest.encap: | |
116 | ||
117 | # Documentation build hooks. | |
118 | # | |
119 | # The documentation can be built using the texinfo toolchain, or | |
120 | # the sphinx toolchain | |
121 | # | |
122 | # The jit documentation is authored using Sphinx, which has numerous | |
123 | # advantages over Texinfo, including: | |
124 | # | |
125 | # * much faster | |
126 | # | |
127 | # * use of CSS and JS to provide less of a 1990s feel in the generated | |
128 | # HTML. | |
129 | # | |
130 | # * sane, stable HTML page and anchor names | |
131 | # | |
132 | # * sane HTML navigation: ability to move forward and back in the HTML | |
133 | # at every node to read the HTML like a book | |
134 | # | |
135 | # * syntax-coloring of examples | |
136 | # | |
137 | # * the ability to "include" fragments of code inline. This is used | |
138 | # heavily by the jit docs, so that the example code is shared by both | |
139 | # the test suite and the documentation to ensure that the examples | |
140 | # appearing in the docs actually compile and work | |
141 | # | |
142 | # Sphinx is not a "blessed" dependency, and so a prebuilt libgccjit.texinfo | |
143 | # file built by Sphinx is checked into the source tree to avoid requiring | |
144 | # everyone to have Sphinx installed. | |
145 | # | |
146 | # This prebuilt libgccjit.texinfo has the "include" fragments "baked in", | |
147 | # and so contains the content from the sphinx toolchain, but lacks the | |
148 | # syntax-coloring, and the generated HTML is (IMHO) greatly inferior to | |
149 | # that generated by Sphinx. | |
150 | ||
151 | # These targets redirect HTML creation and installation to either | |
152 | # jit.sphinx.(install-)html or jit.texinfo.(install-)html. | |
153 | jit.html: jit.$(doc_build_sys).html | |
154 | jit.install-html: jit.$(doc_build_sys).install-html | |
155 | ||
156 | # For now, use texinfo for pdf, since the sphinx latex toolchain currently | |
157 | # fails for me deep inside pdflatex (see notes below) | |
158 | jit.pdf: jit.texinfo.pdf | |
159 | jit.install-pdf: jit.texinfo.install-pdf | |
160 | ||
161 | # Hooks for building docs using texinfo | |
162 | JIT_TEXI_FILES = $(srcdir)/jit/docs/_build/texinfo/libgccjit.texi | |
163 | ||
164 | jit.info: doc/libgccjit.info | |
165 | doc/libgccjit.info: $(JIT_TEXI_FILES) | |
166 | if test "x$(BUILD_INFO)" = xinfo; then \ | |
167 | rm -f doc/libgccjit.info*; \ | |
168 | $(MAKEINFO) $(MAKEINFOFLAGS) -I $(gcc_docdir) \ | |
169 | -I $(gcc_docdir)/include -o $@ $<; \ | |
170 | else true; fi | |
171 | ||
172 | jit.install-info: $(DESTDIR)$(infodir)/libgccjit.info | |
173 | ||
174 | jit.dvi: doc/libgccjit.dvi | |
175 | doc/libgccjit.dvi: $(JIT_TEXI_FILES) | |
176 | $(TEXI2DVI) -I $(abs_docdir) -I $(abs_docdir)/include -o $@ $< | |
177 | ||
178 | jit.texinfo.html: $(build_htmldir)/jit/index.html | |
179 | ||
180 | $(build_htmldir)/jit/index.html: $(srcdir)/jit/docs/_build/texinfo/libgccjit.texi | |
181 | $(mkinstalldirs) $(@D) | |
182 | rm -f $(@D)/* | |
183 | $(TEXI2HTML) -I $(gcc_docdir)/include -I $(srcdir)/jit -o $(@D) $< | |
184 | ||
185 | jit.texinfo.install-html: jit.texinfo.html | |
186 | @$(NORMAL_INSTALL) | |
187 | test -z "$(htmldir)" || $(mkinstalldirs) "$(DESTDIR)$(htmldir)" | |
188 | @for p in $(build_htmldir)/jit; do \ | |
189 | if test -f "$$p" || test -d "$$p"; then d=""; else d="$(srcdir)/"; fi; \ | |
190 | f=$(html__strip_dir) \ | |
191 | if test -d "$$d$$p"; then \ | |
192 | echo " $(mkinstalldirs) '$(DESTDIR)$(htmldir)/$$f'"; \ | |
193 | $(mkinstalldirs) "$(DESTDIR)$(htmldir)/$$f" || exit 1; \ | |
194 | echo " $(INSTALL_DATA) '$$d$$p'/* '$(DESTDIR)$(htmldir)/$$f'"; \ | |
195 | $(INSTALL_DATA) "$$d$$p"/* "$(DESTDIR)$(htmldir)/$$f"; \ | |
196 | else \ | |
197 | echo " $(INSTALL_DATA) '$$d$$p' '$(DESTDIR)$(htmldir)/$$f'"; \ | |
198 | $(INSTALL_DATA) "$$d$$p" "$(DESTDIR)$(htmldir)/$$f"; \ | |
199 | fi; \ | |
200 | done | |
201 | ||
202 | jit.texinfo.pdf: doc/libgccjit.pdf | |
203 | ||
204 | doc/libgccjit.pdf: $(JIT_TEXI_FILES) | |
205 | $(TEXI2PDF) -I $(abs_docdir) -I $(abs_docdir)/include -o $@ $< | |
206 | ||
207 | jit.texinfo.install-pdf: doc/libgccjit.pdf | |
208 | @$(NORMAL_INSTALL) | |
209 | test -z "$(pdfdir)" || $(mkinstalldirs) "$(DESTDIR)$(pdfdir)/gcc" | |
210 | @for p in doc/libgccjit.pdf; do \ | |
211 | if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ | |
212 | f=$(pdf__strip_dir) \ | |
213 | echo " $(INSTALL_DATA) '$$d$$p' '$(DESTDIR)$(pdfdir)/gcc/$$f'"; \ | |
214 | $(INSTALL_DATA) "$$d$$p" "$(DESTDIR)$(pdfdir)/gcc/$$f"; \ | |
215 | done | |
216 | ||
217 | # Hooks for building docs using the Sphinx toolchain: | |
218 | ||
219 | SPHINX_BUILD_DIR=jit/sphinx-build | |
220 | ||
221 | jit.sphinx.html: | |
222 | mkdir -p $(SPHINX_BUILD_DIR) | |
223 | (cd $(srcdir)/jit/docs && \ | |
224 | make html BUILDDIR=$(PWD)/$(SPHINX_BUILD_DIR) ) | |
225 | ||
226 | jit_htmldir=$(htmldir)/jit | |
227 | ||
228 | jit.sphinx.install-html: jit.sphinx.html | |
229 | @$(NORMAL_INSTALL) | |
230 | test -z "$(jit_htmldir)" || $(mkinstalldirs) "$(DESTDIR)$(jit_htmldir)" | |
231 | @for f in $(shell cd $(SPHINX_BUILD_DIR)/html && find) ; do \ | |
232 | if test -f $(SPHINX_BUILD_DIR)/html/"$$f"; then \ | |
233 | $(INSTALL_DATA) $(SPHINX_BUILD_DIR)/html/"$$f" $(DESTDIR)$(jit_htmldir)/"$$f"; \ | |
234 | else \ | |
235 | mkdir $(DESTDIR)$(jit_htmldir)/"$$f"; \ | |
236 | fi; \ | |
237 | done | |
238 | ||
239 | # (This one is currently failing deep inside pdflatex for me; | |
240 | # see https://bugzilla.redhat.com/show_bug.cgi?id=1148845 ) | |
241 | jit.sphinx.pdf: $(SPHINX_BUILD_DIR)/latex/libgccjit.pdf | |
242 | $(SPHINX_BUILD_DIR)/latex/libgccjit.pdf: | |
243 | mkdir -p $(SPHINX_BUILD_DIR) | |
244 | (cd $(srcdir)/jit/docs && \ | |
245 | make latexpdf BUILDDIR=$(PWD)/$(SPHINX_BUILD_DIR) ) | |
246 | ||
247 | jit.sphinx.install-pdf: $(SPHINX_BUILD_DIR)/latex/libgccjit.pdf | |
248 | @$(NORMAL_INSTALL) | |
249 | test -z "$(pdfdir)" || $(mkinstalldirs) "$(DESTDIR)$(pdfdir)/gcc" | |
250 | @for p in $(SPHINX_BUILD_DIR)/latex/libgccjit.pdf; do \ | |
251 | if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ | |
252 | f=$(pdf__strip_dir) \ | |
253 | echo " $(INSTALL_DATA) '$$d$$p' '$(DESTDIR)$(pdfdir)/gcc/$$f'"; \ | |
254 | $(INSTALL_DATA) "$$d$$p" "$(DESTDIR)$(pdfdir)/gcc/$$f"; \ | |
255 | done | |
256 | ||
257 | jit.srcinfo: | |
258 | jit.srcextra: | |
259 | ||
260 | jit.tags: | |
261 | ||
262 | jit.man: | |
263 | ||
264 | jit.srcman: | |
265 | ||
266 | lang_checks += check-jit | |
499de348 DM |
267 | lang_checks_parallelized += check-jit |
268 | # This number is somewhat arbitrary. Two tests are much slower | |
269 | # than all the others (test-combination.c and test-threads.c) so | |
270 | # we want them to be placed in different "buckets". | |
271 | check_jit_parallelize = 10 | |
35485da9 | 272 | |
033eb567 DM |
273 | # No jit-specific selftests |
274 | selftest-jit: | |
275 | ||
35485da9 DM |
276 | #\f |
277 | # Install hooks: | |
278 | jit.install-common: installdirs | |
279 | $(INSTALL_PROGRAM) $(LIBGCCJIT_FILENAME) \ | |
280 | $(DESTDIR)/$(libdir)/$(LIBGCCJIT_FILENAME) | |
281 | ln -sf \ | |
282 | $(LIBGCCJIT_FILENAME) \ | |
283 | $(DESTDIR)/$(libdir)/$(LIBGCCJIT_SONAME_SYMLINK) | |
284 | ln -sf \ | |
285 | $(LIBGCCJIT_SONAME_SYMLINK)\ | |
286 | $(DESTDIR)/$(libdir)/$(LIBGCCJIT_LINKER_NAME_SYMLINK) | |
83c1b80e | 287 | $(INSTALL_DATA) $(srcdir)/jit/libgccjit.h \ |
35485da9 | 288 | $(DESTDIR)/$(includedir)/libgccjit.h |
83c1b80e | 289 | $(INSTALL_DATA) $(srcdir)/jit/libgccjit++.h \ |
35485da9 DM |
290 | $(DESTDIR)/$(includedir)/libgccjit++.h |
291 | ||
292 | jit.install-man: | |
293 | ||
294 | jit.install-plugin: | |
295 | ||
296 | jit.uninstall: | |
297 | ||
298 | #\f | |
299 | # Clean hooks: | |
300 | # A lot of the ancillary files are deleted by the main makefile. | |
301 | # We just have to delete files specific to us. | |
302 | ||
303 | jit.mostlyclean: | |
46bf0b0a JW |
304 | -rm -f $(LIBGCCJIT_FILENAME) $(LIBGCCJIT_SYMLINK) |
305 | -rm -f $(LIBGCCJIT_LINKER_NAME_SYMLINK) $(FULL_DRIVER_NAME) | |
306 | -rm -f $(LIBGCCJIT_SONAME) | |
307 | -rm -f $(jit_OBJS) | |
35485da9 DM |
308 | |
309 | jit.clean: | |
310 | ||
311 | jit.distclean: | |
312 | ||
313 | jit.maintainer-clean: | |
314 | ||
315 | #\f | |
316 | # Stage hooks: | |
317 | # The main makefile has already created stage?/jit. | |
318 | ||
319 | jit.stage1: stage1-start | |
320 | -mv jit/*$(objext) stage1/jit | |
321 | jit.stage2: stage2-start | |
322 | -mv jit/*$(objext) stage2/jit | |
323 | jit.stage3: stage3-start | |
324 | -mv jit/*$(objext) stage3/jit | |
325 | jit.stage4: stage4-start | |
326 | -mv jit/*$(objext) stage4/jit | |
327 | jit.stageprofile: stageprofile-start | |
328 | -mv jit/*$(objext) stageprofile/jit | |
329 | jit.stagefeedback: stagefeedback-start | |
330 | -mv jit/*$(objext) stagefeedback/jit |