summaryrefslogtreecommitdiff
path: root/lib/gen-classlist.sh.in
blob: 12845f2ccee083d954245e90d118292d54550aac (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
#! @SHELL@
# @configure_input@

# Make sure sorting is done the same on all configurations
LC_ALL=C; export LC_ALL
LANG=C; export LANG

# We use this to decide whether we need to invoke the split script.
GCJ="@GCJ@"

echo "Adding java source files from srcdir '@top_srcdir@'."
@FIND@ @top_srcdir@/java @top_srcdir@/javax @top_srcdir@/gnu \
       @top_srcdir@/org \
       @top_srcdir@/external/w3c_dom @top_srcdir@/external/sax \
       -follow -type f -print | sort | grep '\.java$' \
       > ${top_builddir}/lib/classes.1

# Generate files for the VM classes.
: > vm.omit
: > vm.add
vm_dirlist=`echo "@vm_classes@" | sed -e 's/:/ /g'`
echo "Adding java source files from VM directory $vm_dirlist"
for dir in $vm_dirlist; do
   (cd $dir
   for subdir in java javax gnu org; do
      if test -d $subdir; then
	 @FIND@ $subdir -name '*.java' -print
      fi
   done) |
   while read f; do
      echo $dir/$f >> vm.add
      echo $f >> vm.omit
   done
done

# Only include generated files once.
if test ! "${top_builddir}" -ef "@top_srcdir@"; then
  echo "Adding generated files in builddir '${top_builddir}'."
  @FIND@ ${top_builddir}/gnu ${top_builddir}/java -follow -type f -print \
  | sort | grep '\.java$' >> ${top_builddir}/lib/classes.1
fi


cat @top_srcdir@/lib/$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

for filexp in `cat tmp.omit`; do
   grep -v ${filexp} < ${top_builddir}/lib/classes.1 > ${top_builddir}/lib/classes.2
   mv ${top_builddir}/lib/classes.2 ${top_builddir}/lib/classes.1
done


for dir in $vm_dirlist; do
   if test -f $dir/$1.omit; then
      for filexp in `cat $dir/$1.omit`; do
	 grep -v $filexp < vm.add > vm.add.1
	 mv vm.add.1 vm.add
      done
   fi
done
cat vm.add >> classes.1

rm vm.omit
rm vm.add
rm tmp.omit

new=
if test -e ${top_builddir}/lib/classes; then
  p=`diff ${top_builddir}/lib/classes ${top_builddir}/lib/classes.1`
  if test "$p" != ""; then
    new="true"
    cp ${top_builddir}/lib/classes.1 ${top_builddir}/lib/classes
  fi
else
  new="true"
  cp ${top_builddir}/lib/classes.1 ${top_builddir}/lib/classes
fi

if test "$new" = "true"; then
  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