]>
Commit | Line | Data |
---|---|---|
e04a16fb AG |
1 | # Makefile for GNU compiler for the Java(TM) language. |
2 | # Copyright (C) 1987, 88, 90-4, 1995, 1998 Free Software Foundation, Inc. | |
3 | ||
4 | #This file is part of GNU CC. | |
5 | ||
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. | |
10 | ||
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. | |
15 | ||
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. | |
20 | ||
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. | |
24 | ||
25 | # The makefile built from this file lives in the language subdirectory. | |
26 | # Its purpose is to provide support for: | |
27 | # | |
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. | |
31 | # | |
32 | # The parent makefile handles all other chores, with help from the | |
33 | # language makefile fragment, of course. | |
34 | # | |
35 | # The targets for external use are: | |
36 | # all, TAGS, ???mostlyclean, ???clean. | |
37 | ||
38 | # Suppress smart makes who think they know how to automake Yacc files | |
39 | .y.c: | |
40 | ||
41 | # Variables that exist for you to override. | |
42 | # See below for how to change them for certain systems. | |
43 | ||
44 | ALLOCA = | |
45 | ||
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 = | |
57 | ||
58 | X_CPPFLAGS = | |
59 | T_CPPFLAGS = | |
60 | ||
61 | CC = @CC@ | |
257fafbb | 62 | SET_BISON = here=`pwd`; sdir=`cd $(srcdir) && pwd`; if test -f ../../bison; then bison="$$here/../../bison/bison -L $$sdir"; else bison=bison; fi |
e04a16fb AG |
63 | BISONFLAGS = |
64 | JAVABISONFLAGS = --name-prefix=java_ | |
e04a16fb AG |
65 | AR = ar |
66 | AR_FLAGS = rc | |
67 | SHELL = /bin/sh | |
68 | MAKEINFO = makeinfo | |
69 | TEXI2DVI = texi2dvi | |
70 | ||
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 = | |
75 | ||
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 | |
79 | ||
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) | |
84 | ||
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. | |
88 | ||
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 = . | |
94 | ||
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` | |
100 | ||
101 | # Directory where sources are, from where we are. | |
102 | srcdir = @srcdir@ | |
103 | VPATH = @srcdir@ | |
104 | ||
8603f9c5 TT |
105 | # Directory holding libjava.zip. |
106 | datadir = @datadir@ | |
107 | libjava_zip = $(datadir)/libjava.zip | |
108 | ||
e04a16fb AG |
109 | # Additional system libraries to link with. |
110 | CLIB= | |
111 | ||
112 | # Change this to a null string if obstacks are installed in the | |
113 | # system library. | |
114 | OBSTACK=obstack.o | |
115 | ||
116 | # Choose the real default target. | |
117 | ALL=all | |
118 | ||
119 | # End of variables for you to override. | |
120 | ||
121 | # Definition of `all' is here so that new rules inserted by sed | |
122 | # do not specify the default target. | |
123 | all: all.indirect | |
124 | ||
125 | # This tells GNU Make version 3 not to put all variables in the environment. | |
126 | .NOEXPORT: | |
127 | ||
128 | # sed inserts variable overrides after the following line. | |
129 | ####target overrides | |
130 | @target_overrides@ | |
131 | ####host overrides | |
132 | @host_overrides@ | |
133 | ####cross overrides | |
134 | @cross_overrides@ | |
135 | ####build overrides | |
136 | @build_overrides@ | |
137 | ####site overrides | |
138 | \f | |
139 | # Now figure out from those variables how to compile and link. | |
140 | ||
141 | all.indirect: Makefile ../jc1$(exeext) ../jcf-dump$(exeext) \ | |
142 | ../jvgenmain$(exeext) ../gcjh$(exeext) ../jv-scan$(exeext) | |
143 | ||
144 | # IN_GCC tells obstack.h that we are using gcc's <stddef.h> file. | |
145 | INTERNAL_CFLAGS = $(CROSS) -DIN_GCC @extra_c_flags@ | |
146 | ||
147 | # This is the variable actually used when we compile. | |
148 | ALL_CFLAGS = $(INTERNAL_CFLAGS) $(X_CFLAGS) $(T_CFLAGS) $(CFLAGS) $(XCFLAGS) | |
149 | ||
150 | # Likewise. | |
151 | ALL_CPPFLAGS = $(CPPFLAGS) $(X_CPPFLAGS) $(T_CPPFLAGS) | |
152 | ||
e04a16fb | 153 | SUBDIR_OBSTACK = `if [ x$(OBSTACK) != x ]; then echo ../$(OBSTACK); else true; fi` |
c20012b6 | 154 | SUBDIR_USE_ALLOCA = `case "${CC}" in "${OLDCC}") if [ x$(ALLOCA) != x ]; then echo ../$(ALLOCA); else true; fi ;; esac` |
e04a16fb AG |
155 | SUBDIR_MALLOC = `if [ x$(MALLOC) != x ]; then echo ../$(MALLOC); else true; fi` |
156 | ||
157 | # How to link with both our special library facilities | |
158 | # and the system's installed libraries. | |
159 | LIBS = $(SUBDIR_OBSTACK) $(SUBDIR_USE_ALLOCA) $(SUBDIR_MALLOC) $(CLIB) | |
160 | ||
161 | # Specify the directories to be searched for header files. | |
162 | # Both . and srcdir are used, in that order, | |
163 | # so that tm.h and config.h will be found in the compilation | |
164 | # subdirectory rather than in the source directory. | |
5db17173 | 165 | INCLUDES = -I. -I.. -I$(srcdir) -I$(srcdir)/.. -I$(srcdir)/../config -I$(srcdir)/../../include |
e04a16fb AG |
166 | |
167 | # Always use -I$(srcdir)/config when compiling. | |
168 | .c.o: | |
169 | $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $< | |
170 | ||
171 | # This tells GNU make version 3 not to export all the variables | |
172 | # defined in this file into the environment. | |
173 | .NOEXPORT: | |
174 | \f | |
175 | # Lists of files for various purposes. | |
176 | ||
177 | # Language-specific object files for Gcc/Java: | |
178 | ||
179 | # Remember to keep this list in sync with JAVA_SRCS in Make-lang.in!!! | |
180 | # | |
181 | JAVA_OBJS = parse.o class.o decl.o expr.o constants.o lang.o typeck.o \ | |
182 | except.o verify.o zextract.o jcf-io.o jcf-parse.o mangle.o jcf-write.o \ | |
8603f9c5 | 183 | buffer.o jcf-depend.o jcf-path.o |
e04a16fb AG |
184 | |
185 | JAVA_OBJS_LITE = parse-scan.o jv-scan.o | |
186 | ||
3e9cfddb PB |
187 | LIBS = ../../libiberty/libiberty.a |
188 | ||
e04a16fb AG |
189 | # Language-independent object files. |
190 | OBJS = `cat ../stamp-objlist` | |
191 | OBJDEPS = ../stamp-objlist | |
192 | ||
193 | compiler: ../jc1$(exeext) ../jv-scan$(exeext) | |
194 | ../jc1$(exeext): $(P) $(JAVA_OBJS) $(OBJDEPS) $(LIBDEPS) | |
195 | rm -f ../jc1$(exeext) | |
196 | $(CC) $(ALL_CFLAGS) $(LDFLAGS) -o $@ \ | |
197 | $(JAVA_OBJS) $(OBJS) $(LIBS) | |
198 | ../jv-scan$(exeext): $(P) $(JAVA_OBJS_LITE) $(OBJDEPS) $(LIBDEPS) | |
199 | rm -f ../jv-scan$(exeext) | |
200 | $(CC) $(ALL_CFLAGS) $(LDFLAGS) -o $@ \ | |
201 | $(JAVA_OBJS_LITE) $(LIBS) | |
202 | ||
8603f9c5 TT |
203 | ../jcf-dump$(exeext): jcf-dump.o jcf-io.o jcf-depend.o jcf-path.o \ |
204 | zextract.o | |
205 | $(CC) $(ALL_CFLAGS) $(LDFLAGS) -o $@ jcf-dump.o jcf-io.o \ | |
206 | jcf-depend.o jcf-path.o zextract.o | |
e04a16fb AG |
207 | |
208 | # Dependencies here must be kept in sync with dependencies in Make-lang.in. | |
209 | ../jvgenmain$(exeext): jvgenmain.o mangle.o | |
210 | $(CC) $(ALL_CFLAGS) $(LDFLAGS) -o $@ jvgenmain.o mangle.o ../obstack.o | |
211 | ||
8603f9c5 TT |
212 | ../gcjh$(exeext): gjavah.o jcf-io.o jcf-depend.o jcf-path.o \ |
213 | zextract.o | |
214 | $(CC) $(ALL_CFLAGS) $(LDFLAGS) -o $@ gjavah.o jcf-io.o \ | |
215 | jcf-depend.o jcf-path.o zextract.o | |
e04a16fb AG |
216 | |
217 | Makefile: $(srcdir)/Makefile.in $(srcdir)/../configure | |
218 | cd ..; $(SHELL) config.status | |
219 | ||
220 | native: config.status ../jc1$(exeext) | |
221 | \f | |
222 | # Compiling object files from source files. | |
1f43f4b4 JL |
223 | TREE_H = $(srcdir)/../tree.h $(srcdir)/../real.h $(srcdir)/../tree.def \ |
224 | $(srcdir)/../machmode.h $(srcdir)/../machmode.def | |
225 | JAVA_TREE_H = $(TREE_H) java-tree.h java-tree.def | |
226 | RTL_H = $(srcdir)/../rtl.h $(srcdir)/../rtl.def \ | |
227 | $(srcdir)/../machmode.h $(srcdir)/../machmode.def | |
228 | EXPR_H = $(srcdir)/../expr.h ../insn-codes.h | |
e04a16fb | 229 | |
257fafbb TT |
230 | # Separating PARSE_DIR from PARSE_RELDIR lets us easily change the |
231 | # code to support building parse.c in the build directory, at some | |
232 | # expense in readability. | |
233 | PARSE_DIR = $(srcdir) | |
234 | PARSE_RELDIR = . | |
235 | PARSE_C = $(PARSE_DIR)/parse.c | |
236 | PARSE_SCAN_C = $(PARSE_DIR)/parse-scan.c | |
e04a16fb | 237 | PARSE_H = $(srcdir)/parse.h |
e04a16fb | 238 | |
e04a16fb | 239 | $(PARSE_C): $(srcdir)/parse.y $(srcdir)/lex.c $(PARSE_H) $(srcdir)/lex.h |
257fafbb TT |
240 | $(SET_BISON); \ |
241 | cd $(PARSE_DIR) && $$bison -t -v $(BISONFLAGS) $(JAVABISONFLAGS) \ | |
242 | -o parse.c $(PARSE_RELDIR)/parse.y | |
e04a16fb | 243 | $(PARSE_SCAN_C): $(srcdir)/parse-scan.y $(srcdir)/lex.c $(PARSE_H) \ |
e4de5a10 | 244 | $(srcdir)/lex.h |
257fafbb TT |
245 | $(SET_BISON); \ |
246 | cd $(PARSE_DIR) && $$bison -t -v $(BISONFLAGS) -o parse-scan.c \ | |
247 | $(PARSE_RELDIR)/parse-scan.y | |
e04a16fb AG |
248 | |
249 | lex.c: keyword.h lex.h | |
250 | ||
e4de5a10 PB |
251 | lang.o: $(srcdir)/java-tree.def |
252 | ||
e04a16fb | 253 | keyword.h: keyword.gperf |
13abbf47 | 254 | gperf -L KR-C -F ', 0' -p -t -j1 -i 1 -g -o -N java_keyword -k1,3,$$ \ |
e04a16fb AG |
255 | keyword.gperf > keyword.h |
256 | ||
8603f9c5 TT |
257 | jcf-path.o: jcf-path.c $(CONFIG_H) $(srcdir)/../system.h jcf.h |
258 | $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \ | |
259 | -DLIBJAVA_ZIP_FILE='"$(libjava_zip)"' $(srcdir)/jcf-path.c | |
260 | ||
e04a16fb AG |
261 | # These exist for maintenance purposes. |
262 | ||
263 | # Update the tags table. | |
264 | TAGS: force | |
265 | cd $(srcdir) ; \ | |
266 | etags *.c *.h ; \ | |
267 | echo 'l' | tr 'l' '\f' >> TAGS ; \ | |
268 | echo 'parse.y,0' >> TAGS ; \ | |
269 | etags -a ../*.h ../*.c; | |
270 | ||
271 | .PHONY: TAGS | |
272 | ||
273 | mostlyclean: | |
274 | rm -f *.o | |
275 | ||
276 | clean: mostlyclean | |
e04a16fb AG |
277 | |
278 | force: | |
279 | ||
280 | parse.o: $(PARSE_C) jcf-reader.c | |
281 | jcf-dump.o: jcf-reader.c jcf.h javaop.h javaop.def | |
282 | gjavah.o: jcf-reader.c jcf.h javaop.h | |
1f43f4b4 JL |
283 | buffer.o : buffer.c $(CONFIG_H) buffer.h $(srcdir)/../gansidecl.h \ |
284 | $(srcdir)/../system.h $(srcdir)/../toplev.h | |
285 | class.o : class.c $(CONFIG_H) $(JAVA_TREE_H) $(RTL_H) jcf.h \ | |
286 | $(srcdir)/../gansidecl.h $(srcdir)/../toplev.h $(srcdir)/../system.h | |
287 | constants.o : constants.c $(CONFIG_H) $(JAVA_TREE_H) jcf.h \ | |
288 | $(srcdir)/../toplev.h $(srcdir)/../system.h | |
289 | decl.o : decl.c $(CONFIG_H) $(JAVA_TREE_H) jcf.h \ | |
290 | $(srcdir)/../toplev.h $(srcdir)/../system.h | |
291 | except.o : except.c $(CONFIG_H) $(JAVA_TREE_H) jcf.h $(srcdir)/../real.h \ | |
292 | $(RTL_H) javaop.h java-opcodes.h $(srcdir)/../except.h java-except.h \ | |
293 | $(srcdir)/../eh-common.h $(srcdir)/../toplev.h $(srcdir)/../system.h | |
294 | expr.o : expr.c $(CONFIG_H) $(JAVA_TREE_H) jcf.h $(srcdir)/../real.h \ | |
295 | $(RTL_H) $(EXPR_H) javaop.h java-opcodes.h $(srcdir)/../except.h \ | |
296 | java-except.h java-except.h parse.h $(srcdir)/../toplev.h \ | |
297 | $(srcdir)/../system.h | |
8603f9c5 | 298 | jcf-depend.o: jcf-depend.c $(CONFIG_H) $(srcdir)/../system.h jcf.h |
1f43f4b4 JL |
299 | jcf-io.o: jcf-io.c $(CONFIG_H) $(srcdir)/../system.h |
300 | jcf-parse.o : jcf-parse.c $(CONFIG_H) $(JAVA_TREE_H) $(srcdir)/../flags.h \ | |
301 | $(srcdir)/../input.h java-except.h $(srcdir)/../system.h | |
302 | jcf-write.o : jcf-write.c $(CONFIG_H) $(JAVA_TREE_H) jcf.h $(RTL_H) \ | |
303 | java-opcodes.h parse.h buffer.h $(srcdir)/../system.h | |
304 | jvgenmain.o : jvgenmain.c $(CONFIG_H) $(srcdir)/../system.h | |
305 | lang.o : lang.c $(CONFIG_H) $(JAVA_TREE_H) jcf.h $(srcdir)/../input.h \ | |
306 | $(srcdir)/../toplev.h $(srcdir)/../system.h | |
307 | mangle.o : mangle.c $(CONFIG_H) jcf.h $(srcdir)/../system.h | |
308 | typeck.o : typeck.c $(CONFIG_H) $(JAVA_TREE_H) jcf.h convert.h \ | |
7fb54db5 JL |
309 | $(srcdir)/../toplev.h $(srcdir)/../system.h |
310 | verify.o : verify.c $(CONFIG_H) $(JAVA_TREE_H) jcf.h javaop.h java-opcodes.h \ | |
311 | java-except.h $(srcdir)/../toplev.h $(srcdir)/../system.h | |
1f43f4b4 | 312 |