1 |
781 |
jeremybenn |
#! /bin/sh
|
2 |
|
|
|
3 |
|
|
# This script is used when compiling Classpath with gcj. The idea is
|
4 |
|
|
# to compile one package at a time, and only recompile packages when
|
5 |
|
|
# actually required.
|
6 |
|
|
|
7 |
|
|
# We build java->class by package so we need to know what .java files
|
8 |
|
|
# correspond to what package.
|
9 |
|
|
|
10 |
|
|
# We have a .stamp file for each package; this is the makefile target.
|
11 |
|
|
# We also have a .list file for each package, which lists all the
|
12 |
|
|
# input files in that package.
|
13 |
|
|
|
14 |
|
|
# gen-classlist.sh makes a list of all the .java files we are going to compile.
|
15 |
|
|
|
16 |
|
|
# This script generates Makefile.deps, which looks like this:
|
17 |
|
|
#
|
18 |
|
|
# java/awt/AWTUtilities.class: lists/java-awt.stamp
|
19 |
|
|
# lists/java-awt.list: /home/aph/gcc/gcc/libjava/classpath/gnu/java/awt/AWTUtilities.java
|
20 |
|
|
# java/awt/BitMaskExtent.class: lists/java-awt.stamp
|
21 |
|
|
# lists/java-awt.list: /home/aph/gcc/gcc/libjava/classpath/gnu/java/awt/BitMaskExtent.java
|
22 |
|
|
# java/awt/BitwiseXORComposite.class: lists/java-awt.stamp
|
23 |
|
|
# lists/java-awt.list: /home/aph/gcc/gcc/libjava/classpath/gnu/java/awt/BitwiseXORComposite.java
|
24 |
|
|
|
25 |
|
|
echo "Splitting for gcj"
|
26 |
|
|
rm -f Makefile.dtmp > /dev/null 2>&1
|
27 |
|
|
test -d lists || mkdir lists
|
28 |
|
|
# Much more efficient to do processing outside the loop...
|
29 |
|
|
# The first expression computes the .class file name.
|
30 |
|
|
# We only want the first three package components, and
|
31 |
|
|
# we want them separated by '-'; this is the remaining expressions.
|
32 |
|
|
sed -e 's, \(.*\)[.]java$, \1.java \1.class,' \
|
33 |
|
|
-e 's,^\([^/ ]*\)/\([^/ ]*\) ,\1-\2 ,' \
|
34 |
|
|
-e 's,^\([^/ ]*\)/\([^/ ]*\)/\([^/ ]*\) ,\1-\2-\3 ,' \
|
35 |
|
|
-e 's,^\([^/ ]*\)/\([^/ ]*\)/\([^/ ]*\)/[^ ]* ,\1-\2-\3 ,' \
|
36 |
|
|
classes.2 |
|
37 |
|
|
while read pkg dir file f2; do
|
38 |
|
|
list=lists/$pkg
|
39 |
|
|
echo "$dir/$file" >> ${list}.list.1
|
40 |
|
|
|
41 |
|
|
echo "$f2: ${list}.stamp" >> Makefile.dtmp
|
42 |
|
|
echo "${list}.list: $dir/$file" >> Makefile.dtmp
|
43 |
|
|
done
|
44 |
|
|
|
45 |
|
|
# Only update a .list file if it changed.
|
46 |
|
|
for file in lists/*.list.1; do
|
47 |
|
|
real=`echo "$file" | sed -e 's/.1$//'`
|
48 |
|
|
if cmp -s $real $file; then
|
49 |
|
|
rm $file
|
50 |
|
|
else
|
51 |
|
|
mv $file $real
|
52 |
|
|
fi
|
53 |
|
|
done
|
54 |
|
|
|
55 |
|
|
# If we were run we must update Makefile.deps.
|
56 |
|
|
mv Makefile.dtmp Makefile.deps
|