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
|
#! @SHELL@
# @configure_input@
# Make sure sorting is done the same on all configurations
# Note the use of sort -r below. This is done explicitly to work around
# a gcj bug (http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21418)
LC_ALL=C; export LC_ALL
LANG=C; export LANG
abs_top_builddir=`cd "${top_builddir}"; pwd`
abs_top_srcdir=`cd "@top_srcdir@"; pwd`
echo "Adding java source files from srcdir '${abs_top_srcdir}'."
# We construct 'classes.1' as a series of lines. Each line
# has three fields, which are separated by spaces. The first
# field is the package of this class (separated by "/"s).
# The second field is the absolute pathname of the top-level directory
# for this file. E.g., it might look like
# "/home/jezebel/classpath/vm/reference".
# The third field is the file name, like "java/lang/Object.java".
# We do this because it makes splitting for the gcj build much
# cheaper.
(cd @top_srcdir@
@FIND@ java javax gnu org sun -follow -name '*.java' -print |
sort -r | sed -e 's,/\([^/]*\)$, \1,' |
while read pkg file; do
echo $pkg ${abs_top_srcdir} $pkg/$file
done) > ${top_builddir}/lib/classes.1
# The same, but for the external code.
for dir in \
${abs_top_srcdir}/external/w3c_dom \
${abs_top_srcdir}/external/sax \
${abs_top_srcdir}/external/relaxngDatatype \
${abs_top_srcdir}/external/jsr166 \
; do
(cd $dir
for subdir in java javax gnu org sun; do
if test -d $subdir; then
@FIND@ $subdir -follow -name '*.java' -print |
sort -r | sed -e 's,/\([^/]*\)$, \1,' |
while read pkg file; do
echo $pkg $dir $pkg/$file
done
fi
done)
done >> ${top_builddir}/lib/classes.1
# Generate files for the VM classes.
: > vm.omit
: > vm.add
vm_dirlist=`echo "@vm_classes@" | sed -e 's/:/ /g'`
for dir in $vm_dirlist; do
echo "Adding java source files from VM directory $dir"
(cd $dir
for subdir in java javax gnu org com sun; do
if test -d $subdir; then
@FIND@ $subdir -name '*.java' -print
fi
done) | sed -e 's,/\([^/]*\)$, \1,' |
while read pkg file; do
echo $pkg $dir $pkg/$file >> vm.add
echo $pkg/$file >> vm.omit
done
done
# Only include generated files once.
if test "$abs_top_builddir" != "$abs_top_srcdir"; then
echo "Adding generated files in builddir '${top_builddir}'."
# Currently the only generated files are in gnu.*.
(cd ${top_builddir}; @FIND@ gnu -follow -name '*.java' -print) |
sort | sed -e 's,/\([^/]*\)$, \1,' |
while read pkg file; do
echo $pkg $top_builddir $pkg/$file
done >> ${top_builddir}/lib/classes.1
fi
cat $1.omit vm.omit > tmp.omit
for dir in $vm_dirlist; do
if test -f $dir/$1.omit; then
cat $dir/$1.omit >> tmp.omit
fi
done
# Mangle the omit expressions into a script suitable for old awk.
# Exploit the fact that many omissions are not regular expressions:
# assume a single file is listed if it does not contain '*', '$',
# and ends in '.java'.
sed_omit_hash='
1i\
BEGIN {\
omit[""] = 1
$a\
}
/[*$]/d
/\.java$/!d
s|^| omit["|
s|$|"] = 1|'
sed_omit_main_loop='
1i\
{\
if (omit[$3]) next
$a\
print\
}
/^[^*$]*\.java$/d
s|/|\\/|g
s|^| if ($3 ~ /|
s|$|/) next|'
sed "$sed_omit_hash" <tmp.omit >tmp.awk
sed "$sed_omit_main_loop" <tmp.omit >>tmp.awk
@AWK@ -f tmp.awk < ${top_builddir}/lib/classes.1 > ${top_builddir}/lib/classes.tmp
mv ${top_builddir}/lib/classes.tmp ${top_builddir}/lib/classes.1
vm_omitlist=
for dir in $vm_dirlist; do
if test -f $dir/$1.omit; then
vm_omitlist="$vm_omitlist $dir/$1.omit"
fi
done
cat $vm_omitlist | sed "$sed_omit_hash" > tmp.awk
cat $vm_omitlist | sed "$sed_omit_main_loop" >> tmp.awk
@AWK@ -f tmp.awk < vm.add >>${top_builddir}/lib/classes.1
rm -f vm.omit vm.add tmp.omit tmp.awk
new=
if test -f ${top_builddir}/lib/classes.2; then
p=`diff ${top_builddir}/lib/classes.2 ${top_builddir}/lib/classes.1`
if test "$p" != ""; then
new="true"
fi
else
new="true"
fi
if test "$new" = "true"; then
cp ${top_builddir}/lib/classes.1 ${top_builddir}/lib/classes.2
# Strip the package part.
sed -e 's/^[^ ]* //' -e 's, ,/,' < ${top_builddir}/lib/classes.1 \
> ${top_builddir}/lib/classes
echo "JAVA_SRCS = \\" > ${top_builddir}/lib/java.dep
for i in `cat ${top_builddir}/lib/classes` ; do
echo $i "\\" >> ${top_builddir}/lib/java.dep
done
fi
exit 0
|