1 # Top level -*- makefile -*- fragment for the GNU compiler for the Java(TM)
3 # Copyright (C) 1996-2016 Free Software Foundation, Inc.
5 #This file is part of GCC.
7 #GCC is free software; you can redistribute it and/or modify
8 #it under the terms of the GNU General Public License as published by
9 #the Free Software Foundation; either version 3, or (at your option)
12 #GCC is distributed in the hope that it will be useful,
13 #but WITHOUT ANY WARRANTY; without even the implied warranty of
14 #MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 #GNU General Public License for more details.
17 #You should have received a copy of the GNU General Public License
18 #along with GCC; see the file COPYING3. If not see
19 #<http://www.gnu.org/licenses/>.
21 #Java and all Java-based marks are trademarks or registered trademarks
22 #of Sun Microsystems, Inc. in the United States and other countries.
23 #The Free Software Foundation is independent of Sun Microsystems, Inc.
25 # This file provides the language dependent support in the main Makefile.
26 # Each language makefile fragment must provide the following targets:
28 # foo.all.cross, foo.start.encap, foo.rest.encap,
29 # foo.install-common, foo.install-man, foo.install-info, foo.install-pdf,
30 # foo.install-html, foo.info, foo.dvi, foo.pdf, foo.html, foo.uninstall,
31 # foo.mostlyclean, foo.clean, foo.distclean,
32 # foo.maintainer-clean, foo.stage1, foo.stage2, foo.stage3, foo.stage4
34 # where `foo' is the name of the language.
36 # It should also provide rules for:
38 # - making any compiler driver (eg: g++)
39 # - the compiler proper (eg: jc1)
40 # - define the names for selecting the language in LANGUAGES.
42 # Actual names to use when installing a native compiler.
43 JAVA_INSTALL_NAME := $(shell echo gcj|sed '$(program_transform_name)')
44 JAVA_TARGET_INSTALL_NAME := $(target_noncanonical)-$(shell echo gcj|sed '$(program_transform_name)')
48 # Define the names for selecting java in LANGUAGES.
49 java: jc1$(exeext) $(XGCJ)$(exeext) jvgenmain$(exeext) jcf-dump$(exeext)
51 # Define the name of target independent tools to be installed in $(bindir)
52 # Names are subject to changes
53 JAVA_TARGET_INDEPENDENT_BIN_TOOLS = jcf-dump
55 # Tell GNU make to ignore these if they exist.
58 CFLAGS-java/jvspec.o += $(DRIVER_DEFINES)
60 # Create the compiler driver for $(XGCJ).
61 $(XGCJ)$(exeext): $(GCC_OBJS) java/jvspec.o java/jcf-path.o \
62 libcommon-target.a $(LIBDEPS) $(EXTRA_GCC_OBJS)
63 +$(LINKER) $(ALL_LINKERFLAGS) $(LDFLAGS) -o $@ $(GCC_OBJS) \
64 java/jvspec.o java/jcf-path.o $(EXTRA_GCC_OBJS) libcommon-target.a \
65 $(EXTRA_GCC_LIBS) $(LIBS)
67 # Create a version of the $(XGCJ) driver which calls the cross-compiler.
68 $(XGCJ)-cross$(exeext): $(XGCJ)$(exeext)
69 -rm -f $(XGCJ)-cross$(exeext)
70 cp $(XGCJ)$(exeext) $(XGCJ)-cross$(exeext)
74 # Executables built by this Makefile:
75 JAVA_OBJS = java/class.o java/decl.o java/expr.o \
76 java/constants.o java/lang.o java/typeck.o java/except.o \
77 java/verify-glue.o java/verify-impl.o \
78 java/zextract.o java/jcf-io.o java/win32-host.o java/jcf-parse.o java/mangle.o \
79 java/mangle_name.o java/builtins.o java/resource.o \
81 java/jcf-path.o java/boehm.o java/java-gimplify.o hash-table.o
83 JCFDUMP_OBJS = java/jcf-dump.o java/jcf-io.o java/jcf-depend.o java/jcf-path.o \
84 java/win32-host.o java/zextract.o ggc-none.o hash-table.o
86 JVGENMAIN_OBJS = java/jvgenmain.o java/mangle_name.o
88 java_OBJS = $(sort $(JAVA_OBJS) $(JCFDUMP_OBJS) $(JVGENMAIN_OBJS)) java/jvspec.o
90 # Use strict warnings for this front end.
91 java-warn = $(STRICT_WARN)
93 # String length warnings
94 java/jvspec.o-warn = -Wno-error
96 jc1$(exeext): $(JAVA_OBJS) $(BACKEND) $(LIBDEPS) attribs.o
98 +$(LLINKER) $(ALL_LINKERFLAGS) $(LDFLAGS) -o $@ \
99 $(JAVA_OBJS) $(BACKEND) $(ZLIB) $(LIBICONV) $(LIBS) attribs.o $(BACKENDLIBS)
101 jcf-dump$(exeext): $(JCFDUMP_OBJS) $(LIBDEPS)
103 +$(LINKER) $(ALL_LINKERFLAGS) $(LDFLAGS) -o $@ $(JCFDUMP_OBJS) \
104 $(CPPLIBS) $(ZLIB) $(LDEXP_LIB) $(LIBS)
106 jvgenmain$(exeext): $(JVGENMAIN_OBJS) $(LIBDEPS)
108 +$(LINKER) $(ALL_LINKERFLAGS) $(LDFLAGS) -o $@ $(JVGENMAIN_OBJS) \
114 java.all.cross: $(XGCJ)-cross$(exeext)
115 java.start.encap: $(XGCJ)$(exeext)
120 cd $(srcdir)/java; etags -o TAGS.sub *.c *.h --language=none \
121 --regex='/DEFTREECODE [(]\([A-Z_]+\)/\1/' java-tree.def; \
122 etags --include TAGS.sub --include ../TAGS.sub
125 java.info: doc/gcj.info
127 java.srcinfo: doc/gcj.info
128 -cp -p $^ $(srcdir)/doc
130 java.dvi: doc/gcj.dvi
132 JAVA_PDFFILES = doc/gcj.pdf
134 java.pdf: $(JAVA_PDFFILES)
136 JAVA_HTMLFILES = $(build_htmldir)/java
138 java.html: $(JAVA_HTMLFILES)/index.html
140 JAVA_MANFILES = doc/gcj.1 doc/jcf-dump.1 doc/gij.1 \
141 doc/jv-convert.1 doc/grmic.1 \
142 doc/gcj-dbtool.1 doc/gc-analyze.1 doc/aot-compile.1 \
145 java.man: $(JAVA_MANFILES)
147 java.srcman: $(JAVA_MANFILES)
148 -cp -p $^ $(srcdir)/doc
151 check-java-subtargets :
154 # jc1, gcj, and jvgenmain are installed elsewhere as part
157 # Install gcj as well as the target-independent tools.
158 java.install-common: installdirs
159 -if [ -f $(XGCJ)$(exeext) ]; then \
160 rm -f $(DESTDIR)$(bindir)/$(JAVA_INSTALL_NAME)$(exeext); \
161 $(INSTALL_PROGRAM) $(XGCJ)$(exeext) $(DESTDIR)$(bindir)/$(JAVA_INSTALL_NAME)$(exeext); \
162 chmod a+x $(DESTDIR)$(bindir)/$(JAVA_INSTALL_NAME)$(exeext); \
163 if [ -f $(XGCJ)-cross$(exeext) ]; then \
166 rm -f $(DESTDIR)$(bindir)/$(JAVA_TARGET_INSTALL_NAME)$(exeext); \
167 ( cd $(DESTDIR)$(bindir) && \
168 $(LN) $(JAVA_INSTALL_NAME)$(exeext) $(JAVA_TARGET_INSTALL_NAME)$(exeext) ); \
171 for tool in $(JAVA_TARGET_INDEPENDENT_BIN_TOOLS); do \
172 tool_transformed_name=`echo $$tool|sed '$(program_transform_name)'`; \
173 if [ -f $$tool$(exeext) ]; then \
174 rm -f $(DESTDIR)$(bindir)/$$tool_transformed_name$(exeext); \
175 $(INSTALL_PROGRAM) $$tool$(exeext) $(DESTDIR)$(bindir)/$$tool_transformed_name$(exeext); \
176 chmod a+x $(DESTDIR)$(bindir)/$$tool_transformed_name$(exeext); \
184 -rm -rf $(DESTDIR)$(bindir)/$(JAVA_INSTALL_NAME)$(exeext)
185 -rm -rf $(DESTDIR)$(man1dir)/$(JAVA_INSTALL_NAME)$(man1ext)
186 -rm -rf $(DESTDIR)$(man1dir)/jcf-dump$(man1ext)
187 -rm -rf $(DESTDIR)$(man1dir)/gij$(man1ext)
188 -rm -rf $(DESTDIR)$(man1dir)/jv-convert$(man1ext)
189 -rm -rf $(DESTDIR)$(man1dir)/gcj-dbtool$(man1ext)
190 -rm -rf $(DESTDIR)$(man1dir)/aot-compile$(man1ext)
191 -rm -rf $(DESTDIR)$(man1dir)/rebuild-gcj-db$(man1ext)
193 java.install-info: $(DESTDIR)$(infodir)/gcj.info
195 java.install-pdf: $(JAVA_PDFFILES)
197 test -z "$(pdfdir)" || $(mkinstalldirs) "$(DESTDIR)$(pdfdir)/gcc"
198 @list='$(JAVA_PDFFILES)'; for p in $$list; do \
199 if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
200 f=$(pdf__strip_dir) \
201 echo " $(INSTALL_DATA) '$$d$$p' '$(DESTDIR)$(pdfdir)/gcc/$$f'"; \
202 $(INSTALL_DATA) "$$d$$p" "$(DESTDIR)$(pdfdir)/gcc/$$f"; \
205 java.install-html: $(JAVA_HTMLFILES)
207 test -z "$(htmldir)" || $(mkinstalldirs) "$(DESTDIR)$(htmldir)"
208 @list='$(JAVA_HTMLFILES)'; for p in $$list; do \
209 if test -f "$$p" || test -d "$$p"; then d=""; else d="$(srcdir)/"; fi; \
210 f=$(html__strip_dir) \
211 if test -d "$$d$$p"; then \
212 echo " $(mkinstalldirs) '$(DESTDIR)$(htmldir)/$$f'"; \
213 $(mkinstalldirs) "$(DESTDIR)$(htmldir)/$$f" || exit 1; \
214 echo " $(INSTALL_DATA) '$$d$$p'/* '$(DESTDIR)$(htmldir)/$$f'"; \
215 $(INSTALL_DATA) "$$d$$p"/* "$(DESTDIR)$(htmldir)/$$f"; \
217 echo " $(INSTALL_DATA) '$$d$$p' '$(DESTDIR)$(htmldir)/$$f'"; \
218 $(INSTALL_DATA) "$$d$$p" "$(DESTDIR)$(htmldir)/$$f"; \
223 # A lot of the ancillary files are deleted by the main makefile.
224 # We just have to delete files specific to us.
227 -rm -f java/*$(objext) $(DEMANGLER_PROG)
228 -rm -f java/*$(coverageexts)
229 -rm -f jc1$(exeext) $(XGCJ)$(exeext) jvgenmain$(exeext) \
230 jcf-dump$(exeext) s-java
233 -rm -f java/config.status java/Makefile
234 java.maintainer-clean:
235 -rm -f $(docobjdir)/gcj.1
236 -rm -f $(docobjdir)/jcf-dump.1
237 -rm -f $(docobjdir)/gij.1
238 -rm -f $(docobjdir)/jv-convert.1
239 -rm -f $(docobjdir)/grmic.1
240 -rm -f $(docobjdir)/gcj-dbtool.1
241 -rm -f $(docobjdir)/gc-analyze.1
242 -rm -f $(docobjdir)/aot-compile.1
243 -rm -f $(docobjdir)/rebuild-gcj-db.1
246 # The main makefile has already created stage?/java.
248 java.stage1: stage1-start
249 -mv java/*$(objext) stage1/java
250 java.stage2: stage2-start
251 -mv java/*$(objext) stage2/java
252 java.stage3: stage3-start
253 -mv java/*$(objext) stage3/java
254 java.stage4: stage4-start
255 -mv java/*$(objext) stage4/java
256 java.stageprofile: stageprofile-start
257 -mv java/*$(objext) stageprofile/java
258 java.stagefeedback: stageprofile-start
259 -mv java/*$(objext) stagefeedback/java
263 # jcf-io.o needs $(ZLIBINC) added to cflags.
264 CFLAGS-java/jcf-io.o += $(ZLIBINC)
266 # jcf-path.o needs a -D.
267 CFLAGS-java/jcf-path.o += \
268 -DLIBGCJ_ZIP_FILE='"$(datadir)/java/libgcj-$(version).jar"' \
269 -DDEFAULT_TARGET_VERSION=\"$(version)\"
271 TEXI_JAVA_FILES = java/gcj.texi $(gcc_docdir)/include/fdl.texi \
272 $(gcc_docdir)/include/gpl_v3.texi $(gcc_docdir)/include/gcc-common.texi \
276 doc/gcj.info: $(TEXI_JAVA_FILES)
277 if test "x$(BUILD_INFO)" = xinfo; then \
278 rm -f doc/gcj.info*; \
279 $(MAKEINFO) $(MAKEINFOFLAGS) -I $(gcc_docdir) \
280 -I $(gcc_docdir)/include -o $@ $<; \
283 doc/gcj.dvi: $(TEXI_JAVA_FILES)
284 $(TEXI2DVI) -I $(abs_docdir) -I $(abs_docdir)/include -o $@ $<
286 doc/gcj.pdf: $(TEXI_JAVA_FILES)
287 $(TEXI2PDF) -I $(abs_docdir) -I $(abs_docdir)/include -o $@ $<
289 $(build_htmldir)/java/index.html: $(TEXI_JAVA_FILES)
290 $(mkinstalldirs) $(@D)
292 $(TEXI2HTML) -I $(gcc_docdir) -I $(gcc_docdir)/include \
293 -I $(srcdir)/java -o $(@D) $<
295 .INTERMEDIATE: gcj.pod jcf-dump.pod gij.pod \
296 jv-convert.pod grmic.pod gcj-dbtool.pod gc-analyze.pod
298 gcj.pod: java/gcj.texi
299 -$(TEXI2POD) -D gcj < $< > $@
300 jcf-dump.pod: java/gcj.texi
301 -$(TEXI2POD) -D jcf-dump < $< > $@
302 gij.pod: java/gcj.texi
303 -$(TEXI2POD) -D gij < $< > $@
304 jv-convert.pod: java/gcj.texi
305 -$(TEXI2POD) -D jv-convert < $< > $@
306 grmic.pod: java/gcj.texi
307 -$(TEXI2POD) -D grmic < $< > $@
308 gcj-dbtool.pod: java/gcj.texi
309 -$(TEXI2POD) -D gcj-dbtool < $< > $@
310 gc-analyze.pod: java/gcj.texi
311 -$(TEXI2POD) -D gc-analyze < $< > $@
312 aot-compile.pod: java/gcj.texi
313 -$(TEXI2POD) -D aot-compile < $< > $@
314 rebuild-gcj-db.pod: java/gcj.texi
315 -$(TEXI2POD) -D rebuild-gcj-db < $< > $@
317 # Install the man pages.
318 java.install-man: installdirs \
319 $(DESTDIR)$(man1dir)/$(JAVA_INSTALL_NAME)$(man1ext) \
320 $(JAVA_TARGET_INDEPENDENT_BIN_TOOLS:%=doc/%.1) \
321 doc/gij.1 doc/jv-convert.1 doc/grmic.1 \
322 doc/gcj-dbtool.1 doc/gc-analyze.1 \
323 doc/aot-compile.1 doc/rebuild-gcj-db.1
324 for tool in $(JAVA_TARGET_INDEPENDENT_BIN_TOOLS) \
325 gij jv-convert grmic gcj-dbtool gc-analyze aot-compile \
327 tool_transformed_name=`echo $$tool|sed '$(program_transform_name)'`; \
328 man_name=$(DESTDIR)$(man1dir)/$${tool_transformed_name}$(man1ext); \
330 for source_name in doc/$${tool}.1 $(srcdir)/doc/$${tool}.1 ; do \
331 if test -f $$source_name; then \
332 $(INSTALL_DATA) $$source_name $$man_name; \
337 chmod a-x $$man_name ; \
340 $(DESTDIR)$(man1dir)/$(JAVA_INSTALL_NAME)$(man1ext): doc/gcj.1 installdirs
342 -$(INSTALL_DATA) $< $@