* Makefile.in (prefix): New macro.
[official-gcc.git] / gcc / java / Makefile.in
blob6d404857fb97d3da607f8fcdb74eb31fb25f2bb8
1 # Makefile for GNU compiler for the Java(TM) language.
2 # Copyright (C) 1987, 88, 90-4, 1995, 1998 Free Software Foundation, Inc.
4 #This file is part of GNU CC.
6 #GNU CC is free software; you can redistribute it and/or modify
7 #it under the terms of the GNU General Public License as published by
8 #the Free Software Foundation; either version 2, or (at your option)
9 #any later version.
11 #GNU CC is distributed in the hope that it will be useful,
12 #but WITHOUT ANY WARRANTY; without even the implied warranty of
13 #MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 #GNU General Public License for more details.
16 #You should have received a copy of the GNU General Public License
17 #along with GNU CC; see the file COPYING. If not, write to
18 #the Free Software Foundation, 59 Temple Place - Suite 330,
19 #Boston, MA 02111-1307, USA.
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 # The makefile built from this file lives in the language subdirectory.
26 # Its purpose is to provide support for:
28 # 1) recursion where necessary, and only then (building .o's), and
29 # 2) building and debugging cc1 from the language subdirectory, and
30 # 3) nothing else.
32 # The parent makefile handles all other chores, with help from the
33 # language makefile fragment, of course.
35 # The targets for external use are:
36 # all, TAGS, ???mostlyclean, ???clean.
38 # Suppress smart makes who think they know how to automake Yacc files
39 .y.c:
41 # Variables that exist for you to override.
42 # See below for how to change them for certain systems.
44 ALLOCA =
46 # Various ways of specifying flags for compilations:
47 # CFLAGS is for the user to override to, e.g., do a bootstrap with -O2.
48 # BOOT_CFLAGS is the value of CFLAGS to pass
49 # to the stage2 and stage3 compilations
50 # XCFLAGS is used for most compilations but not when using the GCC just built.
51 XCFLAGS =
52 CFLAGS = -g
53 BOOT_CFLAGS = -O $(CFLAGS)
54 # These exists to be overridden by the x-* and t-* files, respectively.
55 X_CFLAGS =
56 T_CFLAGS =
58 X_CPPFLAGS =
59 T_CPPFLAGS =
61 CC = @CC@
62 SET_BISON = here=`pwd`; sdir=`cd $(srcdir) && pwd`; if test -f ../../bison; then bison="$$here/../../bison/bison -L $$sdir"; else bison=bison; fi
63 BISONFLAGS =
64 JAVABISONFLAGS = --name-prefix=java_
65 AR = ar
66 AR_FLAGS = rc
67 SHELL = /bin/sh
68 MAKEINFO = makeinfo
69 TEXI2DVI = texi2dvi
71 # Define this as & to perform parallel make on a Sequent.
72 # Note that this has some bugs, and it seems currently necessary
73 # to compile all the gen* files first by hand to avoid erroneous results.
74 P =
76 # This is used in the definition of SUBDIR_USE_ALLOCA.
77 # ??? Perhaps it would be better if it just looked for *gcc*.
78 OLDCC = cc
80 # This is used instead of ALL_CFLAGS when compiling with GCC_FOR_TARGET.
81 # It omits XCFLAGS, and specifies -B./.
82 # It also specifies -B$(tooldir)/ to find as and ld for a cross compiler.
83 GCC_CFLAGS=$(INTERNAL_CFLAGS) $(X_CFLAGS) $(T_CFLAGS) $(CFLAGS)
85 # Tools to use when building a cross-compiler.
86 # These are used because `configure' appends `cross-make'
87 # to the makefile when making a cross-compiler.
89 # We don't use cross-make. Instead we use the tools
90 # from the build tree, if they are available.
91 # program_transform_name and objdir are set by configure.in.
92 program_transform_name =
93 objdir = .
95 +target=@target@
96 +xmake_file=@dep_host_xmake_file@
97 +tmake_file=@dep_tmake_file@
98 #version=`sed -e 's/.*\"\([^ \"]*\)[ \"].*/\1/' < $(srcdir)/version.c`
99 #mainversion=`sed -e 's/.*\"\([0-9]*\.[0-9]*\).*/\1/' < $(srcdir)/version.c`
101 # Directory where sources are, from where we are.
102 srcdir = @srcdir@
103 VPATH = @srcdir@
105 # Directory holding libjava.zip.
106 prefix = @prefix@
107 datadir = @datadir@
108 libjava_zip = $(datadir)/libjava.zip
110 # Additional system libraries to link with.
111 CLIB=
113 # Change this to a null string if obstacks are installed in the
114 # system library.
115 OBSTACK=obstack.o
117 # Choose the real default target.
118 ALL=all
120 # End of variables for you to override.
122 # Definition of `all' is here so that new rules inserted by sed
123 # do not specify the default target.
124 all: all.indirect
126 # This tells GNU Make version 3 not to put all variables in the environment.
127 .NOEXPORT:
129 # sed inserts variable overrides after the following line.
130 ####target overrides
131 @target_overrides@
132 ####host overrides
133 @host_overrides@
134 ####cross overrides
135 @cross_overrides@
136 ####build overrides
137 @build_overrides@
138 ####site overrides
140 # Now figure out from those variables how to compile and link.
142 all.indirect: Makefile ../jc1$(exeext) ../jcf-dump$(exeext) \
143 ../jvgenmain$(exeext) ../gcjh$(exeext) ../jv-scan$(exeext)
145 # IN_GCC tells obstack.h that we are using gcc's <stddef.h> file.
146 INTERNAL_CFLAGS = $(CROSS) -DIN_GCC @extra_c_flags@
148 # This is the variable actually used when we compile.
149 ALL_CFLAGS = $(INTERNAL_CFLAGS) $(X_CFLAGS) $(T_CFLAGS) $(CFLAGS) $(XCFLAGS)
151 # Likewise.
152 ALL_CPPFLAGS = $(CPPFLAGS) $(X_CPPFLAGS) $(T_CPPFLAGS)
154 SUBDIR_OBSTACK = `if [ x$(OBSTACK) != x ]; then echo ../$(OBSTACK); else true; fi`
155 SUBDIR_USE_ALLOCA = `case "${CC}" in "${OLDCC}") if [ x$(ALLOCA) != x ]; then echo ../$(ALLOCA); else true; fi ;; esac`
156 SUBDIR_MALLOC = `if [ x$(MALLOC) != x ]; then echo ../$(MALLOC); else true; fi`
158 # How to link with both our special library facilities
159 # and the system's installed libraries.
160 LIBS = $(SUBDIR_OBSTACK) $(SUBDIR_USE_ALLOCA) $(SUBDIR_MALLOC) $(CLIB)
162 # Specify the directories to be searched for header files.
163 # Both . and srcdir are used, in that order,
164 # so that tm.h and config.h will be found in the compilation
165 # subdirectory rather than in the source directory.
166 INCLUDES = -I. -I.. -I$(srcdir) -I$(srcdir)/.. -I$(srcdir)/../config -I$(srcdir)/../../include
168 # Always use -I$(srcdir)/config when compiling.
169 .c.o:
170 $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $<
172 # This tells GNU make version 3 not to export all the variables
173 # defined in this file into the environment.
174 .NOEXPORT:
176 # Lists of files for various purposes.
178 # Language-specific object files for Gcc/Java:
180 # Remember to keep this list in sync with JAVA_SRCS in Make-lang.in!!!
182 JAVA_OBJS = parse.o class.o decl.o expr.o constants.o lang.o typeck.o \
183 except.o verify.o zextract.o jcf-io.o jcf-parse.o mangle.o jcf-write.o \
184 buffer.o jcf-depend.o jcf-path.o
186 JAVA_OBJS_LITE = parse-scan.o jv-scan.o
188 LIBS = ../../libiberty/libiberty.a
190 # Language-independent object files.
191 OBJS = `cat ../stamp-objlist`
192 OBJDEPS = ../stamp-objlist
194 compiler: ../jc1$(exeext) ../jv-scan$(exeext)
195 ../jc1$(exeext): $(P) $(JAVA_OBJS) $(OBJDEPS) $(LIBDEPS)
196 rm -f ../jc1$(exeext)
197 $(CC) $(ALL_CFLAGS) $(LDFLAGS) -o $@ \
198 $(JAVA_OBJS) $(OBJS) $(LIBS)
199 ../jv-scan$(exeext): $(P) $(JAVA_OBJS_LITE) $(OBJDEPS) $(LIBDEPS)
200 rm -f ../jv-scan$(exeext)
201 $(CC) $(ALL_CFLAGS) $(LDFLAGS) -o $@ \
202 $(JAVA_OBJS_LITE) $(LIBS)
204 ../jcf-dump$(exeext): jcf-dump.o jcf-io.o jcf-depend.o jcf-path.o \
205 zextract.o
206 $(CC) $(ALL_CFLAGS) $(LDFLAGS) -o $@ jcf-dump.o jcf-io.o \
207 jcf-depend.o jcf-path.o zextract.o $(LIBS)
209 # Dependencies here must be kept in sync with dependencies in Make-lang.in.
210 ../jvgenmain$(exeext): jvgenmain.o mangle.o
211 $(CC) $(ALL_CFLAGS) $(LDFLAGS) -o $@ jvgenmain.o mangle.o ../obstack.o
213 ../gcjh$(exeext): gjavah.o jcf-io.o jcf-depend.o jcf-path.o \
214 zextract.o
215 $(CC) $(ALL_CFLAGS) $(LDFLAGS) -o $@ gjavah.o jcf-io.o \
216 jcf-depend.o jcf-path.o zextract.o $(LIBS)
218 Makefile: $(srcdir)/Makefile.in $(srcdir)/../configure
219 cd ..; $(SHELL) config.status
221 native: config.status ../jc1$(exeext)
223 # Compiling object files from source files.
224 TREE_H = $(srcdir)/../tree.h $(srcdir)/../real.h $(srcdir)/../tree.def \
225 $(srcdir)/../machmode.h $(srcdir)/../machmode.def
226 JAVA_TREE_H = $(TREE_H) java-tree.h java-tree.def
227 RTL_H = $(srcdir)/../rtl.h $(srcdir)/../rtl.def \
228 $(srcdir)/../machmode.h $(srcdir)/../machmode.def
229 EXPR_H = $(srcdir)/../expr.h ../insn-codes.h
231 # Separating PARSE_DIR from PARSE_RELDIR lets us easily change the
232 # code to support building parse.c in the build directory, at some
233 # expense in readability.
234 PARSE_DIR = $(srcdir)
235 PARSE_RELDIR = .
236 PARSE_C = $(PARSE_DIR)/parse.c
237 PARSE_SCAN_C = $(PARSE_DIR)/parse-scan.c
238 PARSE_H = $(srcdir)/parse.h
240 $(PARSE_C): $(srcdir)/parse.y $(srcdir)/lex.c $(PARSE_H) $(srcdir)/lex.h
241 $(SET_BISON); \
242 cd $(PARSE_DIR) && $$bison -t -v $(BISONFLAGS) $(JAVABISONFLAGS) \
243 -o parse.c $(PARSE_RELDIR)/parse.y
244 $(PARSE_SCAN_C): $(srcdir)/parse-scan.y $(srcdir)/lex.c $(PARSE_H) \
245 $(srcdir)/lex.h
246 $(SET_BISON); \
247 cd $(PARSE_DIR) && $$bison -t -v $(BISONFLAGS) -o parse-scan.c \
248 $(PARSE_RELDIR)/parse-scan.y
250 lex.c: keyword.h lex.h
252 lang.o: $(srcdir)/java-tree.def
254 keyword.h: keyword.gperf
255 gperf -L KR-C -F ', 0' -p -t -j1 -i 1 -g -o -N java_keyword -k1,3,$$ \
256 keyword.gperf > keyword.h
258 jcf-path.o: jcf-path.c $(CONFIG_H) $(srcdir)/../system.h jcf.h
259 $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \
260 -DLIBJAVA_ZIP_FILE='"$(libjava_zip)"' $(srcdir)/jcf-path.c
262 # These exist for maintenance purposes.
264 # Update the tags table.
265 TAGS: force
266 cd $(srcdir) ; \
267 etags *.c *.h ; \
268 echo 'l' | tr 'l' '\f' >> TAGS ; \
269 echo 'parse.y,0' >> TAGS ; \
270 etags -a ../*.h ../*.c;
272 .PHONY: TAGS
274 mostlyclean:
275 rm -f *.o
277 clean: mostlyclean
279 force:
281 parse.o: $(PARSE_C) jcf-reader.c
282 jcf-dump.o: jcf-reader.c jcf.h javaop.h javaop.def
283 gjavah.o: jcf-reader.c jcf.h javaop.h
284 buffer.o : buffer.c $(CONFIG_H) buffer.h $(srcdir)/../gansidecl.h \
285 $(srcdir)/../system.h $(srcdir)/../toplev.h
286 class.o : class.c $(CONFIG_H) $(JAVA_TREE_H) $(RTL_H) jcf.h \
287 $(srcdir)/../gansidecl.h $(srcdir)/../toplev.h $(srcdir)/../system.h
288 constants.o : constants.c $(CONFIG_H) $(JAVA_TREE_H) jcf.h \
289 $(srcdir)/../toplev.h $(srcdir)/../system.h
290 decl.o : decl.c $(CONFIG_H) $(JAVA_TREE_H) jcf.h \
291 $(srcdir)/../toplev.h $(srcdir)/../system.h
292 except.o : except.c $(CONFIG_H) $(JAVA_TREE_H) jcf.h $(srcdir)/../real.h \
293 $(RTL_H) javaop.h java-opcodes.h $(srcdir)/../except.h java-except.h \
294 $(srcdir)/../eh-common.h $(srcdir)/../toplev.h $(srcdir)/../system.h
295 expr.o : expr.c $(CONFIG_H) $(JAVA_TREE_H) jcf.h $(srcdir)/../real.h \
296 $(RTL_H) $(EXPR_H) javaop.h java-opcodes.h $(srcdir)/../except.h \
297 java-except.h java-except.h parse.h $(srcdir)/../toplev.h \
298 $(srcdir)/../system.h
299 jcf-depend.o: jcf-depend.c $(CONFIG_H) $(srcdir)/../system.h jcf.h
300 jcf-io.o: jcf-io.c $(CONFIG_H) $(srcdir)/../system.h
301 jcf-parse.o : jcf-parse.c $(CONFIG_H) $(JAVA_TREE_H) $(srcdir)/../flags.h \
302 $(srcdir)/../input.h java-except.h $(srcdir)/../system.h
303 jcf-write.o : jcf-write.c $(CONFIG_H) $(JAVA_TREE_H) jcf.h $(RTL_H) \
304 java-opcodes.h parse.h buffer.h $(srcdir)/../system.h
305 jvgenmain.o : jvgenmain.c $(CONFIG_H) $(srcdir)/../system.h
306 lang.o : lang.c $(CONFIG_H) $(JAVA_TREE_H) jcf.h $(srcdir)/../input.h \
307 $(srcdir)/../toplev.h $(srcdir)/../system.h
308 mangle.o : mangle.c $(CONFIG_H) jcf.h $(srcdir)/../system.h
309 typeck.o : typeck.c $(CONFIG_H) $(JAVA_TREE_H) jcf.h convert.h \
310 $(srcdir)/../toplev.h $(srcdir)/../system.h
311 verify.o : verify.c $(CONFIG_H) $(JAVA_TREE_H) jcf.h javaop.h java-opcodes.h \
312 java-except.h $(srcdir)/../toplev.h $(srcdir)/../system.h