aboutsummaryrefslogtreecommitdiff
path: root/gcc/java/Make-lang.in
blob: 1a17a98a8f319c6d8dd7272ce56471998cdf3820 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
# Top level makefile fragment for the GNU compiler for the Java(TM)
# language.
#   Copyright (C) 1996, 1998, 1999, 2000 Free Software Foundation, Inc.

#This file is part of GNU CC.

#GNU CC is free software; you can redistribute it and/or modify
#it under the terms of the GNU General Public License as published by
#the Free Software Foundation; either version 2, or (at your option)
#any later version.

#GNU CC is distributed in the hope that it will be useful,
#but WITHOUT ANY WARRANTY; without even the implied warranty of
#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#GNU General Public License for more details.

#You should have received a copy of the GNU General Public License
#along with GNU CC; see the file COPYING.  If not, write to
#the Free Software Foundation, 59 Temple Place - Suite 330,
#Boston, MA 02111-1307, USA.

#Java and all Java-based marks are trademarks or registered trademarks
#of Sun Microsystems, Inc. in the United States and other countries.
#The Free Software Foundation is independent of Sun Microsystems, Inc.

# This file provides the language dependent support in the main Makefile.
# Each language makefile fragment must provide the following targets:
#
# foo.all.build, foo.all.cross, foo.start.encap, foo.rest.encap,
# foo.info, foo.dvi,
# foo.install-normal, foo.install-common, foo.install-info, foo.install-man,
# foo.uninstall, foo.distdir,
# foo.mostlyclean, foo.clean, foo.distclean, foo.extraclean,
# foo.maintainer-clean, foo.stage1, foo.stage2, foo.stage3, foo.stage4
#
# where `foo' is the name of the language.
#
# It should also provide rules for:
#
# - making any compiler driver (eg: g++)
# - the compiler proper (eg: jc1)
# - define the names for selecting the language in LANGUAGES.
#
# Extra flags to pass to recursive makes.
JAVA_FLAGS_TO_PASS = \
	"JAVA_FOR_BUILD=$(JAVA_FOR_BUILD)" \
	"JAVAFLAGS=$(JAVAFLAGS)" \
	"JAVA_FOR_TARGET=$(JAVA_FOR_TARGET)"

# Actual names to use when installing a native compiler.
JAVA_INSTALL_NAME = `t='$(program_transform_name)'; echo gcj | sed $$t`

# Actual names to use when installing a cross-compiler.
JAVA_CROSS_NAME = `t='$(program_transform_cross_name)'; echo gcj | sed $$t`

#
GCJ = gcj

# Define the names for selecting java in LANGUAGES.
java: jc1$(exeext) $(GCJ)$(exeext) jvgenmain$(exeext) gcjh$(exeext) jv-scan$(exeext) jcf-dump$(exeext)

# Define the name of target independant tools to be installed in $(bindir)
# Names are subject to changes
JAVA_TARGET_INDEPENDENT_BIN_TOOLS = gcjh jv-scan jcf-dump

# Tell GNU make to ignore these if they exist.
.PHONY: java

# Remember to keep this list in sync with JAVA_OBJS in Makefile.in!!!
#
JAVA_SRCS = $(srcdir)/java/parse.y $(srcdir)/java/class.c \
  $(srcdir)/java/decl.c $(srcdir)/java/expr.c $(srcdir)/java/constants.c \
  $(srcdir)/java/lang.c $(srcdir)/java/typeck.c $(srcdir)/java/except.c \
  $(srcdir)/java/verify.c $(srcdir)/java/zextract.c $(srcdir)/java/jcf-io.c \
  $(srcdir)/java/jcf-parse.c $(srcdir)/java/mangle.c \
  $(srcdir)/java/jcf-write.c $(srcdir)/java/buffer.c \
  $(srcdir)/java/check-init.c $(srcdir)/java/lex.c $(srcdir)/java/boehm.c \
  $(srcdir)/java/jcf-depend.c  $(srcdir)/java/jcf-path.c \
  $(srcdir)/java/java-tree.h

jvspec.o: $(srcdir)/java/jvspec.c system.h $(GCC_H)
	$(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) \
		$(INCLUDES) $(srcdir)/java/jvspec.c

# Create the compiler driver for $(GCJ).
$(GCJ)$(exeext): gcc.o jvspec.o version.o \
	   prefix.o intl.o $(LIBDEPS) $(EXTRA_GCC_OBJS)
	$(CC) $(ALL_CFLAGS) $(LDFLAGS) -o $@ gcc.o jvspec.o prefix.o intl.o \
	  version.o $(EXTRA_GCC_OBJS) $(LIBS)

# Create a version of the $(GCJ) driver which calls the cross-compiler.
$(GCJ)-cross$(exeext): $(GCJ)$(exeext)
	-rm -f $(GCJ)-cross$(exeext)
	cp $(GCJ)$(exeext) $(GCJ)-cross$(exeext)

# Dependencies here must be kept in sync with dependencies in Makefile.in.
jvgenmain$(exeext): $(srcdir)/java/jvgenmain.c $(srcdir)/java/mangle.c \
		$(LIBDEPS) $(TREE_H)
	cd java && $(MAKE) $(LANG_FLAGS_TO_PASS) $(JAVA_FLAGS_TO_PASS) ../jvgenmain$(exeext)

# This must be kept in sync with dependencies in Makefile.in.
GCJH_SOURCES = $(srcdir)/java/gjavah.c $(srcdir)/java/jcf-io.c \
	$(srcdir)/java/zextract.c $(srcdir)/java/jcf-reader.c \
	$(srcdir)/java/jcf.h $(srcdir)/java/javaop.h \
	$(srcdir)/java/javaop.def $(srcdir)/java/jcf-depend.c \
	$(srcdir)/java/jcf-path.c

$(INTL_TARGETS): $(srcdir)/java/parse.c $(srcdir)/java/parse-scan.c

# Separating PARSE_DIR from PARSE_RELDIR lets us easily change the
# code to support building parse.c in the build directory, at some
# expense in readability.
# This code must be kept in sync with Makefile.in.
PARSE_DIR = $(srcdir)/java
PARSE_RELDIR = .
PARSE_C = $(PARSE_DIR)/parse.c
PARSE_SCAN_C = $(PARSE_DIR)/parse-scan.c

SET_BISON = here=`pwd`; sdir=`cd $(srcdir) && pwd`; if test -f ../bison; then bison="$$here/../bison/bison -L $$sdir"; else bison=bison; fi
BISONFLAGS =
JAVABISONFLAGS = --name-prefix=java_

$(PARSE_C):  $(srcdir)/java/parse.y
	$(SET_BISON); \
	cd $(PARSE_DIR) && $$bison -t $(BISONFLAGS) $(JAVABISONFLAGS) \
	    -o parse.c $(PARSE_RELDIR)/parse.y
$(PARSE_SCAN_C):  $(srcdir)/java/parse-scan.y
	$(SET_BISON); \
	cd $(PARSE_DIR) && $$bison -t $(BISONFLAGS) -o parse-scan.c \
	    $(PARSE_RELDIR)/parse-scan.y

# This must be kept in sync with dependencies in Makefile.in.
JV_SCAN_SOURCES = $(srcdir)/java/parse-scan.y $(srcdir)/java/lex.c \
       $(srcdir)/java/parse.h $(srcdir)/java/lex.h $(srcdir)/java/jv-scan.c

# This must be kept in sync with dependencies in Makefile.in.
JCF_DUMP_SOURCES = $(srcdir)/java/jcf-dump.c $(srcdir)/java/jcf-io.c \
       $(srcdir)/java/zextract.c $(TREE_H)

jc1$(exeext) gcjh$(exeext) jv-scan$(exeext) jcf-dump$(exeext): s-java

s-java: $(P) $(JAVA_SRCS) $(LIBDEPS) $(BACKEND) ggc-callbacks.o \
	$(GCJH_SOURCES) $(LIBDEPS) $(TREE_H) \
	$(JV_SCAN_SOURCES) $(BACKEND) $(LIBDEPS) \
	$(JCF_DUMP_SOURCES)
	cd java; $(MAKE) $(LANG_FLAGS_TO_PASS) $(JAVA_FLAGS_TO_PASS) \
	../jc1$(exeext) \
	../gcjh$(exeext) \
	../jv-scan$(exeext) \
	../jcf-dump$(exeext)
	touch s-java
#
# Build hooks:

java.all.build: $(GCJ)$(exeext)
java.all.cross: $(GCJ)-cross$(exeext)
java.start.encap: $(GCJ)$(exeext)
java.rest.encap:

java.info:

# Install hooks:
# jc1, gcj, jvgenmain, and gcjh are installed elsewhere as part
# of $(COMPILERS).

# Nothing to do here.
java.install-normal:

java.install-common:
	-if [ -f $(GCJ)$(exeext) ]; then \
	  if [ -f $(GCJ)-cross$(exeext) ]; then \
	    rm -f $(bindir)/$(JAVA_CROSS_NAME)$(exeext); \
	    $(INSTALL_PROGRAM) $(GCJ)-cross$(exeext) $(bindir)/$(JAVA_CROSS_NAME)$(exeext); \
	    chmod a+x $(bindir)/$(JAVA_CROSS_NAME)$(exeext); \
	  else \
	    rm -f $(bindir)/$(JAVA_INSTALL_NAME)$(exeext); \
	    $(INSTALL_PROGRAM) $(GCJ)$(exeext) $(bindir)/$(JAVA_INSTALL_NAME)$(exeext); \
	    chmod a+x $(bindir)/$(JAVA_INSTALL_NAME)$(exeext); \
	  fi ; \
	fi ; \
        for tool in $(JAVA_TARGET_INDEPENDENT_BIN_TOOLS); do \
          if [ -f $$tool$(exeext) ]; then \
	    rm -f $(bindir)/$$tool$(exeext); \
	    $(INSTALL_PROGRAM) $$tool$(exeext) $(bindir)/$$tool$(exeext); \
	    chmod a+x $(bindir)/$$tool$(exeext); \
          fi ; \
       done

java.install-man:

java.uninstall:
	-rm -rf $(bindir)/$(JAVA_INSTALL_NAME)$(exeext)
	-rm -rf $(bindir)/$(JAVA_CROSS_NAME)$(exeext)

java.install-info:

#
# Clean hooks:
# A lot of the ancillary files are deleted by the main makefile.
# We just have to delete files specific to us.

java.mostlyclean:
	-rm -f java/*$(objext) $(DEMANGLER_PROG)
	-rm -f jc1$(exeext) $(GCJ)$(exeext) jvgenmain$(exeext) gcjh$(exeext) jv-scan$(exeext) jcf-dump$(exeext) s-java
java.clean:
java.distclean:
	-rm -f java/config.status java/Makefile
	-rm -f java/parse.output
java.extraclean:
java.maintainer-clean:
	-rm -f java/parse.c java/parse-scan.c java/parse.output java/y.tab.c
#
# Stage hooks:
# The main makefile has already created stage?/java.

java.stage1: stage1-start
	-mv java/*$(objext) stage1/java
java.stage2: stage2-start
	-mv java/*$(objext) stage2/java
java.stage3: stage3-start
	-mv java/*$(objext) stage3/java
java.stage4: stage4-start
	-mv java/*$(objext) stage4/java
#
# Maintenance hooks:

# This target creates the files that can be rebuilt, but go in the
# distribution anyway.  It then copies the files to the distdir directory.
java.distdir:
	mkdir tmp/java
	cd java ; $(MAKE) $(LANG_FLAGS_TO_PASS) $(JAVA_FLAGS_TO_PASS) parse.c hash.h
	cd java; \
	for file in *[0-9a-zA-Z+]; do \
	  ln $$file ../tmp/java >/dev/null 2>&1 || cp $$file ../tmp/java; \
	done