summaryrefslogtreecommitdiff
path: root/lib/Makefile.am
blob: a7fbb19222ba33a0d647f463c1c57bcbf7985b28 (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
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
# We do not really support building with javac anymore but we can
# resurrect this...
# --cbj
## used by automake to generate Makefile.in

MAKEFILE_DEPEND = makefile.dep
HEADERS_DEPEND = headers.dep
CLASSES_DEPEND = classes.dep
JAVA_DEPEND = java.dep

## silently try to include these, if it fails gnu make
## will remake these 'makefiles' with the rules given in
## this file and restart the make process again
sinclude $(JAVA_DEPEND)
sinclude $(HEADERS_DEPEND)


#-----------------------------------------------------------------
# defining a javac program written in java
#-----------------------------------------------------------------
KJC_MAIN = at.dms.kjc.Main
SUN_JAVAC_MAIN = sun.tools.javac.Main

if USER_SPECIFIED_KJC
JAVAC_MAIN = $(KJC_MAIN)
else
JAVAC_MAIN = $(SUN_JAVAC_MAIN)
endif
#-----------------------------------------------------------------


#-----------------------------------------------------------------
# defining how to designate classpath for a vm and a javac type 
# program
#-----------------------------------------------------------------
if JAPHAR
if USER_SPECIFIED_JABBA
ARG_CLASSPATH_VM = -classpath
else
ARG_CLASSPATH_VM = --classpath
endif
else
ARG_CLASSPATH_VM = -classpath
endif

if USER_SPECIFIED_KJC
ARG_CLASSPATH_JAVAC = --classpath
else
ARG_CLASSPATH_JAVAC = -classpath
endif
#-----------------------------------------------------------------


#-----------------------------------------------------------------
# defining a java-like program
#-----------------------------------------------------------------
if USER_SPECIFIED_JABBA
USER_JABBA = @USER_JABBA@
else

if JAPHAR
USER_JABBA = @JAPHAR_JABBA@
else

if KAFFE
USER_JABBA = @KAFFE_JABBA@
else
USER_JABBA = java
endif

endif

endif
#-----------------------------------------------------------------


#-----------------------------------------------------------------
# defining the classpath for the java-like program, and 
# the javac-like program
#-----------------------------------------------------------------
if USER_SPECIFIED_CLASSLIB
USER_CLASSLIB = @USER_CLASSLIB@
else

if JAPHAR
USER_CLASSLIB = @JAPHAR_CLASSLIB@
else

if KAFFE
USER_CLASSLIB = @KAFFE_CLASSLIB@
else
USER_CLASSLIB = /usr/local/java/lib/classes.zip
endif

endif

endif

#-----------------------------------------------------------------


#-----------------------------------------------------------------
# handling javac definition including programs like jikes here
#-----------------------------------------------------------------
if USER_SPECIFIED_KJC
JAVAC = $(USER_JABBA) $(ARG_CLASSPATH_VM) @KJC_CLASSPATH@:$(USER_CLASSLIB) $(JAVAC_MAIN) $(ARG_CLASSPATH_JAVAC) .:$(USER_CLASSLIB) -d . @classes
else

if USER_SPECIFIED_JIKES

if USER_SPECIFIED_CLASSLIB
JAVAC = @JIKES@ -nowarn +CSO +F $(ARG_CLASSPATH_JAVAC) ..:../vm/current:.:@USER_CLASSLIB@ -d . @classes
else
JAVAC = @JIKES@ -nowarn +CSO +M +F $(ARG_CLASSPATH_JAVAC) ..:../vm/current:. -d . @classes
endif

else
JAVAC = $(USER_JABBA) $(ARG_CLASSPATH_VM) $(USER_CLASSLIB) $(JAVAC_MAIN) $(ARG_CLASSPATH_JAVAC) .:$(USER_CLASSLIB) -d . $(JAVA_SRCS)
endif

endif
#-----------------------------------------------------------------


#-----------------------------------------------------------------
# defining how to designate classpath for a vm and a javac type 
# program
#-----------------------------------------------------------------
if JAPHAR

if USER_SPECIFIED_JAVAH
ARG_JNI_JAVAH = -jni
else
ARG_JNI_JAVAH = --jni
endif

else
ARG_JNI_JAVAH = -jni
endif
#-----------------------------------------------------------------


#-----------------------------------------------------------------
# defining a javah-like program
#-----------------------------------------------------------------
if USER_SPECIFIED_JAVAH
USER_JAVAH = @USER_JAVAH@
else

if JAPHAR
USER_JAVAH = @JAPHAR_JAVAH@
else

if KAFFE
USER_JAVAH = @KAFFE_JAVAH@
else
USER_JAVAH = javah
endif

endif

endif
#-----------------------------------------------------------------


#-----------------------------------------------------------------
# defining classpath arg for javah-like program
#-----------------------------------------------------------------
if JAPHAR

if USER_SPECIFIED_JAVAH
ARG_CLASSPATH_JAVAH = -classpath
else
ARG_CLASSPATH_JAVAH = --classpath
endif

else
ARG_CLASSPATH_JAVAH = -classpath
endif
#-----------------------------------------------------------------

JAVAH = $(USER_JAVAH) $(ARG_JNI_JAVAH) $(ARG_CLASSPATH_JAVAH) .:$(USER_CLASSLIB)


pkgdata_DATA = glibj.zip
install-data-local :
	if ! [ -e $(pkgdatadir) ]; then mkdir -p $(pkgdatadir); fi
	unzip -d $(pkgdatadir) glibj.zip

all: $(HEADERS_DEPEND) glibj.zip $(CP_HEADERS)
#jar-classes

# this makes headers always generate after making glibj.zip
$(CP_HEADERS) : headers.dep

#.PHONY: jar-classes
glibj.zip: classes compile-classes $(MAKEFILE_DEPEND)
	if ! [ -e gnu ]; then mkdir gnu; fi
	if ! [ -e gnu/java ]; then mkdir gnu/java; fi
	if ! [ -e gnu/java/locale ]; then mkdir gnu/java/locale; fi
	cp $(top_srcdir)/gnu/java/locale/*.properties gnu/java/locale/
	cp $(top_srcdir)/gnu/java/locale/*.uni gnu/java/locale/
	# do something with all the .u files from jikes
	$(ZIP) -r -D glibj.zip gnu java javax > /dev/null

classes: gen-classlist.sh standard.omit $(top_srcdir)/java $(top_srcdir)/javax $(top_srcdir)/gnu
	$(SHELL) -c "cd $(top_srcdir)/lib && ./gen-classlist.sh standard"

.PHONY: dep
dep: classes
	$(SHELL) -c "cd $(top_srcdir)/lib; ./mkdep.pl -s"

#.PHONY: compile-classes
compile-classes: classes $(JAVA_DEPEND) $(JAVA_SRCS) Makefile
	$(JAVAC)
	touch compile-classes

$(MAKEFILE_DEPEND): compile-classes
	$(SHELL) -c "cd $(top_srcdir)/lib && ./mkdep.pl -d"
	$(SHELL) -c "cd $(top_srcdir)/lib && find -regex ".*\.u$" -exec rm \{\} \;

$(HEADERS_DEPEND): classes
	if ! [ -e $(top_srcdir)/include ]; then -mkdir $(top_srcdir)/include; fi	
	$(SHELL) -c "cd $(top_srcdir)/lib && ./mkdep.pl -h"

$(CLASSES_DEPEND): classes
	$(SHELL) -c "cd $(top_srcdir)/lib && ./mkdep.pl -c"

$(JAVA_DEPEND): classes
	$(SHELL) -c "cd $(top_srcdir)/lib && ./mkdep.pl -j"

## neither developer nor maintainer...

##MDEPEND = $(SHELL test -r $(MAKEFILE_DEPEND) && echo "true")
##@REMOVE@ifeq ($(MDEPEND),true)
##@REMOVE@	include $(MAKEFILE_DEPEND)
##@REMOVE@else
##@REMOVE@	$(SHELL) -c "cd $(top_srcdir)/lib; ./mkdep.pl -d"
##@REMOVE@	include $(MAKEFILE_DEPEND)
##@REMOVE@endif

##HDEPEND = $(SHELL test -r $(HEADERS_DEPEND) && echo "true")
##@REMOVE@ifeq ($(HDEPEND),true)
##@REMOVE@	include $(HEADERS_DEPEND)
##@REMOVE@else
##@REMOVE@	$(SHELL) -c "cd $(top_srcdir)/lib; ./mkdep.pl -h"
##@REMOVE@	include $(HEADERS_DEPEND)
##@REMOVE@endif

##CDEPEND = $(SHELL test -r $(CLASSES_DEPEND) && echo "true")
##@REMOVE@ifeq ($(CDEPEND),true)
##@REMOVE@	include $(CLASSES_DEPEND)
##@REMOVE@else
##@REMOVE@	$(SHELL) -c "cd $(top_srcdir)/lib; ./mkdep.pl -c"
##@REMOVE@	include $(CLASSES_DEPEND)
##@REMOVE@endif

##endif

##endif

EXTRA_DIST = glibj.zip standard.omit mkcollections.pl.in
## not sure if we want to let the user easily get rid of glibj.zip
## CLEANFILES = glibj.zip
DISTCLEANFILES = $(CLASSES) $(CP_HEADERS)
MAINTAINERCLEANFILES = makefile.dep $(JAVA_DEPEND) $(HEADERS_DEPEND)

maintainer-clean-local:
	-rm -rf gnu
	-rm -rf java
	-rm -rf javax
	-rm -rf kaffe