* ipa-profie.c (ipa_profile): Check number of parameters
[official-gcc.git] / libjava / classpath / lib / gen-classlist.sh.in
bloba0971ff63b0e407b87f824bad423790b5982ca6a
1 #! @SHELL@
2 # @configure_input@
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
8 LANG=C; export LANG
10 abs_top_builddir=`cd "${top_builddir}"; pwd`
11 abs_top_srcdir=`cd "@top_srcdir@"; pwd`
13 echo "Adding java source files from srcdir '${abs_top_srcdir}'."
15 # We construct 'classes.1' as a series of lines. Each line
16 # has three fields, which are separated by spaces. The first
17 # field is the package of this class (separated by "/"s).
18 # The second field is the absolute pathname of the top-level directory
19 # for this file. E.g., it might look like
20 # "/home/jezebel/classpath/vm/reference".
21 # The third field is the file name, like "java/lang/Object.java".
22 # We do this because it makes splitting for the gcj build much
23 # cheaper.
24 (cd @top_srcdir@
25 @FIND@ java javax gnu org sun -follow -name '*.java' -print |
26 sort -r | sed -e 's,/\([^/]*\)$, \1,' |
27 while read pkg file; do
28 echo $pkg ${abs_top_srcdir} $pkg/$file
29 done) > ${top_builddir}/lib/classes.1
31 # The same, but for the external code.
32 for dir in \
33 ${abs_top_srcdir}/external/w3c_dom \
34 ${abs_top_srcdir}/external/sax \
35 ${abs_top_srcdir}/external/relaxngDatatype \
36 ${abs_top_srcdir}/external/jsr166 \
37 ; do
38 (cd $dir
39 for subdir in java javax gnu org sun; do
40 if test -d $subdir; then
41 @FIND@ $subdir -follow -name '*.java' -print |
42 sort -r | sed -e 's,/\([^/]*\)$, \1,' |
43 while read pkg file; do
44 echo $pkg $dir $pkg/$file
45 done
47 done)
48 done >> ${top_builddir}/lib/classes.1
50 # Generate files for the VM classes.
51 : > vm.omit
52 : > vm.add
53 vm_dirlist=`echo "@vm_classes@" | sed -e 's/:/ /g'`
54 for dir in $vm_dirlist; do
55 echo "Adding java source files from VM directory $dir"
56 (cd $dir
57 for subdir in java javax gnu org com sun; do
58 if test -d $subdir; then
59 @FIND@ $subdir -name '*.java' -print
61 done) | sed -e 's,/\([^/]*\)$, \1,' |
62 while read pkg file; do
63 echo $pkg $dir $pkg/$file >> vm.add
64 echo $pkg/$file >> vm.omit
65 done
66 done
68 # Only include generated files once.
69 if test "$abs_top_builddir" != "$abs_top_srcdir"; then
70 echo "Adding generated files in builddir '${top_builddir}'."
71 # Currently the only generated files are in gnu.*.
72 (cd ${top_builddir}; @FIND@ gnu -follow -name '*.java' -print) |
73 sort | sed -e 's,/\([^/]*\)$, \1,' |
74 while read pkg file; do
75 echo $pkg $top_builddir $pkg/$file
76 done >> ${top_builddir}/lib/classes.1
80 cat $1.omit vm.omit > tmp.omit
81 for dir in $vm_dirlist; do
82 if test -f $dir/$1.omit; then
83 cat $dir/$1.omit >> tmp.omit
85 done
87 # Mangle the omit expressions into a script suitable for old awk.
88 # Exploit the fact that many omissions are not regular expressions:
89 # assume a single file is listed if it does not contain '*', '$',
90 # and ends in '.java'.
91 sed_omit_hash='
92 1i\
93 BEGIN {\
94 omit[""] = 1
95 $a\
97 /[*$]/d
98 /\.java$/!d
99 s|^| omit["|
100 s|$|"] = 1|'
101 sed_omit_main_loop='
104 if (omit[$3]) next
106 print\
108 /^[^*$]*\.java$/d
109 s|/|\\/|g
110 s|^| if ($3 ~ /|
111 s|$|/) next|'
113 sed "$sed_omit_hash" <tmp.omit >tmp.awk
114 sed "$sed_omit_main_loop" <tmp.omit >>tmp.awk
115 @AWK@ -f tmp.awk < ${top_builddir}/lib/classes.1 > ${top_builddir}/lib/classes.tmp
116 mv ${top_builddir}/lib/classes.tmp ${top_builddir}/lib/classes.1
118 vm_omitlist=
119 for dir in $vm_dirlist; do
120 if test -f $dir/$1.omit; then
121 vm_omitlist="$vm_omitlist $dir/$1.omit"
123 done
124 cat $vm_omitlist | sed "$sed_omit_hash" > tmp.awk
125 cat $vm_omitlist | sed "$sed_omit_main_loop" >> tmp.awk
126 @AWK@ -f tmp.awk < vm.add >>${top_builddir}/lib/classes.1
128 rm -f vm.omit vm.add tmp.omit tmp.awk
130 new=
131 if test -f ${top_builddir}/lib/classes.2; then
132 p=`diff ${top_builddir}/lib/classes.2 ${top_builddir}/lib/classes.1`
133 if test "$p" != ""; then
134 new="true"
136 else
137 new="true"
140 if test "$new" = "true"; then
141 cp ${top_builddir}/lib/classes.1 ${top_builddir}/lib/classes.2
142 # Strip the package part.
143 sed -e 's/^[^ ]* //' -e 's, ,/,' < ${top_builddir}/lib/classes.1 \
144 > ${top_builddir}/lib/classes
145 echo "JAVA_SRCS = \\" > ${top_builddir}/lib/java.dep
146 for i in `cat ${top_builddir}/lib/classes` ; do
147 echo $i "\\" >> ${top_builddir}/lib/java.dep
148 done
151 exit 0