1 # Top level -*- makefile -*- fragment for the GNU compiler for the Java(TM)
3 # Copyright (C) 1996, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
4 # 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
6 #This file is part of GCC.
8 #GCC is free software; you can redistribute it and/or modify
9 #it under the terms of the GNU General Public License as published by
10 #the Free Software Foundation; either version 3, or (at your option)
13 #GCC is distributed in the hope that it will be useful,
14 #but WITHOUT ANY WARRANTY; without even the implied warranty of
15 #MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 #GNU General Public License for more details.
18 #You should have received a copy of the GNU General Public License
19 #along with GCC; see the file COPYING3. If not see
20 #<http://www.gnu.org/licenses/>.
22 #Java and all Java-based marks are trademarks or registered trademarks
23 #of Sun Microsystems, Inc. in the United States and other countries.
24 #The Free Software Foundation is independent of Sun Microsystems, Inc.
26 # This file provides the language dependent support in the main Makefile.
27 # Each language makefile fragment must provide the following targets:
29 # foo.all.cross, foo.start.encap, foo.rest.encap,
30 # foo.install-common, foo.install-man, foo.install-info, foo.install-pdf,
31 # foo.info, foo.dvi, foo.pdf, foo.html, foo.uninstall,
32 # foo.mostlyclean, foo.clean, foo.distclean,
33 # foo.maintainer-clean, foo.stage1, foo.stage2, foo.stage3, foo.stage4
35 # where `foo' is the name of the language.
37 # It should also provide rules for:
39 # - making any compiler driver (eg: g++)
40 # - the compiler proper (eg: jc1)
41 # - define the names for selecting the language in LANGUAGES.
43 # Actual names to use when installing a native compiler.
44 JAVA_INSTALL_NAME := $(shell echo gcj|sed '$(program_transform_name)')
45 JAVA_TARGET_INSTALL_NAME := $(target_noncanonical)-$(shell echo gcj|sed '$(program_transform_name)')
49 # Define the names for selecting java in LANGUAGES.
50 java: jc1$(exeext) $(GCJ)$(exeext) jvgenmain$(exeext) jcf-dump$(exeext)
52 # Define the name of target independent tools to be installed in $(bindir)
53 # Names are subject to changes
54 JAVA_TARGET_INDEPENDENT_BIN_TOOLS = jcf-dump
56 # Tell GNU make to ignore these if they exist.
59 jvspec.o: $(srcdir)/java/jvspec.c $(SYSTEM_H) coretypes.h $(TM_H) \
61 (SHLIB_LINK='$(SHLIB_LINK)'; \
62 $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(DRIVER_DEFINES) \
63 $(INCLUDES) $(srcdir)/java/jvspec.c $(OUTPUT_OPTION))
65 # Create the compiler driver for $(GCJ).
66 $(GCJ)$(exeext): $(GCC_OBJS) jvspec.o java/jcf-path.o version.o \
67 prefix.o intl.o $(LIBDEPS) $(EXTRA_GCC_OBJS)
68 $(CC) $(ALL_CFLAGS) $(LDFLAGS) -o $@ $(GCC_OBJS) jvspec.o \
69 java/jcf-path.o prefix.o intl.o \
70 version.o $(EXTRA_GCC_OBJS) $(LIBS)
72 # Create a version of the $(GCJ) driver which calls the cross-compiler.
73 $(GCJ)-cross$(exeext): $(GCJ)$(exeext)
74 -rm -f $(GCJ)-cross$(exeext)
75 cp $(GCJ)$(exeext) $(GCJ)-cross$(exeext)
79 # Executables built by this Makefile:
80 JAVA_OBJS = java/class.o java/decl.o java/expr.o \
81 java/constants.o java/lang.o java/typeck.o java/except.o \
82 java/verify-glue.o java/verify-impl.o \
83 java/zextract.o java/jcf-io.o java/win32-host.o java/jcf-parse.o java/mangle.o \
84 java/mangle_name.o java/builtins.o java/resource.o \
86 java/jcf-path.o java/boehm.o java/java-gimplify.o
88 JCFDUMP_OBJS = java/jcf-dump.o java/jcf-io.o java/jcf-depend.o java/jcf-path.o \
89 java/win32-host.o java/zextract.o errors.o version.o ggc-none.o intl.o
91 JVGENMAIN_OBJS = java/jvgenmain.o java/mangle_name.o errors.o intl.o
93 java_OBJS = $(sort $(JAVA_OBJS) $(JCFDUMP_OBJS) $(JVGENMAIN_OBJS)) jvspec.o
95 # Use strict warnings for this front end.
96 java-warn = $(STRICT_WARN)
98 # String length warnings
99 jvspec.o-warn = -Wno-error
101 # Bison-1.75 output often yields (harmless) -Wtraditional warnings
102 java/parse.o-warn = -Wno-error
104 # java/jcf-io.c contains a -Wc++compat warning.
105 java/jcf-io.o-warn = -Wno-error
107 jc1$(exeext): $(JAVA_OBJS) $(BACKEND) $(LIBDEPS) attribs.o
109 $(CC) $(ALL_CFLAGS) $(LDFLAGS) -o $@ \
110 $(JAVA_OBJS) $(BACKEND) $(ZLIB) $(LIBICONV) $(LIBS) attribs.o $(GMPLIBS)
112 jcf-dump$(exeext): $(JCFDUMP_OBJS) $(LIBDEPS)
114 $(CC) $(ALL_CFLAGS) $(LDFLAGS) -o $@ $(JCFDUMP_OBJS) \
115 $(CPPLIBS) $(ZLIB) $(LDEXP_LIB) $(LIBS)
117 jvgenmain$(exeext): $(JVGENMAIN_OBJS) $(LIBDEPS)
119 $(CC) $(ALL_CFLAGS) $(LDFLAGS) -o $@ $(JVGENMAIN_OBJS) $(LIBS)
124 java.all.cross: $(GCJ)-cross$(exeext)
125 java.start.encap: $(GCJ)$(exeext)
130 cd $(srcdir)/java; etags -o TAGS.sub *.c *.h --language=none \
131 --regex='/DEFTREECODE [(]\([A-Z_]+\)/\1/' java-tree.def; \
132 etags --include TAGS.sub --include ../TAGS.sub
135 java.info: doc/gcj.info
137 java.srcinfo: doc/gcj.info
138 -cp -p $^ $(srcdir)/doc
140 java.dvi: doc/gcj.dvi
142 JAVA_PDFFILES = doc/gcj.pdf
144 java.pdf: $(JAVA_PDFFILES)
146 java.html: $(build_htmldir)/java/index.html
148 JAVA_MANFILES = doc/gcj.1 doc/jcf-dump.1 doc/gij.1 \
149 doc/jv-convert.1 doc/grmic.1 \
150 doc/gcj-dbtool.1 doc/gc-analyze.1 doc/aot-compile.1 \
153 java.man: $(JAVA_MANFILES)
155 java.srcman: $(JAVA_MANFILES)
156 -cp -p $^ $(srcdir)/doc
161 # jc1, gcj, and jvgenmain are installed elsewhere as part
164 # Install gcj as well as the target-independent tools.
165 java.install-common: installdirs
166 -if [ -f $(GCJ)$(exeext) ]; then \
167 rm -f $(DESTDIR)$(bindir)/$(JAVA_INSTALL_NAME)$(exeext); \
168 $(INSTALL_PROGRAM) $(GCJ)$(exeext) $(DESTDIR)$(bindir)/$(JAVA_INSTALL_NAME)$(exeext); \
169 chmod a+x $(DESTDIR)$(bindir)/$(JAVA_INSTALL_NAME)$(exeext); \
170 if [ -f $(GCJ)-cross$(exeext) ]; then \
173 rm -f $(DESTDIR)$(bindir)/$(JAVA_TARGET_INSTALL_NAME)$(exeext); \
174 ( cd $(DESTDIR)$(bindir) && \
175 $(LN) $(JAVA_INSTALL_NAME)$(exeext) $(JAVA_TARGET_INSTALL_NAME)$(exeext) ); \
178 for tool in $(JAVA_TARGET_INDEPENDENT_BIN_TOOLS); do \
179 tool_transformed_name=`echo $$tool|sed '$(program_transform_name)'`; \
180 if [ -f $$tool$(exeext) ]; then \
181 rm -f $(DESTDIR)$(bindir)/$$tool_transformed_name$(exeext); \
182 $(INSTALL_PROGRAM) $$tool$(exeext) $(DESTDIR)$(bindir)/$$tool_transformed_name$(exeext); \
183 chmod a+x $(DESTDIR)$(bindir)/$$tool_transformed_name$(exeext); \
190 -rm -rf $(DESTDIR)$(bindir)/$(JAVA_INSTALL_NAME)$(exeext)
191 -rm -rf $(DESTDIR)$(man1dir)/$(JAVA_INSTALL_NAME)$(man1ext)
192 -rm -rf $(DESTDIR)$(man1dir)/jcf-dump$(man1ext)
193 -rm -rf $(DESTDIR)$(man1dir)/gij$(man1ext)
194 -rm -rf $(DESTDIR)$(man1dir)/jv-convert$(man1ext)
195 -rm -rf $(DESTDIR)$(man1dir)/gcj-dbtool$(man1ext)
196 -rm -rf $(DESTDIR)$(man1dir)/aot-compile$(man1ext)
197 -rm -rf $(DESTDIR)$(man1dir)/rebuild-gcj-db$(man1ext)
199 java.install-info: $(DESTDIR)$(infodir)/gcj.info
201 java.install-pdf: $(JAVA_PDFFILES)
203 test -z "$(pdfdir)" || $(mkinstalldirs) "$(DESTDIR)$(pdfdir)"
204 @list='$(JAVA_PDFFILES)'; for p in $$list; do \
205 if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
206 f=$(pdf__strip_dir) \
207 echo " $(INSTALL_DATA) '$$d$$p' '$(DESTDIR)$(pdfdir)/$$f'"; \
208 $(INSTALL_DATA) "$$d$$p" "$(DESTDIR)$(pdfdir)/$$f"; \
213 # A lot of the ancillary files are deleted by the main makefile.
214 # We just have to delete files specific to us.
217 -rm -f java/*$(objext) $(DEMANGLER_PROG)
218 -rm -f java/*$(coverageexts)
219 -rm -f jc1$(exeext) $(GCJ)$(exeext) jvgenmain$(exeext) \
220 jcf-dump$(exeext) s-java
223 -rm -f java/config.status java/Makefile
224 java.maintainer-clean:
225 -rm -f $(docobjdir)/gcj.1
226 -rm -f $(docobjdir)/jcf-dump.1
227 -rm -f $(docobjdir)/gij.1
228 -rm -f $(docobjdir)/jv-convert.1
229 -rm -f $(docobjdir)/grmic.1
230 -rm -f $(docobjdir)/gcj-dbtool.1
231 -rm -f $(docobjdir)/gc-analyze.1
232 -rm -f $(docobjdir)/aot-compile.1
233 -rm -f $(docobjdir)/rebuild-gcj-db.1
236 # The main makefile has already created stage?/java.
238 java.stage1: stage1-start
239 -mv java/*$(objext) stage1/java
240 java.stage2: stage2-start
241 -mv java/*$(objext) stage2/java
242 java.stage3: stage3-start
243 -mv java/*$(objext) stage3/java
244 java.stage4: stage4-start
245 -mv java/*$(objext) stage4/java
246 java.stageprofile: stageprofile-start
247 -mv java/*$(objext) stageprofile/java
248 java.stagefeedback: stageprofile-start
249 -mv java/*$(objext) stagefeedback/java
252 # .o:.h dependencies.
253 JAVA_TREE_H = $(TREE_H) $(HASHTAB_H) java/java-tree.h
255 java/jcf-dump.o: $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(JAVA_TREE_H) \
256 java/jcf-dump.c java/jcf-reader.c java/jcf.h java/javaop.h java/javaop.def \
257 version.h $(GGC_H) intl.h java/zipfile.h
258 java/boehm.o: java/boehm.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
259 $(TREE_H) $(JAVA_TREE_H) java/parse.h toplev.h
260 java/builtins.o: java/builtins.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
261 $(JAVA_TREE_H) $(GGC_H) $(FLAGS_H) $(OPTABS_H) $(EXPR_H) langhooks.h \
263 java/class.o: java/class.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
264 $(JAVA_TREE_H) $(RTL_H) java/jcf.h java/parse.h toplev.h output.h $(GGC_H) \
265 $(TARGET_H) $(FUNCTION_H) gt-java-class.h $(CGRAPH_H)
266 java/constants.o: java/constants.c $(CONFIG_H) $(JAVA_TREE_H) java/jcf.h \
267 toplev.h $(SYSTEM_H) coretypes.h $(TM_H) $(GGC_H) gt-java-constants.h
268 java/decl.o: java/decl.c $(CONFIG_H) $(JAVA_TREE_H) $(RTL_H) java/jcf.h \
269 toplev.h $(FLAGS_H) $(SYSTEM_H) coretypes.h $(TM_H) $(FUNCTION_H) $(EXPR_H) \
270 libfuncs.h except.h java/java-except.h $(GGC_H) $(REAL_H) gt-java-decl.h \
271 $(TARGET_H) $(CGRAPH_H) langhooks.h
272 java/except.o: java/except.c $(CONFIG_H) $(JAVA_TREE_H) java/jcf.h $(REAL_H) \
273 $(RTL_H) java/javaop.h java/java-opcodes.h except.h java/java-except.h \
274 toplev.h $(SYSTEM_H) coretypes.h $(TM_H) $(FUNCTION_H)
275 java/expr.o: java/expr.c $(CONFIG_H) $(JAVA_TREE_H) java/jcf.h $(REAL_H) \
276 $(RTL_H) $(EXPR_H) java/javaop.h java/java-opcodes.h except.h \
277 java/java-except.h java/java-except.h java/parse.h toplev.h \
278 $(SYSTEM_H) coretypes.h $(TM_H) $(GGC_H) gt-java-expr.h $(TARGET_H)
279 java/jcf-depend.o: java/jcf-depend.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
281 java/jcf-parse.o: java/jcf-parse.c $(CONFIG_H) $(JAVA_TREE_H) $(FLAGS_H) \
282 input.h java/java-except.h $(SYSTEM_H) coretypes.h $(TM_H) toplev.h \
283 java/parse.h $(GGC_H) debug.h $(REAL_H) gt-java-jcf-parse.h $(TM_P_H) \
284 java/jcf-reader.c java/zipfile.h java/jcf.h
285 java/jvgenmain.o: java/jvgenmain.c $(CONFIG_H) $(JAVA_TREE_H) $(SYSTEM_H) \
286 coretypes.h $(TM_H) intl.h
287 java/lang.o: java/lang.c $(CONFIG_H) $(JAVA_TREE_H) java/jcf.h input.h \
288 toplev.h $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) $(EXPR_H) $(DIAGNOSTIC_H) \
289 langhooks.h $(LANGHOOKS_DEF_H) gt-java-lang.h opts.h options.h
290 java/mangle.o: java/mangle.c $(CONFIG_H) java/jcf.h $(JAVA_TREE_H) $(SYSTEM_H) \
291 coretypes.h $(TM_H) toplev.h $(GGC_H) gt-java-mangle.h $(LANGHOOKS_DEF_H)
292 java/mangle_name.o: java/mangle_name.c $(CONFIG_H) java/jcf.h $(JAVA_TREE_H) \
293 $(SYSTEM_H) coretypes.h $(TM_H) toplev.h $(GGC_H)
294 java/resource.o: java/resource.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
295 $(JAVA_TREE_H) $(RTL_H) java/jcf.h java/parse.h toplev.h output.h $(GGC_H) \
296 $(TARGET_H) $(FUNCTION_H) gt-java-resource.h $(EXPR_H)
297 java/typeck.o: java/typeck.c $(CONFIG_H) $(JAVA_TREE_H) java/jcf.h \
298 toplev.h $(SYSTEM_H) coretypes.h $(TM_H) $(GGC_H) $(REAL_H)
299 java/win32-host.o: java/win32-host.c $(CONFIG_H) $(SYSTEM_H) coretypes.h java/jcf.h
300 java/verify-glue.o: java/verify-glue.c $(CONFIG_H) $(SYSTEM_H) $(JAVA_TREE_H) \
301 coretypes.h $(TM_H) java/verify.h toplev.h
302 java/verify-impl.o: java/verify-impl.c $(CONFIG_H) java/verify.h $(SYSTEM_H) \
303 coretypes.h java/jcf.h $(JAVA_TREE_H)
304 java/zextract.o: java/zextract.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
306 java/java-gimplify.o: java/java-gimplify.c $(CONFIG_H) $(SYSTEM_H) \
307 coretypes.h $(TM_H) $(JAVA_TREE_H) $(TREE_GIMPLE_H) toplev.h
309 # jcf-io.o needs $(ZLIBINC) added to cflags.
310 java/jcf-io.o: java/jcf-io.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
311 $(JAVA_TREE_H) java/zipfile.h
312 $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $(ZLIBINC) \
313 $(srcdir)/java/jcf-io.c $(OUTPUT_OPTION)
315 # jcf-path.o needs a -D.
316 java/jcf-path.o: java/jcf-path.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
318 $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \
319 -DLIBGCJ_ZIP_FILE='"$(datadir)/java/libgcj-$(version).jar"' \
320 -DDEFAULT_TARGET_VERSION=\"$(version)\" \
321 $(srcdir)/java/jcf-path.c $(OUTPUT_OPTION)
323 TEXI_JAVA_FILES = java/gcj.texi $(gcc_docdir)/include/fdl.texi \
324 $(gcc_docdir)/include/gpl_v3.texi $(gcc_docdir)/include/gcc-common.texi \
328 doc/gcj.info: $(TEXI_JAVA_FILES)
329 if test "x$(BUILD_INFO)" = xinfo; then \
330 rm -f doc/gcj.info*; \
331 $(MAKEINFO) $(MAKEINFOFLAGS) -I $(gcc_docdir) \
332 -I $(gcc_docdir)/include -o $@ $<; \
335 doc/gcj.dvi: $(TEXI_JAVA_FILES)
336 $(TEXI2DVI) -I $(abs_docdir) -I $(abs_docdir)/include -o $@ $<
338 doc/gcj.pdf: $(TEXI_JAVA_FILES)
339 $(TEXI2PDF) -I $(abs_docdir) -I $(abs_docdir)/include -o $@ $<
341 $(build_htmldir)/java/index.html: $(TEXI_JAVA_FILES)
342 $(mkinstalldirs) $(@D)
344 $(TEXI2HTML) -I $(gcc_docdir) -I $(gcc_docdir)/include \
345 -I $(srcdir)/java -o $(@D) $<
347 .INTERMEDIATE: gcj.pod jcf-dump.pod gij.pod \
348 jv-convert.pod grmic.pod gcj-dbtool.pod gc-analyze.pod
350 gcj.pod: java/gcj.texi
351 -$(TEXI2POD) -D gcj < $< > $@
352 jcf-dump.pod: java/gcj.texi
353 -$(TEXI2POD) -D jcf-dump < $< > $@
354 gij.pod: java/gcj.texi
355 -$(TEXI2POD) -D gij < $< > $@
356 jv-convert.pod: java/gcj.texi
357 -$(TEXI2POD) -D jv-convert < $< > $@
358 grmic.pod: java/gcj.texi
359 -$(TEXI2POD) -D grmic < $< > $@
360 gcj-dbtool.pod: java/gcj.texi
361 -$(TEXI2POD) -D gcj-dbtool < $< > $@
362 gc-analyze.pod: java/gcj.texi
363 -$(TEXI2POD) -D gc-analyze < $< > $@
364 aot-compile.pod: java/gcj.texi
365 -$(TEXI2POD) -D aot-compile < $< > $@
366 rebuild-gcj-db.pod: java/gcj.texi
367 -$(TEXI2POD) -D rebuild-gcj-db < $< > $@
369 # Install the man pages.
370 java.install-man: installdirs \
371 $(DESTDIR)$(man1dir)/$(JAVA_INSTALL_NAME)$(man1ext) \
372 $(JAVA_TARGET_INDEPENDENT_BIN_TOOLS:%=doc/%.1) \
373 doc/gij.1 doc/jv-convert.1 doc/grmic.1 \
374 doc/gcj-dbtool.1 doc/gc-analyze.1 \
375 doc/aot-compile.1 doc/rebuild-gcj-db.1
376 for tool in $(JAVA_TARGET_INDEPENDENT_BIN_TOOLS) \
377 gij jv-convert grmic gcj-dbtool gc-analyze aot-compile \
379 tool_transformed_name=`echo $$tool|sed '$(program_transform_name)'`; \
380 man_name=$(DESTDIR)$(man1dir)/$${tool_transformed_name}$(man1ext); \
382 for source_name in doc/$${tool}.1 $(srcdir)/doc/$${tool}.1 ; do \
383 if test -f $$source_name; then \
384 $(INSTALL_DATA) $$source_name $$man_name; \
389 chmod a-x $$man_name ; \
392 $(DESTDIR)$(man1dir)/$(JAVA_INSTALL_NAME)$(man1ext): doc/gcj.1 installdirs
394 -$(INSTALL_DATA) $< $@