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 -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.
28 # Right now all external code is in org/.
29 for dir in @top_srcdir@/external/w3c_dom \
30 @top_srcdir@/external/sax @top_srcdir@/external/relaxngDatatype; do
32 @FIND@ org -follow -name '*.java' -print |
33 sort -r | sed -e 's,/\([^/]*\)$, \1,' |
34 while read pkg file; do
35 echo $pkg $dir $pkg/$file
37 done >> ${top_builddir}/lib/classes.1
39 # Generate files for the VM classes.
42 vm_dirlist=`echo "@vm_classes@" | sed -e 's/:/ /g'`
43 for dir in $vm_dirlist; do
44 echo "Adding java source files from VM directory $dir"
46 for subdir in java javax gnu org com; do
47 if test -d $subdir; then
48 @FIND@ $subdir -name '*.java' -print
50 done) | sed -e 's,/\([^/]*\)$, \1,' |
51 while read pkg file; do
52 echo $pkg $dir $pkg/$file >> vm.add
53 echo $pkg/$file >> vm.omit
57 # Only include generated files once.
58 if test ! "${top_builddir}" -ef "@top_srcdir@"; then
59 echo "Adding generated files in builddir '${top_builddir}'."
60 # Currently the only generated files are in gnu.*.
61 (cd ${top_builddir}; @FIND@ gnu -follow -name '*.java' -print) |
62 sort | sed -e 's,/\([^/]*\)$, \1,' |
63 while read pkg file; do
64 echo $pkg $top_builddir $pkg/$file
65 done >> ${top_builddir}/lib/classes.1
69 cat @top_srcdir@/lib/$1.omit vm.omit > tmp.omit
70 for dir in $vm_dirlist; do
71 if test -f $dir/$1.omit; then
72 cat $dir/$1.omit >> tmp.omit
76 # FIXME: could be more efficient by constructing a series of greps.
77 for filexp in `cat tmp.omit`; do
78 grep -v ${filexp} < ${top_builddir}/lib/classes.1 > ${top_builddir}/lib/classes.tmp
79 mv ${top_builddir}/lib/classes.tmp ${top_builddir}/lib/classes.1
83 for dir in $vm_dirlist; do
84 if test -f $dir/$1.omit; then
85 for filexp in `cat $dir/$1.omit`; do
86 grep -v $filexp < vm.add > vm.add.1
91 cat vm.add >> classes.1
98 if test -e ${top_builddir}/lib/classes.2; then
99 p=`diff ${top_builddir}/lib/classes.2 ${top_builddir}/lib/classes.1`
100 if test "$p" != ""; then
107 if test "$new" = "true"; then
108 cp ${top_builddir}/lib/classes.1 ${top_builddir}/lib/classes.2
109 # Strip the package part.
110 sed -e 's/^[^ ]* //' -e 's, ,/,' < ${top_builddir}/lib/classes.1 \
111 > ${top_builddir}/lib/classes
112 echo "JAVA_SRCS = \\" > ${top_builddir}/lib/java.dep
113 for i in `cat ${top_builddir}/lib/classes` ; do
114 echo $i "\\" >> ${top_builddir}/lib/java.dep