4 # Make sure sorting is done the same on all configurations
5 # Note the use of sort -r below. This is done explicitly to work around
6 # a gcj bug (http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21418)
7 LC_ALL
=C
; export LC_ALL
10 echo "Adding java source files from srcdir '@top_srcdir@'."
11 # We construct 'classes.1' as a series of lines. Each line
12 # has three fields, which are separated by spaces. The first
13 # field is the package of this class (separated by "/"s).
14 # The second field is the name of the top-level directory for
15 # this file, relative to the build directory. E.g., it might
16 # look like "../../classpath/vm/reference".
17 # The third field is the file name, like "java/lang/Object.java".
18 # We do this because it makes splitting for the gcj build much
21 @FIND@ java javax gnu org sun
-follow -name '*.java' -print |
22 sort -r |
sed -e 's,/\([^/]*\)$, \1,' |
23 while read pkg
file; do
24 echo $pkg @top_srcdir@
$pkg/$file
25 done) > ${top_builddir}/lib
/classes
.1
27 # The same, but for the external code.
29 @top_srcdir@
/external
/w3c_dom \
30 @top_srcdir@
/external
/sax \
31 @top_srcdir@
/external
/relaxngDatatype \
32 @top_srcdir@
/external
/jsr166 \
35 for subdir
in java javax gnu org sun
; do
36 if test -d $subdir; then
37 @FIND@
$subdir -follow -name '*.java' -print |
38 sort -r |
sed -e 's,/\([^/]*\)$, \1,' |
39 while read pkg
file; do
40 echo $pkg $dir $pkg/$file
44 done >> ${top_builddir}/lib
/classes
.1
46 # Generate files for the VM classes.
49 vm_dirlist
=`echo "@vm_classes@" | sed -e 's/:/ /g'`
50 for dir
in $vm_dirlist; do
51 echo "Adding java source files from VM directory $dir"
53 for subdir
in java javax gnu org com sun
; do
54 if test -d $subdir; then
55 @FIND@
$subdir -name '*.java' -print
57 done) |
sed -e 's,/\([^/]*\)$, \1,' |
58 while read pkg
file; do
59 echo $pkg $dir $pkg/$file >> vm.add
60 echo $pkg/$file >> vm.omit
64 # Only include generated files once.
65 abs_top_builddir
=`cd "${top_builddir}"; pwd`
66 abs_top_srcdir
=`cd "@top_srcdir@"; pwd`
67 if test "$abs_top_builddir" != "$abs_top_srcdir"; then
68 echo "Adding generated files in builddir '${top_builddir}'."
69 # Currently the only generated files are in gnu.*.
70 (cd ${top_builddir}; @FIND@ gnu
-follow -name '*.java' -print) |
71 sort |
sed -e 's,/\([^/]*\)$, \1,' |
72 while read pkg
file; do
73 echo $pkg $top_builddir $pkg/$file
74 done >> ${top_builddir}/lib
/classes
.1
78 cat $1.omit vm.omit
> tmp.omit
79 for dir
in $vm_dirlist; do
80 if test -f $dir/$1.omit
; then
81 cat $dir/$1.omit
>> tmp.omit
85 # FIXME: could be more efficient by constructing a series of greps.
86 for filexp
in `cat tmp.omit`; do
87 grep -v ${filexp} < ${top_builddir}/lib/classes.1 > ${top_builddir}/lib
/classes.tmp
88 mv ${top_builddir}/lib
/classes.tmp
${top_builddir}/lib
/classes
.1
92 for dir
in $vm_dirlist; do
93 if test -f $dir/$1.omit
; then
94 for filexp
in `cat $dir/$1.omit`; do
95 grep -v $filexp < vm.add
> vm.add
.1
100 cat vm.add
>> classes
.1
107 if test -f ${top_builddir}/lib
/classes
.2; then
108 p
=`diff ${top_builddir}/lib/classes.2 ${top_builddir}/lib/classes.1`
109 if test "$p" != ""; then
116 if test "$new" = "true"; then
117 cp ${top_builddir}/lib
/classes
.1 ${top_builddir}/lib
/classes
.2
118 # Strip the package part.
119 sed -e 's/^[^ ]* //' -e 's, ,/,' < ${top_builddir}/lib
/classes
.1 \
120 > ${top_builddir}/lib
/classes
121 echo "JAVA_SRCS = \\" > ${top_builddir}/lib
/java.dep
122 for i
in `cat ${top_builddir}/lib/classes` ; do
123 echo $i "\\" >> ${top_builddir}/lib
/java.dep