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 # Extra flags to pass to recursive makes.
45 JAVA_FLAGS_TO_PASS = \
46 "JAVA_FOR_BUILD=$(JAVA_FOR_BUILD)" \
47 "JAVAFLAGS=$(JAVAFLAGS)" \
48 "JAVA_FOR_TARGET=$(JAVA_FOR_TARGET)"
50 # Actual names to use when installing a native compiler.
51 JAVA_INSTALL_NAME = `t='$(program_transform_name)'; echo gcj | sed $$t`
53 # Actual names to use when installing a cross-compiler.
54 JAVA_CROSS_NAME = `t='$(program_transform_cross_name)'; echo gcj | sed $$t`
59 # Define the names for selecting java in LANGUAGES.
60 java: jc1$(exeext) $(GCJ)$(exeext) jvgenmain$(exeext) gcjh$(exeext) jv-scan$(exeext) jcf-dump$(exeext)
62 # Define the name of target independant tools to be installed in $(bindir)
63 # Names are subject to changes
64 JAVA_TARGET_INDEPENDENT_BIN_TOOLS = gcjh jv-scan jcf-dump
66 # Tell GNU make to ignore these if they exist.
69 # Remember to keep this list in sync with JAVA_OBJS in Makefile.in!!!
71 JAVA_SRCS = $(srcdir)/java/parse.y $(srcdir)/java/class.c \
72 $(srcdir)/java/decl.c $(srcdir)/java/expr.c $(srcdir)/java/constants.c \
73 $(srcdir)/java/lang.c $(srcdir)/java/typeck.c $(srcdir)/java/except.c \
74 $(srcdir)/java/verify.c $(srcdir)/java/zextract.c $(srcdir)/java/jcf-io.c \
75 $(srcdir)/java/jcf-parse.c $(srcdir)/java/mangle.c \
76 $(srcdir)/java/jcf-write.c $(srcdir)/java/buffer.c \
77 $(srcdir)/java/check-init.c $(srcdir)/java/lex.c $(srcdir)/java/boehm.c \
78 $(srcdir)/java/jcf-depend.c $(srcdir)/java/jcf-path.c
80 jc1$(exeext): $(P) $(JAVA_SRCS) $(LIBDEPS) $(BACKEND) ggc-callbacks.o
81 cd java; $(MAKE) $(LANG_FLAGS_TO_PASS) $(JAVA_FLAGS_TO_PASS) ../jc1$(exeext)
83 jvspec.o: $(srcdir)/java/jvspec.c system.h $(GCC_H)
84 $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) \
85 $(INCLUDES) $(srcdir)/java/jvspec.c
87 # Create the compiler driver for $(GCJ).
88 $(GCJ)$(exeext): gcc.o jvspec.o version.o \
89 prefix.o intl.o $(LIBDEPS) $(EXTRA_GCC_OBJS)
90 $(CC) $(ALL_CFLAGS) $(LDFLAGS) -o $@ gcc.o jvspec.o prefix.o intl.o \
91 version.o $(EXTRA_GCC_OBJS) $(LIBS)
93 # Create a version of the $(GCJ) driver which calls the cross-compiler.
94 $(GCJ)-cross$(exeext): $(GCJ)$(exeext)
95 -rm -f $(GCJ)-cross$(exeext)
96 cp $(GCJ)$(exeext) $(GCJ)-cross$(exeext)
98 # Dependencies here must be kept in sync with dependencies in Makefile.in.
99 jvgenmain$(exeext): $(srcdir)/java/jvgenmain.c $(srcdir)/java/mangle.c \
101 cd java && $(MAKE) $(LANG_FLAGS_TO_PASS) $(JAVA_FLAGS_TO_PASS) ../jvgenmain$(exeext)
103 # This must be kept in sync with dependencies in Makefile.in.
104 GCJH_SOURCES = $(srcdir)/java/gjavah.c $(srcdir)/java/jcf-io.c \
105 $(srcdir)/java/zextract.c $(srcdir)/java/jcf-reader.c \
106 $(srcdir)/java/jcf.h $(srcdir)/java/javaop.h \
107 $(srcdir)/java/javaop.def $(srcdir)/java/jcf-depend.c \
108 $(srcdir)/java/jcf-path.c
110 gcjh$(exeext): $(GCJH_SOURCES) $(LIBDEPS) $(TREE_H)
111 cd java && $(MAKE) $(LANG_FLAGS_TO_PASS) $(JAVA_FLAGS_TO_PASS) ../gcjh$(exeext)
113 $(INTL_TARGETS): $(srcdir)/java/parse.c $(srcdir)/java/parse-scan.c
115 # Separating PARSE_DIR from PARSE_RELDIR lets us easily change the
116 # code to support building parse.c in the build directory, at some
117 # expense in readability.
118 # This code must be kept in sync with Makefile.in.
119 PARSE_DIR = $(srcdir)/java
121 PARSE_C = $(PARSE_DIR)/parse.c
122 PARSE_SCAN_C = $(PARSE_DIR)/parse-scan.c
124 SET_BISON = here=`pwd`; sdir=`cd $(srcdir) && pwd`; if test -f ../bison; then bison="$$here/../bison/bison -L $$sdir"; else bison=bison; fi
126 JAVABISONFLAGS = --name-prefix=java_
128 $(PARSE_C): $(srcdir)/java/parse.y
130 cd $(PARSE_DIR) && $$bison -t $(BISONFLAGS) $(JAVABISONFLAGS) \
131 -o parse.c $(PARSE_RELDIR)/parse.y
132 $(PARSE_SCAN_C): $(srcdir)/java/parse-scan.y
134 cd $(PARSE_DIR) && $$bison -t $(BISONFLAGS) -o parse-scan.c \
135 $(PARSE_RELDIR)/parse-scan.y
137 # This must be kept in sync with dependencies in Makefile.in.
138 JV_SCAN_SOURCES = $(srcdir)/java/parse-scan.y $(srcdir)/java/lex.c \
139 $(srcdir)/java/parse.h $(srcdir)/java/lex.h $(srcdir)/java/jv-scan.c
141 jv-scan$(exeext): $(JV_SCAN_SOURCES) $(BACKEND) $(LIBDEPS)
142 cd java && $(MAKE) $(LANG_FLAGS_TO_PASS) $(JAVA_FLAGS_TO_PASS) ../jv-scan$(exeext)
144 # This must be kept in sync with dependencies in Makefile.in.
145 JCF_DUMP_SOURCES = $(srcdir)/java/jcf-dump.c $(srcdir)/java/jcf-io.c \
146 $(srcdir)/java/zextract.c $(TREE_H)
148 jcf-dump$(exeext): $(JCF_DUMP_SOURCES)
149 cd java && $(MAKE) $(LANG_FLAGS_TO_PASS) $(JAVA_FLAGS_TO_PASS) ../jcf-dump$(exeext)
154 java.all.build: $(GCJ)$(exeext)
155 java.all.cross: $(GCJ)-cross$(exeext)
156 java.start.encap: $(GCJ)$(exeext)
162 # jc1, gcj, jvgenmain, and gcjh are installed elsewhere as part
165 # Nothing to do here.
169 -if [ -f $(GCJ)$(exeext) ]; then \
170 if [ -f $(GCJ)-cross$(exeext) ]; then \
171 rm -f $(bindir)/$(JAVA_CROSS_NAME)$(exeext); \
172 $(INSTALL_PROGRAM) $(GCJ)-cross$(exeext) $(bindir)/$(JAVA_CROSS_NAME)$(exeext); \
173 chmod a+x $(bindir)/$(JAVA_CROSS_NAME)$(exeext); \
175 rm -f $(bindir)/$(JAVA_INSTALL_NAME)$(exeext); \
176 $(INSTALL_PROGRAM) $(GCJ)$(exeext) $(bindir)/$(JAVA_INSTALL_NAME)$(exeext); \
177 chmod a+x $(bindir)/$(JAVA_INSTALL_NAME)$(exeext); \
180 for tool in $(JAVA_TARGET_INDEPENDENT_BIN_TOOLS); do \
181 if [ -f $$tool$(exeext) ]; then \
182 rm -f $(bindir)/$$tool$(exeext); \
183 $(INSTALL_PROGRAM) $$tool$(exeext) $(bindir)/$$tool$(exeext); \
184 chmod a+x $(bindir)/$$tool$(exeext); \
191 -rm -rf $(bindir)/$(JAVA_INSTALL_NAME)$(exeext)
192 -rm -rf $(bindir)/$(JAVA_CROSS_NAME)$(exeext)
198 # A lot of the ancillary files are deleted by the main makefile.
199 # We just have to delete files specific to us.
202 -rm -f java/*$(objext) $(DEMANGLER_PROG)
203 -rm -f jc1$(exeext) $(GCJ)$(exeext) jvgenmain$(exeext) gcjh$(exeext) jv-scan$(exeext) jcf-dump$(exeext)
206 -rm -f java/config.status java/Makefile
207 -rm -f java/parse.output
209 java.maintainer-clean:
210 -rm -f java/parse.c java/parse-scan.c java/parse.output java/y.tab.c
213 # The main makefile has already created stage?/java.
215 java.stage1: stage1-start
216 -mv java/*$(objext) stage1/java
217 java.stage2: stage2-start
218 -mv java/*$(objext) stage2/java
219 java.stage3: stage3-start
220 -mv java/*$(objext) stage3/java
221 java.stage4: stage4-start
222 -mv java/*$(objext) stage4/java
226 # This target creates the files that can be rebuilt, but go in the
227 # distribution anyway. It then copies the files to the distdir directory.
230 cd java ; $(MAKE) $(LANG_FLAGS_TO_PASS) $(JAVA_FLAGS_TO_PASS) parse.c hash.h
232 for file in *[0-9a-zA-Z+]; do \
233 ln $$file ../tmp/java >/dev/null 2>&1 || cp $$file ../tmp/java; \