summaryrefslogtreecommitdiff
path: root/libjava/classpath/lib/split-for-gcj.sh
diff options
context:
space:
mode:
authorupstream source tree <ports@midipix.org>2015-03-15 20:14:05 -0400
committerupstream source tree <ports@midipix.org>2015-03-15 20:14:05 -0400
commit554fd8c5195424bdbcabf5de30fdc183aba391bd (patch)
tree976dc5ab7fddf506dadce60ae936f43f58787092 /libjava/classpath/lib/split-for-gcj.sh
downloadcbb-gcc-4.6.4-554fd8c5195424bdbcabf5de30fdc183aba391bd.tar.bz2
cbb-gcc-4.6.4-554fd8c5195424bdbcabf5de30fdc183aba391bd.tar.xz
obtained gcc-4.6.4.tar.bz2 from upstream website;upstream
verified gcc-4.6.4.tar.bz2.sig; imported gcc-4.6.4 source tree from verified upstream tarball. downloading a git-generated archive based on the 'upstream' tag should provide you with a source tree that is binary identical to the one extracted from the above tarball. if you have obtained the source via the command 'git clone', however, do note that line-endings of files in your working directory might differ from line-endings of the respective files in the upstream repository.
Diffstat (limited to 'libjava/classpath/lib/split-for-gcj.sh')
-rwxr-xr-xlibjava/classpath/lib/split-for-gcj.sh56
1 files changed, 56 insertions, 0 deletions
diff --git a/libjava/classpath/lib/split-for-gcj.sh b/libjava/classpath/lib/split-for-gcj.sh
new file mode 100755
index 000000000..4130d5664
--- /dev/null
+++ b/libjava/classpath/lib/split-for-gcj.sh
@@ -0,0 +1,56 @@
+#! /bin/sh
+
+# This script is used when compiling Classpath with gcj. The idea is
+# to compile one package at a time, and only recompile packages when
+# actually required.
+
+# We build java->class by package so we need to know what .java files
+# correspond to what package.
+
+# We have a .stamp file for each package; this is the makefile target.
+# We also have a .list file for each package, which lists all the
+# input files in that package.
+
+# gen-classlist.sh makes a list of all the .java files we are going to compile.
+
+# This script generates Makefile.deps, which looks like this:
+#
+# java/awt/AWTUtilities.class: lists/java-awt.stamp
+# lists/java-awt.list: /home/aph/gcc/gcc/libjava/classpath/gnu/java/awt/AWTUtilities.java
+# java/awt/BitMaskExtent.class: lists/java-awt.stamp
+# lists/java-awt.list: /home/aph/gcc/gcc/libjava/classpath/gnu/java/awt/BitMaskExtent.java
+# java/awt/BitwiseXORComposite.class: lists/java-awt.stamp
+# lists/java-awt.list: /home/aph/gcc/gcc/libjava/classpath/gnu/java/awt/BitwiseXORComposite.java
+
+echo "Splitting for gcj"
+rm -f Makefile.dtmp > /dev/null 2>&1
+test -d lists || mkdir lists
+# Much more efficient to do processing outside the loop...
+# The first expression computes the .class file name.
+# We only want the first three package components, and
+# we want them separated by '-'; this is the remaining expressions.
+sed -e 's, \(.*\)[.]java$, \1.java \1.class,' \
+ -e 's,^\([^/ ]*\)/\([^/ ]*\) ,\1-\2 ,' \
+ -e 's,^\([^/ ]*\)/\([^/ ]*\)/\([^/ ]*\) ,\1-\2-\3 ,' \
+ -e 's,^\([^/ ]*\)/\([^/ ]*\)/\([^/ ]*\)/[^ ]* ,\1-\2-\3 ,' \
+ classes.2 |
+while read pkg dir file f2; do
+ list=lists/$pkg
+ echo "$dir/$file" >> ${list}.list.1
+
+ echo "$f2: ${list}.stamp" >> Makefile.dtmp
+ echo "${list}.list: $dir/$file" >> Makefile.dtmp
+done
+
+# Only update a .list file if it changed.
+for file in lists/*.list.1; do
+ real=`echo "$file" | sed -e 's/.1$//'`
+ if cmp -s $real $file; then
+ rm $file
+ else
+ mv $file $real
+ fi
+done
+
+# If we were run we must update Makefile.deps.
+mv Makefile.dtmp Makefile.deps