]> git.ipfire.org Git - thirdparty/gcc.git/blob - gcc/jit/Make-lang.in
Update copyright years.
[thirdparty/gcc.git] / gcc / jit / Make-lang.in
1 # Top level -*- makefile -*- fragment for libgccjit.so.
2 # Copyright (C) 2013-2022 Free Software Foundation, Inc.
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_VERSION_NUM = 0
44 LIBGCCJIT_MINOR_NUM = 0
45 LIBGCCJIT_RELEASE_NUM = 1
46
47 ifneq (,$(findstring mingw,$(target)))
48 LIBGCCJIT_FILENAME = libgccjit-$(LIBGCCJIT_VERSION_NUM).dll
49 LIBGCCJIT_IMPORT_LIB = libgccjit.dll.a
50
51 jit: $(LIBGCCJIT_FILENAME) \
52 $(FULL_DRIVER_NAME)
53
54 else
55
56 ifneq (,$(findstring darwin,$(host)))
57
58 LIBGCCJIT_AGE = 1
59 LIBGCCJIT_BASENAME = libgccjit
60
61 LIBGCCJIT_SONAME = \
62 ${libdir}/$(LIBGCCJIT_BASENAME).$(LIBGCCJIT_VERSION_NUM).dylib
63 LIBGCCJIT_FILENAME = $(LIBGCCJIT_BASENAME).$(LIBGCCJIT_VERSION_NUM).dylib
64 LIBGCCJIT_LINKER_NAME = $(LIBGCCJIT_BASENAME).dylib
65
66 # Conditionalize the use of the LD_VERSION_SCRIPT_OPTION and
67 # LD_SONAME_OPTION depending if configure found them, using $(if)
68 # We have to define a COMMA here, otherwise the commas in the "true"
69 # result are treated as separators by the $(if).
70 COMMA := ,
71 LIBGCCJIT_VERSION_SCRIPT_OPTION = \
72 $(if $(LD_VERSION_SCRIPT_OPTION),\
73 -Wl$(COMMA)$(LD_VERSION_SCRIPT_OPTION)$(COMMA)$(srcdir)/jit/libgccjit.map)
74
75 LIBGCCJIT_SONAME_OPTION = \
76 $(if $(LD_SONAME_OPTION), \
77 -Wl$(COMMA)$(LD_SONAME_OPTION)$(COMMA)$(LIBGCCJIT_SONAME))
78
79 LIBGCCJIT_SONAME_SYMLINK = $(LIBGCCJIT_FILENAME)
80 LIBGCCJIT_LINKER_NAME_SYMLINK = $(LIBGCCJIT_LINKER_NAME)
81
82 jit: $(LIBGCCJIT_FILENAME) \
83 $(LIBGCCJIT_SYMLINK) \
84 $(LIBGCCJIT_LINKER_NAME_SYMLINK) \
85 $(FULL_DRIVER_NAME)
86
87 else
88
89 LIBGCCJIT_LINKER_NAME = libgccjit.so
90 LIBGCCJIT_SONAME = $(LIBGCCJIT_LINKER_NAME).$(LIBGCCJIT_VERSION_NUM)
91 LIBGCCJIT_FILENAME = \
92 $(LIBGCCJIT_SONAME).$(LIBGCCJIT_MINOR_NUM).$(LIBGCCJIT_RELEASE_NUM)
93
94 LIBGCCJIT_LINKER_NAME_SYMLINK = $(LIBGCCJIT_LINKER_NAME)
95 LIBGCCJIT_SONAME_SYMLINK = $(LIBGCCJIT_SONAME)
96
97 # Conditionalize the use of the LD_VERSION_SCRIPT_OPTION and
98 # LD_SONAME_OPTION depending if configure found them, using $(if)
99 # We have to define a COMMA here, otherwise the commas in the "true"
100 # result are treated as separators by the $(if).
101 COMMA := ,
102 LIBGCCJIT_VERSION_SCRIPT_OPTION = \
103 $(if $(LD_VERSION_SCRIPT_OPTION),\
104 -Wl$(COMMA)$(LD_VERSION_SCRIPT_OPTION)$(COMMA)$(srcdir)/jit/libgccjit.map)
105
106 LIBGCCJIT_SONAME_OPTION = \
107 $(if $(LD_SONAME_OPTION), \
108 -Wl$(COMMA)$(LD_SONAME_OPTION)$(COMMA)$(LIBGCCJIT_SONAME))
109
110 jit: $(LIBGCCJIT_FILENAME) \
111 $(LIBGCCJIT_SYMLINK) \
112 $(LIBGCCJIT_LINKER_NAME_SYMLINK) \
113 $(FULL_DRIVER_NAME)
114
115 endif
116 endif
117
118 jit.serial = $(LIBGCCJIT_FILENAME)
119
120 # Tell GNU make to ignore these if they exist.
121 .PHONY: jit
122
123 jit_OBJS = attribs.o \
124 jit/dummy-frontend.o \
125 jit/libgccjit.o \
126 jit/jit-logging.o \
127 jit/jit-recording.o \
128 jit/jit-playback.o \
129 jit/jit-result.o \
130 jit/jit-tempdir.o \
131 jit/jit-builtins.o \
132 jit/jit-spec.o \
133 gcc.o
134
135 ifneq (,$(findstring mingw,$(target)))
136 jit_OBJS += jit/jit-w32.o
137 endif
138
139 # Use strict warnings for this front end.
140 jit-warn = $(STRICT_WARN)
141
142 ifneq (,$(findstring mingw,$(target)))
143 # Create import library
144 LIBGCCJIT_EXTRA_OPTS = -Wl,--out-implib,$(LIBGCCJIT_IMPORT_LIB)
145 else
146
147 ifneq (,$(findstring darwin,$(host)))
148 # TODO : Construct a Darwin-style symbol export file.
149 LIBGCCJIT_EXTRA_OPTS = -Wl,-compatibility_version,$(LIBGCCJIT_VERSION_NUM) \
150 -Wl,-current_version,$(LIBGCCJIT_VERSION_NUM).$(LIBGCCJIT_MINOR_NUM).$(LIBGCCJIT_AGE) \
151 $(LIBGCCJIT_VERSION_SCRIPT_OPTION) \
152 $(LIBGCCJIT_SONAME_OPTION)
153 else
154
155 LIBGCCJIT_EXTRA_OPTS = $(LIBGCCJIT_VERSION_SCRIPT_OPTION) \
156 $(LIBGCCJIT_SONAME_OPTION)
157 endif
158 endif
159
160 # We avoid using $(BACKEND) from Makefile.in in order to avoid pulling
161 # in main.o
162 $(LIBGCCJIT_FILENAME): $(jit_OBJS) \
163 libbackend.a libcommon-target.a libcommon.a \
164 $(CPPLIB) $(LIBDECNUMBER) \
165 $(LIBDEPS) $(srcdir)/jit/libgccjit.map \
166 $(EXTRA_GCC_OBJS) $(jit.prev)
167 @$(call LINK_PROGRESS,$(INDEX.jit),start)
168 +$(LLINKER) $(ALL_LINKERFLAGS) $(LDFLAGS) -o $@ -shared \
169 $(jit_OBJS) libbackend.a libcommon-target.a libcommon.a \
170 $(CPPLIB) $(LIBDECNUMBER) $(EXTRA_GCC_LIBS) $(LIBS) $(BACKENDLIBS) \
171 $(EXTRA_GCC_OBJS) \
172 $(LIBGCCJIT_EXTRA_OPTS)
173 @$(call LINK_PROGRESS,$(INDEX.jit),end)
174
175 # Create symlinks when not building for Windows
176 ifeq (,$(findstring mingw,$(target)))
177
178 ifeq (,$(findstring darwin,$(host)))
179 # but only one level for Darwin, version info is embedded.
180 $(LIBGCCJIT_SONAME_SYMLINK): $(LIBGCCJIT_FILENAME)
181 ln -sf $(LIBGCCJIT_FILENAME) $(LIBGCCJIT_SONAME_SYMLINK)
182 endif
183
184 $(LIBGCCJIT_LINKER_NAME_SYMLINK): $(LIBGCCJIT_SONAME_SYMLINK)
185 ln -sf $(LIBGCCJIT_SONAME_SYMLINK) $(LIBGCCJIT_LINKER_NAME_SYMLINK)
186 endif
187
188 #\f
189 # Build hooks:
190
191 jit.all.cross:
192 jit.start.encap:
193 jit.rest.encap:
194
195 # Documentation build hooks.
196 #
197 # The documentation can be built using the texinfo toolchain, or
198 # the sphinx toolchain
199 #
200 # The jit documentation is authored using Sphinx, which has numerous
201 # advantages over Texinfo, including:
202 #
203 # * much faster
204 #
205 # * use of CSS and JS to provide less of a 1990s feel in the generated
206 # HTML.
207 #
208 # * sane, stable HTML page and anchor names
209 #
210 # * sane HTML navigation: ability to move forward and back in the HTML
211 # at every node to read the HTML like a book
212 #
213 # * syntax-coloring of examples
214 #
215 # * the ability to "include" fragments of code inline. This is used
216 # heavily by the jit docs, so that the example code is shared by both
217 # the test suite and the documentation to ensure that the examples
218 # appearing in the docs actually compile and work
219 #
220 # Sphinx is not a "blessed" dependency, and so a prebuilt libgccjit.texinfo
221 # file built by Sphinx is checked into the source tree to avoid requiring
222 # everyone to have Sphinx installed.
223 #
224 # This prebuilt libgccjit.texinfo has the "include" fragments "baked in",
225 # and so contains the content from the sphinx toolchain, but lacks the
226 # syntax-coloring, and the generated HTML is (IMHO) greatly inferior to
227 # that generated by Sphinx.
228
229 # These targets redirect HTML creation and installation to either
230 # jit.sphinx.(install-)html or jit.texinfo.(install-)html.
231 jit.html: jit.$(doc_build_sys).html
232 jit.install-html: jit.$(doc_build_sys).install-html
233
234 # For now, use texinfo for pdf, since the sphinx latex toolchain currently
235 # fails for me deep inside pdflatex (see notes below)
236 jit.pdf: jit.texinfo.pdf
237 jit.install-pdf: jit.texinfo.install-pdf
238
239 # Hooks for building docs using texinfo
240 JIT_TEXI_FILES = $(srcdir)/jit/docs/_build/texinfo/libgccjit.texi
241
242 jit.info: doc/libgccjit.info
243 doc/libgccjit.info: $(JIT_TEXI_FILES)
244 if test "x$(BUILD_INFO)" = xinfo; then \
245 rm -f doc/libgccjit.info*; \
246 $(MAKEINFO) $(MAKEINFOFLAGS) -I $(gcc_docdir) \
247 -I $(gcc_docdir)/include -o $@ $<; \
248 else true; fi
249
250 jit.install-info: $(DESTDIR)$(infodir)/libgccjit.info
251
252 jit.dvi: doc/libgccjit.dvi
253 doc/libgccjit.dvi: $(JIT_TEXI_FILES)
254 $(TEXI2DVI) -I $(abs_docdir) -I $(abs_docdir)/include -o $@ $<
255
256 jit.texinfo.html: $(build_htmldir)/jit/index.html
257
258 $(build_htmldir)/jit/index.html: $(srcdir)/jit/docs/_build/texinfo/libgccjit.texi
259 $(mkinstalldirs) $(@D)
260 rm -f $(@D)/*
261 $(TEXI2HTML) -I $(gcc_docdir)/include -I $(srcdir)/jit -o $(@D) $<
262
263 jit.texinfo.install-html: jit.texinfo.html
264 @$(NORMAL_INSTALL)
265 test -z "$(htmldir)" || $(mkinstalldirs) "$(DESTDIR)$(htmldir)"
266 @for p in $(build_htmldir)/jit; do \
267 if test -f "$$p" || test -d "$$p"; then d=""; else d="$(srcdir)/"; fi; \
268 f=$(html__strip_dir) \
269 if test -d "$$d$$p"; then \
270 echo " $(mkinstalldirs) '$(DESTDIR)$(htmldir)/$$f'"; \
271 $(mkinstalldirs) "$(DESTDIR)$(htmldir)/$$f" || exit 1; \
272 echo " $(INSTALL_DATA) '$$d$$p'/* '$(DESTDIR)$(htmldir)/$$f'"; \
273 $(INSTALL_DATA) "$$d$$p"/* "$(DESTDIR)$(htmldir)/$$f"; \
274 else \
275 echo " $(INSTALL_DATA) '$$d$$p' '$(DESTDIR)$(htmldir)/$$f'"; \
276 $(INSTALL_DATA) "$$d$$p" "$(DESTDIR)$(htmldir)/$$f"; \
277 fi; \
278 done
279
280 jit.texinfo.pdf: doc/libgccjit.pdf
281
282 doc/libgccjit.pdf: $(JIT_TEXI_FILES)
283 $(TEXI2PDF) -I $(abs_docdir) -I $(abs_docdir)/include -o $@ $<
284
285 jit.texinfo.install-pdf: doc/libgccjit.pdf
286 @$(NORMAL_INSTALL)
287 test -z "$(pdfdir)" || $(mkinstalldirs) "$(DESTDIR)$(pdfdir)/gcc"
288 @for p in doc/libgccjit.pdf; do \
289 if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
290 f=$(pdf__strip_dir) \
291 echo " $(INSTALL_DATA) '$$d$$p' '$(DESTDIR)$(pdfdir)/gcc/$$f'"; \
292 $(INSTALL_DATA) "$$d$$p" "$(DESTDIR)$(pdfdir)/gcc/$$f"; \
293 done
294
295 # Hooks for building docs using the Sphinx toolchain:
296
297 SPHINX_BUILD_DIR=jit/sphinx-build
298
299 jit.sphinx.html:
300 $(mkinstalldirs) $(SPHINX_BUILD_DIR)
301 (cd $(srcdir)/jit/docs && \
302 make html BUILDDIR=$(PWD)/$(SPHINX_BUILD_DIR) )
303
304 jit_htmldir=$(htmldir)/jit
305
306 jit.sphinx.install-html: jit.sphinx.html
307 @$(NORMAL_INSTALL)
308 test -z "$(jit_htmldir)" || $(mkinstalldirs) "$(DESTDIR)$(jit_htmldir)"
309 @for f in $(shell cd $(SPHINX_BUILD_DIR)/html && find) ; do \
310 if test -f $(SPHINX_BUILD_DIR)/html/"$$f"; then \
311 $(INSTALL_DATA) $(SPHINX_BUILD_DIR)/html/"$$f" $(DESTDIR)$(jit_htmldir)/"$$f"; \
312 else \
313 mkdir $(DESTDIR)$(jit_htmldir)/"$$f"; \
314 fi; \
315 done
316
317 # (This one is currently failing deep inside pdflatex for me;
318 # see https://bugzilla.redhat.com/show_bug.cgi?id=1148845 )
319 jit.sphinx.pdf: $(SPHINX_BUILD_DIR)/latex/libgccjit.pdf
320 $(SPHINX_BUILD_DIR)/latex/libgccjit.pdf:
321 $(mkinstalldirs) $(SPHINX_BUILD_DIR)
322 (cd $(srcdir)/jit/docs && \
323 make latexpdf BUILDDIR=$(PWD)/$(SPHINX_BUILD_DIR) )
324
325 jit.sphinx.install-pdf: $(SPHINX_BUILD_DIR)/latex/libgccjit.pdf
326 @$(NORMAL_INSTALL)
327 test -z "$(pdfdir)" || $(mkinstalldirs) "$(DESTDIR)$(pdfdir)/gcc"
328 @for p in $(SPHINX_BUILD_DIR)/latex/libgccjit.pdf; do \
329 if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
330 f=$(pdf__strip_dir) \
331 echo " $(INSTALL_DATA) '$$d$$p' '$(DESTDIR)$(pdfdir)/gcc/$$f'"; \
332 $(INSTALL_DATA) "$$d$$p" "$(DESTDIR)$(pdfdir)/gcc/$$f"; \
333 done
334
335 jit.srcinfo:
336 jit.srcextra:
337
338 jit.tags:
339
340 jit.man:
341
342 jit.srcman:
343
344 lang_checks += check-jit
345 lang_checks_parallelized += check-jit
346 # This number is somewhat arbitrary. Two tests are much slower
347 # than all the others (test-combination.c and test-threads.c) so
348 # we want them to be placed in different "buckets".
349 check_jit_parallelize = 10
350
351 # No jit-specific selftests
352 selftest-jit:
353
354 #\f
355 # Install hooks:
356 jit.install-headers: installdirs
357 $(INSTALL_DATA) $(srcdir)/jit/libgccjit.h \
358 $(DESTDIR)$(includedir)/libgccjit.h
359 $(INSTALL_DATA) $(srcdir)/jit/libgccjit++.h \
360 $(DESTDIR)$(includedir)/libgccjit++.h
361
362 ifneq (,$(findstring mingw,$(target)))
363 jit.install-common: installdirs jit.install-headers
364 # Install import library
365 $(INSTALL_PROGRAM) $(LIBGCCJIT_IMPORT_LIB) \
366 $(DESTDIR)$(libdir)/$(LIBGCCJIT_IMPORT_LIB)
367 # Install DLL file
368 $(INSTALL_PROGRAM) $(LIBGCCJIT_FILENAME) \
369 $(DESTDIR)$(bindir)/$(LIBGCCJIT_FILENAME)
370
371 else
372 ifneq (,$(findstring darwin,$(host)))
373 # but only one level for Darwin
374
375 jit.install-common: installdirs jit.install-headers
376 $(INSTALL_PROGRAM) $(LIBGCCJIT_FILENAME) \
377 $(DESTDIR)$(libdir)/$(LIBGCCJIT_FILENAME)
378 ln -sf \
379 $(LIBGCCJIT_SONAME_SYMLINK)\
380 $(DESTDIR)$(libdir)/$(LIBGCCJIT_LINKER_NAME_SYMLINK)
381
382 else
383 jit.install-common: installdirs jit.install-headers
384 $(INSTALL_PROGRAM) $(LIBGCCJIT_FILENAME) \
385 $(DESTDIR)$(libdir)/$(LIBGCCJIT_FILENAME)
386 ln -sf \
387 $(LIBGCCJIT_FILENAME) \
388 $(DESTDIR)$(libdir)/$(LIBGCCJIT_SONAME_SYMLINK)
389 ln -sf \
390 $(LIBGCCJIT_SONAME_SYMLINK)\
391 $(DESTDIR)$(libdir)/$(LIBGCCJIT_LINKER_NAME_SYMLINK)
392 endif
393 endif
394
395 jit.install-man:
396
397 jit.install-plugin:
398
399 jit.uninstall:
400
401 #\f
402 # Clean hooks:
403 # A lot of the ancillary files are deleted by the main makefile.
404 # We just have to delete files specific to us.
405
406 jit.mostlyclean:
407 -rm -f $(LIBGCCJIT_FILENAME) $(LIBGCCJIT_SYMLINK)
408 -rm -f $(LIBGCCJIT_LINKER_NAME_SYMLINK) $(FULL_DRIVER_NAME)
409 -rm -f $(LIBGCCJIT_SONAME)
410 -rm -f $(jit_OBJS)
411
412 jit.clean:
413
414 jit.distclean:
415
416 jit.maintainer-clean:
417
418 #\f
419 # Stage hooks:
420 # The main makefile has already created stage?/jit.
421
422 jit.stage1: stage1-start
423 -mv jit/*$(objext) stage1/jit
424 jit.stage2: stage2-start
425 -mv jit/*$(objext) stage2/jit
426 jit.stage3: stage3-start
427 -mv jit/*$(objext) stage3/jit
428 jit.stage4: stage4-start
429 -mv jit/*$(objext) stage4/jit
430 jit.stageprofile: stageprofile-start
431 -mv jit/*$(objext) stageprofile/jit
432 jit.stagefeedback: stagefeedback-start
433 -mv jit/*$(objext) stagefeedback/jit