1 # Top level makefile fragment for the GNU compiler for the Java(TM)
3 # Copyright (C) 1996, 1998, 1999, 2000 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,
32 # foo.uninstall, foo.distdir,
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)
64 $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) \
65 $(INCLUDES) $(srcdir)/java/jvspec.c $(OUTPUT_OPTION)
67 # Create the compiler driver for $(GCJ).
68 $(GCJ)$(exeext): gcc.o jvspec.o version.o \
69 prefix.o intl.o $(LIBDEPS) $(EXTRA_GCC_OBJS)
70 $(CC) $(ALL_CFLAGS) $(LDFLAGS) -o $@ gcc.o jvspec.o prefix.o intl.o \
71 version.o $(EXTRA_GCC_OBJS) $(LIBS)
73 # Create a version of the $(GCJ) driver which calls the cross-compiler.
74 $(GCJ)-cross$(exeext): $(GCJ)$(exeext)
75 -rm -f $(GCJ)-cross$(exeext)
76 cp $(GCJ)$(exeext) $(GCJ)-cross$(exeext)
78 $(INTL_TARGETS): $(srcdir)/java/parse.c $(srcdir)/java/parse-scan.c
80 $(srcdir)/java/parse.c: $(srcdir)/java/parse.y
81 (cd $(srcdir)/java && \
82 $(BISON) -t --name-prefix=java_ $(BISONFLAGS) -o p$$$$.c parse.y && \
83 mv -f p$$$$.c parse.c)
85 $(srcdir)/java/parse-scan.c: $(srcdir)/java/parse-scan.y
86 (cd $(srcdir)/java && \
87 $(BISON) -t $(BISONFLAGS) -o ps$$$$.c parse-scan.y && \
88 mv -f ps$$$$.c parse-scan.c)
90 $(srcdir)/java/keyword.h: $(srcdir)/java/keyword.gperf
91 (cd $(srcdir)/java || exit 1; \
92 gperf -L C -F ', 0' -p -t -j1 -i 1 -g -o -N java_keyword -k1,3,$$ \
93 keyword.gperf > k$$$$.h || {
94 echo "Please update gperf from ftp://ftp.gnu.org/pub/gnu/gperf/" >&2; \
97 mv -f k$$$$.h keyword.gperf)
99 # Executables built by this Makefile:
100 JAVA_OBJS = java/parse.o java/class.o java/decl.o java/expr.o \
101 java/constants.o java/lang.o java/typeck.o java/except.o java/verify.o \
102 java/zextract.o java/jcf-io.o java/jcf-parse.o java/mangle.o \
103 java/jcf-write.o java/buffer.o java/check-init.o java/jcf-depend.o \
104 java/jcf-path.o java/xref.o java/boehm.o mkdeps.o
106 GCJH_OBJS = java/gjavah.o java/jcf-io.o java/jcf-depend.o java/jcf-path.o \
107 java/zextract.o version.o mkdeps.o errors.o
109 JVSCAN_OBJS = java/parse-scan.o java/jv-scan.o version.o
111 JCFDUMP_OBJS = java/jcf-dump.o java/jcf-io.o java/jcf-depend.o java/jcf-path.o \
112 java/zextract.o errors.o version.o mkdeps.o
114 JVGENMAIN_OBJS = java/jvgenmain.o java/mangle.o
116 # Use loose warnings for this front end.
119 jc1$(exeext): $(JAVA_OBJS) $(BACKEND) $(LIBDEPS)
121 $(CC) $(ALL_CFLAGS) $(LDFLAGS) -o $@ \
122 $(JAVA_OBJS) $(BACKEND) $(ZLIB) $(LIBS)
124 gcjh$(exeext): $(GCJH_OBJS) $(LIBDEPS)
126 $(CC) $(ALL_CFLAGS) $(LDFLAGS) -o $@ $(GCJH_OBJS) $(ZLIB) $(LIBS)
128 jv-scan$(exeext): $(JVSCAN_OBJS) $(LIBDEPS)
130 $(CC) $(ALL_CFLAGS) $(LDFLAGS) -o $@ $(JVSCAN_OBJS) $(LIBS)
132 jcf-dump$(exeext): $(JCFDUMP_OBJS) $(LIBDEPS)
134 $(CC) $(ALL_CFLAGS) $(LDFLAGS) -o $@ $(JCFDUMP_OBJS) $(ZLIB) $(LIBS)
136 jvgenmain$(exeext): $(JVGENMAIN_OBJS) $(LIBDEPS)
138 $(CC) $(ALL_CFLAGS) $(LDFLAGS) -o $@ $(JVGENMAIN_OBJS) $(LIBS)
143 java.all.build: $(GCJ)$(exeext)
144 java.all.cross: $(GCJ)-cross$(exeext)
145 java.start.encap: $(GCJ)$(exeext)
152 # jc1, gcj, jvgenmain, and gcjh are installed elsewhere as part
155 # Nothing to do here.
159 -if [ -f $(GCJ)$(exeext) ]; then \
160 if [ -f $(GCJ)-cross$(exeext) ]; then \
161 rm -f $(bindir)/$(JAVA_CROSS_NAME)$(exeext); \
162 $(INSTALL_PROGRAM) $(GCJ)-cross$(exeext) $(bindir)/$(JAVA_CROSS_NAME)$(exeext); \
163 chmod a+x $(bindir)/$(JAVA_CROSS_NAME)$(exeext); \
165 rm -f $(bindir)/$(JAVA_INSTALL_NAME)$(exeext); \
166 $(INSTALL_PROGRAM) $(GCJ)$(exeext) $(bindir)/$(JAVA_INSTALL_NAME)$(exeext); \
167 chmod a+x $(bindir)/$(JAVA_INSTALL_NAME)$(exeext); \
170 for tool in $(JAVA_TARGET_INDEPENDENT_BIN_TOOLS); do \
171 if [ -f $$tool$(exeext) ]; then \
172 rm -f $(bindir)/$$tool$(exeext); \
173 $(INSTALL_PROGRAM) $$tool$(exeext) $(bindir)/$$tool$(exeext); \
174 chmod a+x $(bindir)/$$tool$(exeext); \
181 -rm -rf $(bindir)/$(JAVA_INSTALL_NAME)$(exeext)
182 -rm -rf $(bindir)/$(JAVA_CROSS_NAME)$(exeext)
188 # A lot of the ancillary files are deleted by the main makefile.
189 # We just have to delete files specific to us.
192 -rm -f java/*$(objext) $(DEMANGLER_PROG)
193 -rm -f jc1$(exeext) $(GCJ)$(exeext) jvgenmain$(exeext) gcjh$(exeext) jv-scan$(exeext) jcf-dump$(exeext) s-java
196 -rm -f java/config.status java/Makefile
197 -rm -f java/parse.output
199 java.maintainer-clean:
200 -rm -f java/parse.c java/parse-scan.c java/parse.output java/y.tab.c
203 # The main makefile has already created stage?/java.
205 java.stage1: stage1-start
206 -mv java/*$(objext) stage1/java
207 java.stage2: stage2-start
208 -mv java/*$(objext) stage2/java
209 java.stage3: stage3-start
210 -mv java/*$(objext) stage3/java
211 java.stage4: stage4-start
212 -mv java/*$(objext) stage4/java
216 # This target creates the files that can be rebuilt, but go in the
217 # distribution anyway. It then copies the files to the distdir directory.
218 java.distdir: java/parse.c java/hash.h
221 for file in *[0-9a-zA-Z+]; do \
222 ln $$file ../tmp/java >/dev/null 2>&1 || cp $$file ../tmp/java; \
226 # .o:.h dependencies.
227 JAVA_TREE_H = $(TREE_H) java/java-tree.h java/java-tree.def
228 JAVA_LEX_C = java/lex.c java/keyword.h
230 java/parse.o: java/parse.c java/jcf-reader.c $(CONFIG_H) system.h \
231 function.h $(JAVA_TREE_H) $(JAVA_LEX_C) java/parse.h java/lex.h $(GGC_H)
232 java/jcf-dump.o: $(CONFIG_H) system.h $(JAVA_TREE_H) java/jcf-dump.c \
233 java/jcf-reader.c java/jcf.h java/javaop.h java/javaop.def version.h
234 java/gjavah.o: $(CONFIG_H) system.h $(JAVA_TREE_H) java/gjavah.c \
235 java/jcf-reader.c java/jcf.h java/javaop.h version.h
236 java/boehm.o: java/boehm.c $(CONFIG_H) system.h $(TREE_H) $(JAVA_TREE_H) \
238 java/buffer.o: java/buffer.c $(CONFIG_H) java/buffer.h gansidecl.h \
240 java/check-init.o: java/check-init.c $(CONFIG_H) gansidecl.h \
241 $(JAVA_TREE_H) system.h toplev.h
242 java/class.o: java/class.c $(CONFIG_H) $(JAVA_TREE_H) $(RTL_H) java/jcf.h \
243 java/parse.h gansidecl.h toplev.h system.h output.h $(GGC_H)
244 java/constants.o: java/constants.c $(CONFIG_H) $(JAVA_TREE_H) java/jcf.h \
245 toplev.h system.h $(GGC_H)
246 java/decl.o: java/decl.c $(CONFIG_H) $(JAVA_TREE_H) java/jcf.h \
247 toplev.h system.h function.h defaults.h gcc.h
248 java/except.o: java/except.c $(CONFIG_H) $(JAVA_TREE_H) java/jcf.h real.h \
249 $(RTL_H) java/javaop.h java/java-opcodes.h except.h java/java-except.h \
250 eh-common.h toplev.h system.h function.h
251 java/expr.o: java/expr.c $(CONFIG_H) $(JAVA_TREE_H) java/jcf.h real.h \
252 $(RTL_H) $(EXPR_H) java/javaop.h java/java-opcodes.h except.h \
253 java/java-except.h java/java-except.h java/parse.h toplev.h \
255 java/jcf-depend.o: java/jcf-depend.c $(CONFIG_H) system.h java/jcf.h
256 java/jcf-parse.o: java/jcf-parse.c $(CONFIG_H) $(JAVA_TREE_H) flags.h \
257 input.h java/java-except.h system.h toplev.h java/parse.h $(GGC_H)
258 java/jcf-write.o: java/jcf-write.c $(CONFIG_H) $(JAVA_TREE_H) java/jcf.h \
259 $(RTL_H) java/java-opcodes.h java/parse.h java/buffer.h system.h \
261 java/jv-scan.o: java/jv-scan.c $(CONFIG_H) system.h version.h
262 java/jvgenmain.o: java/jvgenmain.c $(CONFIG_H) $(JAVA_TREE_H) system.h
263 java/lang.o: java/lang.c $(CONFIG_H) $(JAVA_TREE_H) java/jcf.h input.h \
264 toplev.h system.h $(RTL_H) $(EXPR_H)
265 java/mangle.o: java/mangle.c $(CONFIG_H) java/jcf.h $(JAVA_TREE_H) system.h \
267 java/parse-scan.o: $(CONFIG_H) system.h toplev.h $(JAVA_LEX_C) java/parse.h \
269 java/typeck.o: java/typeck.c $(CONFIG_H) $(JAVA_TREE_H) java/jcf.h \
270 java/convert.h toplev.h system.h $(GGC_H)
271 java/verify.o: java/verify.c $(CONFIG_H) $(JAVA_TREE_H) java/jcf.h \
272 java/javaop.h java/java-opcodes.h java/java-except.h toplev.h system.h
273 java/xref.o: java/xref.c java/xref.h $(CONFIG_H) $(JAVA_TREE_H) toplev.h \
275 java/zextract.o: java/zextract.c $(CONFIG_H) system.h java/zipfile.h
277 # jcf-io.o needs $(ZLIBINC) added to cflags.
278 java/jcf-io.o: java/jcf-io.c $(CONFIG_H) system.h $(JAVA_TREE_H)
279 $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $(ZLIBINC) \
280 $(srcdir)/java/jcf-io.c $(OUTPUT_OPTION)
282 # jcf-path.o needs a -D.
283 java/jcf-path.o: java/jcf-path.c $(CONFIG_H) system.h java/jcf.h
284 $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \
285 -DLIBGCJ_ZIP_FILE='"$(prefix)/share/libgcj.zip"' \
286 $(srcdir)/java/jcf-path.c $(OUTPUT_OPTION)