1 # Top level -*- makefile -*- fragment for the GNU compiler for the Java(TM)
3 # Copyright (C) 1996-2013 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 jvspec.o: $(srcdir)/java/jvspec.c $(SYSTEM_H) coretypes.h $(TM_H) \
59 $(GCC_H) $(CONFIG_H) java/jcf.h java/javaop.h $(OPTS_H)
61 $(COMPILER) -c $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) $(DRIVER_DEFINES) \
62 $(INCLUDES) $(srcdir)/java/jvspec.c $(OUTPUT_OPTION))
64 # Create the compiler driver for $(XGCJ).
65 $(XGCJ)$(exeext): $(GCC_OBJS) jvspec.o java/jcf-path.o \
66 libcommon-target.a $(LIBDEPS) $(EXTRA_GCC_OBJS)
67 +$(LINKER) $(ALL_LINKERFLAGS) $(LDFLAGS) -o $@ $(GCC_OBJS) \
68 jvspec.o java/jcf-path.o $(EXTRA_GCC_OBJS) libcommon-target.a \
69 $(EXTRA_GCC_LIBS) $(LIBS)
71 # Create a version of the $(XGCJ) driver which calls the cross-compiler.
72 $(XGCJ)-cross$(exeext): $(XGCJ)$(exeext)
73 -rm -f $(XGCJ)-cross$(exeext)
74 cp $(XGCJ)$(exeext) $(XGCJ)-cross$(exeext)
78 # Executables built by this Makefile:
79 JAVA_OBJS = java/class.o java/decl.o java/expr.o \
80 java/constants.o java/lang.o java/typeck.o java/except.o \
81 java/verify-glue.o java/verify-impl.o \
82 java/zextract.o java/jcf-io.o java/win32-host.o java/jcf-parse.o java/mangle.o \
83 java/mangle_name.o java/builtins.o java/resource.o \
85 java/jcf-path.o java/boehm.o java/java-gimplify.o hash-table.o
87 JCFDUMP_OBJS = java/jcf-dump.o java/jcf-io.o java/jcf-depend.o java/jcf-path.o \
88 java/win32-host.o java/zextract.o ggc-none.o hash-table.o
90 JVGENMAIN_OBJS = java/jvgenmain.o java/mangle_name.o
92 java_OBJS = $(sort $(JAVA_OBJS) $(JCFDUMP_OBJS) $(JVGENMAIN_OBJS)) jvspec.o
94 # Use strict warnings for this front end.
95 java-warn = $(STRICT_WARN)
97 # String length warnings
98 jvspec.o-warn = -Wno-error
100 jc1$(exeext): $(JAVA_OBJS) $(BACKEND) $(LIBDEPS) attribs.o
102 +$(LINKER) $(ALL_LINKERFLAGS) $(LDFLAGS) -o $@ \
103 $(JAVA_OBJS) $(BACKEND) $(ZLIB) $(LIBICONV) $(LIBS) attribs.o $(BACKENDLIBS)
105 jcf-dump$(exeext): $(JCFDUMP_OBJS) $(LIBDEPS)
107 +$(LINKER) $(ALL_LINKERFLAGS) $(LDFLAGS) -o $@ $(JCFDUMP_OBJS) \
108 $(CPPLIBS) $(ZLIB) $(LDEXP_LIB) $(LIBS)
110 jvgenmain$(exeext): $(JVGENMAIN_OBJS) $(LIBDEPS)
112 +$(LINKER) $(ALL_LINKERFLAGS) $(LDFLAGS) -o $@ $(JVGENMAIN_OBJS) \
118 java.all.cross: $(XGCJ)-cross$(exeext)
119 java.start.encap: $(XGCJ)$(exeext)
124 cd $(srcdir)/java; etags -o TAGS.sub *.c *.h --language=none \
125 --regex='/DEFTREECODE [(]\([A-Z_]+\)/\1/' java-tree.def; \
126 etags --include TAGS.sub --include ../TAGS.sub
129 java.info: doc/gcj.info
131 java.srcinfo: doc/gcj.info
132 -cp -p $^ $(srcdir)/doc
134 java.dvi: doc/gcj.dvi
136 JAVA_PDFFILES = doc/gcj.pdf
138 java.pdf: $(JAVA_PDFFILES)
140 JAVA_HTMLFILES = $(build_htmldir)/java
142 java.html: $(JAVA_HTMLFILES)/index.html
144 JAVA_MANFILES = doc/gcj.1 doc/jcf-dump.1 doc/gij.1 \
145 doc/jv-convert.1 doc/grmic.1 \
146 doc/gcj-dbtool.1 doc/gc-analyze.1 doc/aot-compile.1 \
149 java.man: $(JAVA_MANFILES)
151 java.srcman: $(JAVA_MANFILES)
152 -cp -p $^ $(srcdir)/doc
155 check-java-subtargets :
158 # jc1, gcj, and jvgenmain are installed elsewhere as part
161 # Install gcj as well as the target-independent tools.
162 java.install-common: installdirs
163 -if [ -f $(XGCJ)$(exeext) ]; then \
164 rm -f $(DESTDIR)$(bindir)/$(JAVA_INSTALL_NAME)$(exeext); \
165 $(INSTALL_PROGRAM) $(XGCJ)$(exeext) $(DESTDIR)$(bindir)/$(JAVA_INSTALL_NAME)$(exeext); \
166 chmod a+x $(DESTDIR)$(bindir)/$(JAVA_INSTALL_NAME)$(exeext); \
167 if [ -f $(XGCJ)-cross$(exeext) ]; then \
170 rm -f $(DESTDIR)$(bindir)/$(JAVA_TARGET_INSTALL_NAME)$(exeext); \
171 ( cd $(DESTDIR)$(bindir) && \
172 $(LN) $(JAVA_INSTALL_NAME)$(exeext) $(JAVA_TARGET_INSTALL_NAME)$(exeext) ); \
175 for tool in $(JAVA_TARGET_INDEPENDENT_BIN_TOOLS); do \
176 tool_transformed_name=`echo $$tool|sed '$(program_transform_name)'`; \
177 if [ -f $$tool$(exeext) ]; then \
178 rm -f $(DESTDIR)$(bindir)/$$tool_transformed_name$(exeext); \
179 $(INSTALL_PROGRAM) $$tool$(exeext) $(DESTDIR)$(bindir)/$$tool_transformed_name$(exeext); \
180 chmod a+x $(DESTDIR)$(bindir)/$$tool_transformed_name$(exeext); \
188 -rm -rf $(DESTDIR)$(bindir)/$(JAVA_INSTALL_NAME)$(exeext)
189 -rm -rf $(DESTDIR)$(man1dir)/$(JAVA_INSTALL_NAME)$(man1ext)
190 -rm -rf $(DESTDIR)$(man1dir)/jcf-dump$(man1ext)
191 -rm -rf $(DESTDIR)$(man1dir)/gij$(man1ext)
192 -rm -rf $(DESTDIR)$(man1dir)/jv-convert$(man1ext)
193 -rm -rf $(DESTDIR)$(man1dir)/gcj-dbtool$(man1ext)
194 -rm -rf $(DESTDIR)$(man1dir)/aot-compile$(man1ext)
195 -rm -rf $(DESTDIR)$(man1dir)/rebuild-gcj-db$(man1ext)
197 java.install-info: $(DESTDIR)$(infodir)/gcj.info
199 java.install-pdf: $(JAVA_PDFFILES)
201 test -z "$(pdfdir)" || $(mkinstalldirs) "$(DESTDIR)$(pdfdir)/gcc"
202 @list='$(JAVA_PDFFILES)'; for p in $$list; do \
203 if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
204 f=$(pdf__strip_dir) \
205 echo " $(INSTALL_DATA) '$$d$$p' '$(DESTDIR)$(pdfdir)/gcc/$$f'"; \
206 $(INSTALL_DATA) "$$d$$p" "$(DESTDIR)$(pdfdir)/gcc/$$f"; \
209 java.install-html: $(JAVA_HTMLFILES)
211 test -z "$(htmldir)" || $(mkinstalldirs) "$(DESTDIR)$(htmldir)"
212 @list='$(JAVA_HTMLFILES)'; for p in $$list; do \
213 if test -f "$$p" || test -d "$$p"; then d=""; else d="$(srcdir)/"; fi; \
214 f=$(html__strip_dir) \
215 if test -d "$$d$$p"; then \
216 echo " $(mkinstalldirs) '$(DESTDIR)$(htmldir)/$$f'"; \
217 $(mkinstalldirs) "$(DESTDIR)$(htmldir)/$$f" || exit 1; \
218 echo " $(INSTALL_DATA) '$$d$$p'/* '$(DESTDIR)$(htmldir)/$$f'"; \
219 $(INSTALL_DATA) "$$d$$p"/* "$(DESTDIR)$(htmldir)/$$f"; \
221 echo " $(INSTALL_DATA) '$$d$$p' '$(DESTDIR)$(htmldir)/$$f'"; \
222 $(INSTALL_DATA) "$$d$$p" "$(DESTDIR)$(htmldir)/$$f"; \
227 # A lot of the ancillary files are deleted by the main makefile.
228 # We just have to delete files specific to us.
231 -rm -f java/*$(objext) $(DEMANGLER_PROG)
232 -rm -f java/*$(coverageexts)
233 -rm -f jc1$(exeext) $(XGCJ)$(exeext) jvgenmain$(exeext) \
234 jcf-dump$(exeext) s-java
237 -rm -f java/config.status java/Makefile
238 java.maintainer-clean:
239 -rm -f $(docobjdir)/gcj.1
240 -rm -f $(docobjdir)/jcf-dump.1
241 -rm -f $(docobjdir)/gij.1
242 -rm -f $(docobjdir)/jv-convert.1
243 -rm -f $(docobjdir)/grmic.1
244 -rm -f $(docobjdir)/gcj-dbtool.1
245 -rm -f $(docobjdir)/gc-analyze.1
246 -rm -f $(docobjdir)/aot-compile.1
247 -rm -f $(docobjdir)/rebuild-gcj-db.1
250 # The main makefile has already created stage?/java.
252 java.stage1: stage1-start
253 -mv java/*$(objext) stage1/java
254 java.stage2: stage2-start
255 -mv java/*$(objext) stage2/java
256 java.stage3: stage3-start
257 -mv java/*$(objext) stage3/java
258 java.stage4: stage4-start
259 -mv java/*$(objext) stage4/java
260 java.stageprofile: stageprofile-start
261 -mv java/*$(objext) stageprofile/java
262 java.stagefeedback: stageprofile-start
263 -mv java/*$(objext) stagefeedback/java
266 # .o:.h dependencies.
267 JAVA_TREE_H = $(TREE_H) $(HASHTAB_H) java/java-tree.h
269 java/jcf-dump.o: $(CONFIG_H) $(SYSTEM_H) coretypes.h $(JAVA_TREE_H) \
270 java/jcf-dump.c java/jcf-reader.c java/jcf.h java/javaop.h java/javaop.def \
271 version.h $(GGC_H) intl.h java/zipfile.h $(DIAGNOSTIC_H)
272 java/boehm.o: java/boehm.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
273 $(TREE_H) $(JAVA_TREE_H) java/parse.h
274 java/builtins.o: java/builtins.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
275 $(JAVA_TREE_H) $(GGC_H) $(FLAGS_H) $(OPTABS_H) $(EXPR_H) langhooks.h \
277 java/class.o: java/class.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
278 $(JAVA_TREE_H) java/jcf.h java/parse.h toplev.h output.h $(GGC_H) \
279 $(FUNCTION_H) gt-java-class.h
280 java/constants.o: java/constants.c $(CONFIG_H) $(JAVA_TREE_H) java/jcf.h \
281 toplev.h $(SYSTEM_H) coretypes.h $(TM_H) $(GGC_H) gt-java-constants.h
282 java/decl.o: java/decl.c $(CONFIG_H) $(JAVA_TREE_H) java/jcf.h \
283 toplev.h $(FLAGS_H) $(SYSTEM_H) coretypes.h $(TM_H) \
284 java/java-except.h $(GGC_H) $(REAL_H) gt-java-decl.h \
285 $(TARGET_H) $(CGRAPH_H) langhooks.h
286 java/except.o: java/except.c $(CONFIG_H) $(JAVA_TREE_H) java/jcf.h $(REAL_H) \
287 java/javaop.h java/java-opcodes.h java/java-except.h \
288 toplev.h $(SYSTEM_H) coretypes.h
289 java/expr.o: java/expr.c $(CONFIG_H) $(JAVA_TREE_H) java/jcf.h $(REAL_H) \
290 java/javaop.h java/java-opcodes.h \
291 java/java-except.h java/java-except.h java/parse.h \
292 $(SYSTEM_H) coretypes.h $(TM_H) $(GGC_H) gt-java-expr.h $(TARGET_H) \
294 java/jcf-depend.o: java/jcf-depend.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
296 java/jcf-parse.o: java/jcf-parse.c $(CONFIG_H) $(JAVA_TREE_H) $(FLAGS_H) \
297 input.h java/java-except.h $(SYSTEM_H) coretypes.h \
298 java/parse.h $(GGC_H) debug.h $(REAL_H) gt-java-jcf-parse.h \
299 java/jcf-reader.c java/zipfile.h java/jcf.h $(BITMAP_H)
300 java/jvgenmain.o: java/jvgenmain.c $(CONFIG_H) $(JAVA_TREE_H) $(SYSTEM_H) \
301 coretypes.h $(TM_H) intl.h $(DIAGNOSTIC_H)
302 java/lang.o: java/lang.c $(CONFIG_H) $(JAVA_TREE_H) java/jcf.h input.h \
303 $(SYSTEM_H) coretypes.h $(TM_H) $(DIAGNOSTIC_H) \
304 langhooks.h $(LANGHOOKS_DEF_H) gt-java-lang.h $(OPTS_H) $(OPTIONS_H) \
306 java/mangle.o: java/mangle.c $(CONFIG_H) java/jcf.h $(JAVA_TREE_H) $(SYSTEM_H) \
307 coretypes.h $(TM_H) $(GGC_H) gt-java-mangle.h $(LANGHOOKS_DEF_H)
308 java/mangle_name.o: java/mangle_name.c $(CONFIG_H) java/jcf.h $(JAVA_TREE_H) \
309 $(SYSTEM_H) coretypes.h $(GGC_H)
310 java/resource.o: java/resource.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
311 $(JAVA_TREE_H) java/jcf.h java/parse.h toplev.h $(GGC_H) \
312 $(TARGET_H) $(FUNCTION_H) gt-java-resource.h
313 java/typeck.o: java/typeck.c $(CONFIG_H) $(JAVA_TREE_H) java/jcf.h \
314 $(SYSTEM_H) coretypes.h $(GGC_H) $(REAL_H)
315 java/win32-host.o: java/win32-host.c $(CONFIG_H) $(SYSTEM_H) coretypes.h java/jcf.h
316 java/verify-glue.o: java/verify-glue.c $(CONFIG_H) $(SYSTEM_H) $(JAVA_TREE_H) \
317 coretypes.h java/verify.h
318 java/verify-impl.o: java/verify-impl.c $(CONFIG_H) java/verify.h $(SYSTEM_H) \
319 coretypes.h java/jcf.h $(JAVA_TREE_H)
320 java/zextract.o: java/zextract.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
322 java/java-gimplify.o: java/java-gimplify.c $(CONFIG_H) $(SYSTEM_H) \
323 coretypes.h dumpfile.h $(JAVA_TREE_H) $(GIMPLE_H)
325 # jcf-io.o needs $(ZLIBINC) added to cflags.
326 CFLAGS-java/jcf-io.o += $(ZLIBINC)
327 java/jcf-io.o: java/jcf-io.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
328 $(JAVA_TREE_H) java/zipfile.h $(HASH_TABLE_H)
330 # jcf-path.o needs a -D.
331 CFLAGS-java/jcf-path.o += \
332 -DLIBGCJ_ZIP_FILE='"$(datadir)/java/libgcj-$(version).jar"' \
333 -DDEFAULT_TARGET_VERSION=\"$(version)\"
334 java/jcf-path.o: java/jcf-path.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
337 TEXI_JAVA_FILES = java/gcj.texi $(gcc_docdir)/include/fdl.texi \
338 $(gcc_docdir)/include/gpl_v3.texi $(gcc_docdir)/include/gcc-common.texi \
342 doc/gcj.info: $(TEXI_JAVA_FILES)
343 if test "x$(BUILD_INFO)" = xinfo; then \
344 rm -f doc/gcj.info*; \
345 $(MAKEINFO) $(MAKEINFOFLAGS) -I $(gcc_docdir) \
346 -I $(gcc_docdir)/include -o $@ $<; \
349 doc/gcj.dvi: $(TEXI_JAVA_FILES)
350 $(TEXI2DVI) -I $(abs_docdir) -I $(abs_docdir)/include -o $@ $<
352 doc/gcj.pdf: $(TEXI_JAVA_FILES)
353 $(TEXI2PDF) -I $(abs_docdir) -I $(abs_docdir)/include -o $@ $<
355 $(build_htmldir)/java/index.html: $(TEXI_JAVA_FILES)
356 $(mkinstalldirs) $(@D)
358 $(TEXI2HTML) -I $(gcc_docdir) -I $(gcc_docdir)/include \
359 -I $(srcdir)/java -o $(@D) $<
361 .INTERMEDIATE: gcj.pod jcf-dump.pod gij.pod \
362 jv-convert.pod grmic.pod gcj-dbtool.pod gc-analyze.pod
364 gcj.pod: java/gcj.texi
365 -$(TEXI2POD) -D gcj < $< > $@
366 jcf-dump.pod: java/gcj.texi
367 -$(TEXI2POD) -D jcf-dump < $< > $@
368 gij.pod: java/gcj.texi
369 -$(TEXI2POD) -D gij < $< > $@
370 jv-convert.pod: java/gcj.texi
371 -$(TEXI2POD) -D jv-convert < $< > $@
372 grmic.pod: java/gcj.texi
373 -$(TEXI2POD) -D grmic < $< > $@
374 gcj-dbtool.pod: java/gcj.texi
375 -$(TEXI2POD) -D gcj-dbtool < $< > $@
376 gc-analyze.pod: java/gcj.texi
377 -$(TEXI2POD) -D gc-analyze < $< > $@
378 aot-compile.pod: java/gcj.texi
379 -$(TEXI2POD) -D aot-compile < $< > $@
380 rebuild-gcj-db.pod: java/gcj.texi
381 -$(TEXI2POD) -D rebuild-gcj-db < $< > $@
383 # Install the man pages.
384 java.install-man: installdirs \
385 $(DESTDIR)$(man1dir)/$(JAVA_INSTALL_NAME)$(man1ext) \
386 $(JAVA_TARGET_INDEPENDENT_BIN_TOOLS:%=doc/%.1) \
387 doc/gij.1 doc/jv-convert.1 doc/grmic.1 \
388 doc/gcj-dbtool.1 doc/gc-analyze.1 \
389 doc/aot-compile.1 doc/rebuild-gcj-db.1
390 for tool in $(JAVA_TARGET_INDEPENDENT_BIN_TOOLS) \
391 gij jv-convert grmic gcj-dbtool gc-analyze aot-compile \
393 tool_transformed_name=`echo $$tool|sed '$(program_transform_name)'`; \
394 man_name=$(DESTDIR)$(man1dir)/$${tool_transformed_name}$(man1ext); \
396 for source_name in doc/$${tool}.1 $(srcdir)/doc/$${tool}.1 ; do \
397 if test -f $$source_name; then \
398 $(INSTALL_DATA) $$source_name $$man_name; \
403 chmod a-x $$man_name ; \
406 $(DESTDIR)$(man1dir)/$(JAVA_INSTALL_NAME)$(man1ext): doc/gcj.1 installdirs
408 -$(INSTALL_DATA) $< $@