re PR debug/66691 (ICE on valid code at -O3 with -g enabled in simplify_subreg, at...
[gcc.git] / gcc / jit / Make-lang.in
1 # Top level -*- makefile -*- fragment for libgccjit.so.
2 # Copyright (C) 2013-2015 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_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
54 jit: $(LIBGCCJIT_FILENAME) \
55 $(LIBGCCJIT_SYMLINK) \
56 $(LIBGCCJIT_LINKER_NAME_SYMLINK) \
57 $(FULL_DRIVER_NAME)
58
59 # Tell GNU make to ignore these if they exist.
60 .PHONY: jit
61
62 jit_OBJS = attribs.o \
63 jit/dummy-frontend.o \
64 jit/libgccjit.o \
65 jit/jit-logging.o \
66 jit/jit-recording.o \
67 jit/jit-playback.o \
68 jit/jit-result.o \
69 jit/jit-tempdir.o \
70 jit/jit-builtins.o \
71 jit/jit-spec.o \
72 gcc.o
73
74 # Use strict warnings for this front end.
75 jit-warn = $(STRICT_WARN)
76
77 # We avoid using $(BACKEND) from Makefile.in in order to avoid pulling
78 # in main.o
79 $(LIBGCCJIT_FILENAME): $(jit_OBJS) \
80 libbackend.a libcommon-target.a libcommon.a \
81 $(CPPLIB) $(LIBDECNUMBER) \
82 $(LIBDEPS) $(srcdir)/jit/libgccjit.map \
83 $(EXTRA_GCC_OBJS)
84 +$(LLINKER) $(ALL_LINKERFLAGS) $(LDFLAGS) -o $@ -shared \
85 $(jit_OBJS) libbackend.a libcommon-target.a libcommon.a \
86 $(CPPLIB) $(LIBDECNUMBER) $(LIBS) $(BACKENDLIBS) \
87 $(EXTRA_GCC_OBJS) \
88 -Wl,--version-script=$(srcdir)/jit/libgccjit.map \
89 -Wl,-soname,$(LIBGCCJIT_SONAME)
90
91 $(LIBGCCJIT_SONAME_SYMLINK): $(LIBGCCJIT_FILENAME)
92 ln -sf $(LIBGCCJIT_FILENAME) $(LIBGCCJIT_SONAME_SYMLINK)
93
94 $(LIBGCCJIT_LINKER_NAME_SYMLINK): $(LIBGCCJIT_SONAME_SYMLINK)
95 ln -sf $(LIBGCCJIT_SONAME_SYMLINK) $(LIBGCCJIT_LINKER_NAME_SYMLINK)
96
97 #\f
98 # Build hooks:
99
100 jit.all.cross:
101 jit.start.encap:
102 jit.rest.encap:
103
104 # Documentation build hooks.
105 #
106 # The documentation can be built using the texinfo toolchain, or
107 # the sphinx toolchain
108 #
109 # The jit documentation is authored using Sphinx, which has numerous
110 # advantages over Texinfo, including:
111 #
112 # * much faster
113 #
114 # * use of CSS and JS to provide less of a 1990s feel in the generated
115 # HTML.
116 #
117 # * sane, stable HTML page and anchor names
118 #
119 # * sane HTML navigation: ability to move forward and back in the HTML
120 # at every node to read the HTML like a book
121 #
122 # * syntax-coloring of examples
123 #
124 # * the ability to "include" fragments of code inline. This is used
125 # heavily by the jit docs, so that the example code is shared by both
126 # the test suite and the documentation to ensure that the examples
127 # appearing in the docs actually compile and work
128 #
129 # Sphinx is not a "blessed" dependency, and so a prebuilt libgccjit.texinfo
130 # file built by Sphinx is checked into the source tree to avoid requiring
131 # everyone to have Sphinx installed.
132 #
133 # This prebuilt libgccjit.texinfo has the "include" fragments "baked in",
134 # and so contains the content from the sphinx toolchain, but lacks the
135 # syntax-coloring, and the generated HTML is (IMHO) greatly inferior to
136 # that generated by Sphinx.
137
138 # These targets redirect HTML creation and installation to either
139 # jit.sphinx.(install-)html or jit.texinfo.(install-)html.
140 jit.html: jit.$(doc_build_sys).html
141 jit.install-html: jit.$(doc_build_sys).install-html
142
143 # For now, use texinfo for pdf, since the sphinx latex toolchain currently
144 # fails for me deep inside pdflatex (see notes below)
145 jit.pdf: jit.texinfo.pdf
146 jit.install-pdf: jit.texinfo.install-pdf
147
148 # Hooks for building docs using texinfo
149 JIT_TEXI_FILES = $(srcdir)/jit/docs/_build/texinfo/libgccjit.texi
150
151 jit.info: doc/libgccjit.info
152 doc/libgccjit.info: $(JIT_TEXI_FILES)
153 if test "x$(BUILD_INFO)" = xinfo; then \
154 rm -f doc/libgccjit.info*; \
155 $(MAKEINFO) $(MAKEINFOFLAGS) -I $(gcc_docdir) \
156 -I $(gcc_docdir)/include -o $@ $<; \
157 else true; fi
158
159 jit.install-info: $(DESTDIR)$(infodir)/libgccjit.info
160
161 jit.dvi: doc/libgccjit.dvi
162 doc/libgccjit.dvi: $(JIT_TEXI_FILES)
163 $(TEXI2DVI) -I $(abs_docdir) -I $(abs_docdir)/include -o $@ $<
164
165 jit.texinfo.html: $(build_htmldir)/jit/index.html
166
167 $(build_htmldir)/jit/index.html: $(srcdir)/jit/docs/_build/texinfo/libgccjit.texi
168 $(mkinstalldirs) $(@D)
169 rm -f $(@D)/*
170 $(TEXI2HTML) -I $(gcc_docdir)/include -I $(srcdir)/jit -o $(@D) $<
171
172 jit.texinfo.install-html: jit.texinfo.html
173 @$(NORMAL_INSTALL)
174 test -z "$(htmldir)" || $(mkinstalldirs) "$(DESTDIR)$(htmldir)"
175 @for p in $(build_htmldir)/jit; do \
176 if test -f "$$p" || test -d "$$p"; then d=""; else d="$(srcdir)/"; fi; \
177 f=$(html__strip_dir) \
178 if test -d "$$d$$p"; then \
179 echo " $(mkinstalldirs) '$(DESTDIR)$(htmldir)/$$f'"; \
180 $(mkinstalldirs) "$(DESTDIR)$(htmldir)/$$f" || exit 1; \
181 echo " $(INSTALL_DATA) '$$d$$p'/* '$(DESTDIR)$(htmldir)/$$f'"; \
182 $(INSTALL_DATA) "$$d$$p"/* "$(DESTDIR)$(htmldir)/$$f"; \
183 else \
184 echo " $(INSTALL_DATA) '$$d$$p' '$(DESTDIR)$(htmldir)/$$f'"; \
185 $(INSTALL_DATA) "$$d$$p" "$(DESTDIR)$(htmldir)/$$f"; \
186 fi; \
187 done
188
189 jit.texinfo.pdf: doc/libgccjit.pdf
190
191 doc/libgccjit.pdf: $(JIT_TEXI_FILES)
192 $(TEXI2PDF) -I $(abs_docdir) -I $(abs_docdir)/include -o $@ $<
193
194 jit.texinfo.install-pdf: doc/libgccjit.pdf
195 @$(NORMAL_INSTALL)
196 test -z "$(pdfdir)" || $(mkinstalldirs) "$(DESTDIR)$(pdfdir)/gcc"
197 @for p in doc/libgccjit.pdf; do \
198 if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
199 f=$(pdf__strip_dir) \
200 echo " $(INSTALL_DATA) '$$d$$p' '$(DESTDIR)$(pdfdir)/gcc/$$f'"; \
201 $(INSTALL_DATA) "$$d$$p" "$(DESTDIR)$(pdfdir)/gcc/$$f"; \
202 done
203
204 # Hooks for building docs using the Sphinx toolchain:
205
206 SPHINX_BUILD_DIR=jit/sphinx-build
207
208 jit.sphinx.html:
209 mkdir -p $(SPHINX_BUILD_DIR)
210 (cd $(srcdir)/jit/docs && \
211 make html BUILDDIR=$(PWD)/$(SPHINX_BUILD_DIR) )
212
213 jit_htmldir=$(htmldir)/jit
214
215 jit.sphinx.install-html: jit.sphinx.html
216 @$(NORMAL_INSTALL)
217 test -z "$(jit_htmldir)" || $(mkinstalldirs) "$(DESTDIR)$(jit_htmldir)"
218 @for f in $(shell cd $(SPHINX_BUILD_DIR)/html && find) ; do \
219 if test -f $(SPHINX_BUILD_DIR)/html/"$$f"; then \
220 $(INSTALL_DATA) $(SPHINX_BUILD_DIR)/html/"$$f" $(DESTDIR)$(jit_htmldir)/"$$f"; \
221 else \
222 mkdir $(DESTDIR)$(jit_htmldir)/"$$f"; \
223 fi; \
224 done
225
226 # (This one is currently failing deep inside pdflatex for me;
227 # see https://bugzilla.redhat.com/show_bug.cgi?id=1148845 )
228 jit.sphinx.pdf: $(SPHINX_BUILD_DIR)/latex/libgccjit.pdf
229 $(SPHINX_BUILD_DIR)/latex/libgccjit.pdf:
230 mkdir -p $(SPHINX_BUILD_DIR)
231 (cd $(srcdir)/jit/docs && \
232 make latexpdf BUILDDIR=$(PWD)/$(SPHINX_BUILD_DIR) )
233
234 jit.sphinx.install-pdf: $(SPHINX_BUILD_DIR)/latex/libgccjit.pdf
235 @$(NORMAL_INSTALL)
236 test -z "$(pdfdir)" || $(mkinstalldirs) "$(DESTDIR)$(pdfdir)/gcc"
237 @for p in $(SPHINX_BUILD_DIR)/latex/libgccjit.pdf; do \
238 if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
239 f=$(pdf__strip_dir) \
240 echo " $(INSTALL_DATA) '$$d$$p' '$(DESTDIR)$(pdfdir)/gcc/$$f'"; \
241 $(INSTALL_DATA) "$$d$$p" "$(DESTDIR)$(pdfdir)/gcc/$$f"; \
242 done
243
244 jit.srcinfo:
245 jit.srcextra:
246
247 jit.tags:
248
249 jit.man:
250
251 jit.srcman:
252
253 lang_checks += check-jit
254 lang_checks_parallelized += check-jit
255 # This number is somewhat arbitrary. Two tests are much slower
256 # than all the others (test-combination.c and test-threads.c) so
257 # we want them to be placed in different "buckets".
258 check_jit_parallelize = 10
259
260 #\f
261 # Install hooks:
262 jit.install-common: installdirs
263 $(INSTALL_PROGRAM) $(LIBGCCJIT_FILENAME) \
264 $(DESTDIR)/$(libdir)/$(LIBGCCJIT_FILENAME)
265 ln -sf \
266 $(LIBGCCJIT_FILENAME) \
267 $(DESTDIR)/$(libdir)/$(LIBGCCJIT_SONAME_SYMLINK)
268 ln -sf \
269 $(LIBGCCJIT_SONAME_SYMLINK)\
270 $(DESTDIR)/$(libdir)/$(LIBGCCJIT_LINKER_NAME_SYMLINK)
271 $(INSTALL_DATA) $(srcdir)/jit/libgccjit.h \
272 $(DESTDIR)/$(includedir)/libgccjit.h
273 $(INSTALL_DATA) $(srcdir)/jit/libgccjit++.h \
274 $(DESTDIR)/$(includedir)/libgccjit++.h
275
276 jit.install-man:
277
278 jit.install-plugin:
279
280 jit.uninstall:
281
282 #\f
283 # Clean hooks:
284 # A lot of the ancillary files are deleted by the main makefile.
285 # We just have to delete files specific to us.
286
287 jit.mostlyclean:
288 -rm -f $(LIBGCCJIT_FILENAME) $(LIBGCCJIT_SYMLINK)
289 -rm -f $(LIBGCCJIT_LINKER_NAME_SYMLINK) $(FULL_DRIVER_NAME)
290 -rm -f $(LIBGCCJIT_SONAME)
291 -rm -f $(jit_OBJS)
292
293 jit.clean:
294
295 jit.distclean:
296
297 jit.maintainer-clean:
298
299 #\f
300 # Stage hooks:
301 # The main makefile has already created stage?/jit.
302
303 jit.stage1: stage1-start
304 -mv jit/*$(objext) stage1/jit
305 jit.stage2: stage2-start
306 -mv jit/*$(objext) stage2/jit
307 jit.stage3: stage3-start
308 -mv jit/*$(objext) stage3/jit
309 jit.stage4: stage4-start
310 -mv jit/*$(objext) stage4/jit
311 jit.stageprofile: stageprofile-start
312 -mv jit/*$(objext) stageprofile/jit
313 jit.stagefeedback: stagefeedback-start
314 -mv jit/*$(objext) stagefeedback/jit