1 # Top level makefile fragment for the GNU compiler for the Java(TM)
3 # Copyright (C) 1996, 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
5 #This file is part of GNU CC.
7 #GNU CC 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 2, or (at your option)
12 #GNU CC 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 GNU CC; see the file COPYING. If not, write to
19 #the Free Software Foundation, 59 Temple Place - Suite 330,
20 #Boston, MA 02111-1307, USA.
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.build, foo.all.cross, foo.start.encap, foo.rest.encap,
31 # foo.install-normal, foo.install-common, foo.install-info, foo.install-man,
33 # foo.mostlyclean, foo.clean, foo.distclean, foo.extraclean,
34 # foo.maintainer-clean, foo.stage1, foo.stage2, foo.stage3, foo.stage4
36 # where `foo' is the name of the language.
38 # It should also provide rules for:
40 # - making any compiler driver (eg: g++)
41 # - the compiler proper (eg: jc1)
42 # - define the names for selecting the language in LANGUAGES.
44 # Actual names to use when installing a native compiler.
45 JAVA_INSTALL_NAME = `t='$(program_transform_name)'; echo gcj | sed $$t`
47 # Actual names to use when installing a cross-compiler.
48 JAVA_CROSS_NAME = `t='$(program_transform_cross_name)'; echo gcj | sed $$t`
52 # Define the names for selecting java in LANGUAGES.
53 java: jc1$(exeext) $(GCJ)$(exeext) jvgenmain$(exeext) \
54 gcjh$(exeext) jv-scan$(exeext) jcf-dump$(exeext)
56 # Define the name of target independant tools to be installed in $(bindir)
57 # Names are subject to changes
58 JAVA_TARGET_INDEPENDENT_BIN_TOOLS = gcjh jv-scan jcf-dump
60 # Tell GNU make to ignore these if they exist.
63 jvspec.o: $(srcdir)/java/jvspec.c $(SYSTEM_H) $(GCC_H) $(CONFIG_H)
64 (SHLIB_LINK='$(SHLIB_LINK)' \
65 SHLIB_MULTILIB='$(SHLIB_MULTILIB)'; \
66 $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(DRIVER_DEFINES) \
67 $(INCLUDES) $(srcdir)/java/jvspec.c)
69 # Create the compiler driver for $(GCJ).
70 $(GCJ)$(exeext): gcc.o jvspec.o version.o \
71 prefix.o intl.o $(LIBDEPS) $(EXTRA_GCC_OBJS)
72 $(CC) $(ALL_CFLAGS) $(LDFLAGS) -o $@ gcc.o jvspec.o prefix.o intl.o \
73 version.o $(EXTRA_GCC_OBJS) $(LIBS)
75 # Create a version of the $(GCJ) driver which calls the cross-compiler.
76 $(GCJ)-cross$(exeext): $(GCJ)$(exeext)
77 -rm -f $(GCJ)-cross$(exeext)
78 cp $(GCJ)$(exeext) $(GCJ)-cross$(exeext)
80 $(INTL_TARGETS): $(srcdir)/java/parse.c $(srcdir)/java/parse-scan.c
82 $(srcdir)/java/parse.c: $(srcdir)/java/parse.y
83 $(BISON) -t --name-prefix=java_ $(BISONFLAGS) \
84 -o p$$$$.c $(srcdir)/java/parse.y && \
85 mv -f p$$$$.c $(srcdir)/java/parse.c
87 $(srcdir)/java/parse-scan.c: $(srcdir)/java/parse-scan.y
88 $(BISON) -t $(BISONFLAGS) -o ps$$$$.c $(srcdir)/java/parse-scan.y && \
89 mv -f ps$$$$.c $(srcdir)/java/parse-scan.c
91 $(srcdir)/java/keyword.h: $(srcdir)/java/keyword.gperf
92 (cd $(srcdir)/java || exit 1; \
93 gperf -L C -F ', 0' -p -t -j1 -i 1 -g -o -N java_keyword -k1,4,$$ \
94 keyword.gperf > k$$$$.h || { \
95 echo "Please update gperf from ftp://ftp.gnu.org/pub/gnu/gperf/" >&2; \
98 mv -f k$$$$.h keyword.h)
100 # Executables built by this Makefile:
101 JAVA_OBJS = java/parse.o java/class.o java/decl.o java/expr.o \
102 java/constants.o java/lang.o java/typeck.o java/except.o java/verify.o \
103 java/zextract.o java/jcf-io.o java/jcf-parse.o java/mangle.o \
105 java/jcf-write.o java/buffer.o java/check-init.o java/jcf-depend.o \
106 java/jcf-path.o java/xref.o java/boehm.o mkdeps.o
108 GCJH_OBJS = java/gjavah.o java/jcf-io.o java/jcf-depend.o java/jcf-path.o \
109 java/zextract.o version.o mkdeps.o errors.o
111 JVSCAN_OBJS = java/parse-scan.o java/jv-scan.o version.o
113 JCFDUMP_OBJS = java/jcf-dump.o java/jcf-io.o java/jcf-depend.o java/jcf-path.o \
114 java/zextract.o errors.o version.o mkdeps.o
116 JVGENMAIN_OBJS = java/jvgenmain.o java/mangle_name.o errors.o
118 # Use loose warnings for this front end.
121 jc1$(exeext): $(JAVA_OBJS) $(BACKEND) $(LIBDEPS)
123 $(CC) $(ALL_CFLAGS) $(LDFLAGS) -o $@ \
124 $(JAVA_OBJS) $(BACKEND) $(ZLIB) $(LIBICONV) $(LIBS)
126 gcjh$(exeext): $(GCJH_OBJS) $(LIBDEPS)
128 $(CC) $(ALL_CFLAGS) $(LDFLAGS) -o $@ $(GCJH_OBJS) $(ZLIB) $(LIBS)
130 jv-scan$(exeext): $(JVSCAN_OBJS) $(LIBDEPS)
132 $(CC) $(ALL_CFLAGS) $(LDFLAGS) -o $@ $(JVSCAN_OBJS) $(LIBICONV) $(LIBS)
134 jcf-dump$(exeext): $(JCFDUMP_OBJS) $(LIBDEPS)
136 $(CC) $(ALL_CFLAGS) $(LDFLAGS) -o $@ $(JCFDUMP_OBJS) $(ZLIB) $(LIBS)
138 jvgenmain$(exeext): $(JVGENMAIN_OBJS) $(LIBDEPS)
140 $(CC) $(ALL_CFLAGS) $(LDFLAGS) -o $@ $(JVGENMAIN_OBJS) $(LIBS)
145 java.all.build: $(GCJ)$(exeext)
146 java.all.cross: $(GCJ)-cross$(exeext)
147 java.start.encap: $(GCJ)$(exeext)
150 java.info: $(srcdir)/java/gcj.info
151 java.dvi: java/gcj.dvi
154 # jc1, gcj, jvgenmain, and gcjh are installed elsewhere as part
157 # Nothing to do here.
160 java.install-common: installdirs
161 -if [ -f $(GCJ)$(exeext) ]; then \
162 if [ -f $(GCJ)-cross$(exeext) ]; then \
163 rm -f $(bindir)/$(JAVA_CROSS_NAME)$(exeext); \
164 $(INSTALL_PROGRAM) $(GCJ)-cross$(exeext) $(bindir)/$(JAVA_CROSS_NAME)$(exeext); \
165 chmod a+x $(bindir)/$(JAVA_CROSS_NAME)$(exeext); \
167 rm -f $(bindir)/$(JAVA_INSTALL_NAME)$(exeext); \
168 $(INSTALL_PROGRAM) $(GCJ)$(exeext) $(bindir)/$(JAVA_INSTALL_NAME)$(exeext); \
169 chmod a+x $(bindir)/$(JAVA_INSTALL_NAME)$(exeext); \
172 for tool in $(JAVA_TARGET_INDEPENDENT_BIN_TOOLS); do \
173 if [ -f $$tool$(exeext) ]; then \
174 rm -f $(bindir)/$$tool$(exeext); \
175 $(INSTALL_PROGRAM) $$tool$(exeext) $(bindir)/$$tool$(exeext); \
176 chmod a+x $(bindir)/$$tool$(exeext); \
183 -rm -rf $(bindir)/$(JAVA_INSTALL_NAME)$(exeext)
184 -rm -rf $(bindir)/$(JAVA_CROSS_NAME)$(exeext)
186 java.install-info: installdirs
187 if [ -f jc1$(exeext) ] ; then \
188 if [ -f $(srcdir)/java/gcj.info ]; then \
189 rm -f $(infodir)/gcj.info*; \
190 for f in $(srcdir)/java/gcj.info*; do \
191 realfile=`echo $$f | sed -e 's|.*/\([^/]*\)$$|\1|'`; \
192 $(INSTALL_DATA) $$f $(infodir)/$$realfile; \
194 chmod a-x $(infodir)/gcj.info*; \
197 -if [ -f jc1$(exeext) ] && [ -f $(infodir)/gcj.info ]; then \
198 if $(SHELL) -c 'install-info --version' >/dev/null 2>&1; then \
199 install-info --dir-file=$(infodir)/dir $(infodir)/gcj.info; \
205 # A lot of the ancillary files are deleted by the main makefile.
206 # We just have to delete files specific to us.
209 -rm -f java/*$(objext) $(DEMANGLER_PROG)
210 -rm -f jc1$(exeext) $(GCJ)$(exeext) jvgenmain$(exeext) gcjh$(exeext) jv-scan$(exeext) jcf-dump$(exeext) s-java
213 -rm -f java/config.status java/Makefile
214 -rm -f java/parse.output
216 java.maintainer-clean:
217 -rm -f java/parse.c java/parse-scan.c java/parse.output java/y.tab.c
220 # The main makefile has already created stage?/java.
222 java.stage1: stage1-start
223 -mv java/*$(objext) stage1/java
224 java.stage2: stage2-start
225 -mv java/*$(objext) stage2/java
226 java.stage3: stage3-start
227 -mv java/*$(objext) stage3/java
228 java.stage4: stage4-start
229 -mv java/*$(objext) stage4/java
232 # .o:.h dependencies.
233 JAVA_TREE_H = $(TREE_H) java/java-tree.h java/java-tree.def
234 JAVA_LEX_C = java/lex.c java/keyword.h java/chartables.h
236 java/parse.o: java/parse.c java/jcf-reader.c $(CONFIG_H) $(SYSTEM_H) \
237 function.h $(JAVA_TREE_H) $(JAVA_LEX_C) java/parse.h java/lex.h $(GGC_H)
238 java/jcf-dump.o: $(CONFIG_H) $(SYSTEM_H) $(JAVA_TREE_H) java/jcf-dump.c \
239 java/jcf-reader.c java/jcf.h java/javaop.h java/javaop.def version.h
240 java/gjavah.o: $(CONFIG_H) $(SYSTEM_H) $(JAVA_TREE_H) java/gjavah.c \
241 java/jcf-reader.c java/jcf.h java/javaop.h version.h
242 java/boehm.o: java/boehm.c $(CONFIG_H) $(SYSTEM_H) $(TREE_H) $(JAVA_TREE_H) \
243 java/parse.h toplev.h
244 java/buffer.o: java/buffer.c $(CONFIG_H) java/buffer.h $(SYSTEM_H) toplev.h
245 java/check-init.o: java/check-init.c $(CONFIG_H) \
246 $(JAVA_TREE_H) $(SYSTEM_H) toplev.h
247 java/class.o: java/class.c $(CONFIG_H) $(JAVA_TREE_H) $(RTL_H) java/jcf.h \
248 java/parse.h toplev.h $(SYSTEM_H) output.h $(GGC_H) $(TARGET_H) function.h
249 java/constants.o: java/constants.c $(CONFIG_H) $(JAVA_TREE_H) java/jcf.h \
250 toplev.h $(SYSTEM_H) $(GGC_H)
251 java/decl.o: java/decl.c $(CONFIG_H) $(JAVA_TREE_H) $(RTL_H) java/jcf.h \
252 toplev.h flags.h $(SYSTEM_H) function.h expr.h libfuncs.h except.h \
253 java/java-except.h $(GGC_H)
254 java/except.o: java/except.c $(CONFIG_H) $(JAVA_TREE_H) java/jcf.h real.h \
255 $(RTL_H) java/javaop.h java/java-opcodes.h except.h java/java-except.h \
256 toplev.h $(SYSTEM_H) function.h
257 java/expr.o: java/expr.c $(CONFIG_H) $(JAVA_TREE_H) java/jcf.h real.h \
258 $(RTL_H) $(EXPR_H) java/javaop.h java/java-opcodes.h except.h \
259 java/java-except.h java/java-except.h java/parse.h toplev.h \
261 java/jcf-depend.o: java/jcf-depend.c $(CONFIG_H) $(SYSTEM_H) java/jcf.h
262 java/jcf-parse.o: java/jcf-parse.c $(CONFIG_H) $(JAVA_TREE_H) flags.h \
263 input.h java/java-except.h $(SYSTEM_H) toplev.h java/parse.h $(GGC_H) \
265 java/jcf-write.o: java/jcf-write.c $(CONFIG_H) $(JAVA_TREE_H) java/jcf.h \
266 $(RTL_H) java/java-opcodes.h java/parse.h java/buffer.h $(SYSTEM_H) \
268 java/jv-scan.o: java/jv-scan.c $(CONFIG_H) $(SYSTEM_H) version.h
269 java/jvgenmain.o: java/jvgenmain.c $(CONFIG_H) $(JAVA_TREE_H) $(SYSTEM_H)
270 java/lang.o: java/lang.c $(CONFIG_H) $(JAVA_TREE_H) java/jcf.h input.h \
271 toplev.h $(SYSTEM_H) $(RTL_H) $(EXPR_H) diagnostic.h
272 java/mangle.o: java/mangle.c $(CONFIG_H) java/jcf.h $(JAVA_TREE_H) $(SYSTEM_H) \
274 java/mangle_name.o: java/mangle_name.c $(CONFIG_H) java/jcf.h $(JAVA_TREE_H) \
275 $(SYSTEM_H) toplev.h $(GGC_H)
276 java/parse-scan.o: $(CONFIG_H) $(SYSTEM_H) toplev.h $(JAVA_LEX_C) java/parse.h \
278 java/typeck.o: java/typeck.c $(CONFIG_H) $(JAVA_TREE_H) java/jcf.h \
279 java/convert.h toplev.h $(SYSTEM_H) $(GGC_H)
280 java/verify.o: java/verify.c $(CONFIG_H) $(JAVA_TREE_H) java/jcf.h \
281 java/javaop.h java/java-opcodes.h java/java-except.h toplev.h $(SYSTEM_H)
282 java/xref.o: java/xref.c java/xref.h $(CONFIG_H) $(JAVA_TREE_H) toplev.h \
284 java/zextract.o: java/zextract.c $(CONFIG_H) $(SYSTEM_H) java/zipfile.h
286 # jcf-io.o needs $(ZLIBINC) added to cflags.
287 java/jcf-io.o: java/jcf-io.c $(CONFIG_H) $(SYSTEM_H) $(JAVA_TREE_H)
288 $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $(ZLIBINC) \
289 $(srcdir)/java/jcf-io.c $(OUTPUT_OPTION)
291 # jcf-path.o needs a -D.
292 java/jcf-path.o: java/jcf-path.c $(CONFIG_H) $(SYSTEM_H) java/jcf.h
293 $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \
294 -DLIBGCJ_ZIP_FILE='"$(prefix)/share/libgcj.jar"' \
295 $(srcdir)/java/jcf-path.c $(OUTPUT_OPTION)
298 $(srcdir)/java/gcj.info: $(srcdir)/java/gcj.texi \
299 $(srcdir)/doc/include/fdl.texi $(srcdir)/doc/include/gpl.texi
300 if test "x$(BUILD_INFO)" = xinfo; then \
301 rm -f $(srcdir)/java/gcc.info*; \
302 cd $(srcdir)/java && $(MAKEINFO) -I../doc/include -o gcj.info gcj.texi; \
305 java/gcj.dvi: $(srcdir)/java/gcj.texi $(srcdir)/doc/include/fdl.texi \
306 $(srcdir)/doc/include/gpl.texi
307 s=`cd $(srcdir); pwd`; export s; \
308 cd java && $(TEXI2DVI) -I $$s/doc/include $$s/java/gcj.texi