summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorTom Tromey <tromey@redhat.com>2008-04-17 22:46:17 +0000
committerTom Tromey <tromey@redhat.com>2008-04-17 22:46:17 +0000
commit689e97df8425ac49681e9f1b025a28aa30cf26bc (patch)
treefc9ac17c83de28457209d990920bec6372d3a3a3 /lib
parent9e268dd5622aee27617856e25e05ba8efbb90265 (diff)
downloadclasspath-689e97df8425ac49681e9f1b025a28aa30cf26bc.tar.gz
2008-04-17 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
* lib/gen-classlist.sh.in: Avoid grepping each omission, by building an awk script with a hash for literal files, and awk regular expressions for the rest. * configure.ac: Call AC_PROG_AWK.
Diffstat (limited to 'lib')
-rwxr-xr-xlib/gen-classlist.sh.in48
1 files changed, 35 insertions, 13 deletions
diff --git a/lib/gen-classlist.sh.in b/lib/gen-classlist.sh.in
index ba540cfcc..159476907 100755
--- a/lib/gen-classlist.sh.in
+++ b/lib/gen-classlist.sh.in
@@ -82,26 +82,48 @@ for dir in $vm_dirlist; do
fi
done
-# FIXME: could be more efficient by constructing a series of greps.
-for filexp in `cat tmp.omit`; do
- grep -v ${filexp} < ${top_builddir}/lib/classes.1 > ${top_builddir}/lib/classes.tmp
- mv ${top_builddir}/lib/classes.tmp ${top_builddir}/lib/classes.1
-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
- for filexp in `cat $dir/$1.omit`; do
- grep -v $filexp < vm.add > vm.add.1
- mv vm.add.1 vm.add
- done
+ vm_omitlist="$vm_omitlist $dir/$1.omit"
fi
done
-cat vm.add >> classes.1
+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 vm.omit
-rm vm.add
-rm tmp.omit
+rm -f vm.omit vm.add tmp.omit tmp.awk
new=
if test -f ${top_builddir}/lib/classes.2; then