aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Waterman <waterman@cs.berkeley.edu>2014-11-01 20:00:48 -0700
committerAndrew Waterman <waterman@cs.berkeley.edu>2014-11-01 20:14:40 -0700
commit4cb6d87b7da8b852ed8ead5aebde99b1ea6abda7 (patch)
tree79ef269685a5fce60feaf7749a46b867d25279de
parentfe4c7d9583a3c06df08a7f013a901fd6a3456bfd (diff)
downloadriscv-gnu-toolchain-4cb6d87b7da8b852ed8ead5aebde99b1ea6abda7.zip
riscv-gnu-toolchain-4cb6d87b7da8b852ed8ead5aebde99b1ea6abda7.tar.gz
riscv-gnu-toolchain-4cb6d87b7da8b852ed8ead5aebde99b1ea6abda7.tar.bz2
Use symlinks instead of hard links
This allows the build dir to be on a different file system than the source dir, and it also enables proper operation of e.g. git checkout/stash.
-rwxr-xr-xMakefile.in14
-rwxr-xr-xscripts/cp_s19
2 files changed, 27 insertions, 6 deletions
diff --git a/Makefile.in b/Makefile.in
index 19d19c4..567dc10 100755
--- a/Makefile.in
+++ b/Makefile.in
@@ -51,7 +51,7 @@ $(addprefix src/original-,$(PACKAGES)):
$(addprefix src/,$(PACKAGES)): src/%: src/original-%
rm -rf $@ $@.tmp
cp -r $< $@.tmp
- rsync -a --link-dest=$(srcdir)/$(shell basename $@) $(srcdir)/$(shell basename $@)/ $@.tmp
+ $(srcdir)/scripts/cp_s $(srcdir)/$(shell basename $@) $@.tmp
cd $@.tmp && patch -p1 < $(srcdir)/patches/$(shell basename $@)
mv $@.tmp $@
@@ -59,7 +59,7 @@ $(addprefix src/,$(PACKAGES)): src/%: src/original-%
$(addprefix $(srcdir)/patches/,$(PACKAGES)): $(srcdir)/patches/%: src/%
-cd src/$(shell basename $@) && rm `cd $(srcdir)/$(shell basename $@) && find . -type f`
-cd src && diff --exclude=manual --exclude=autom4te.cache -rupN original-$(shell basename $@) $(shell basename $@) | filterdiff --remove-timestamps > $@
- rsync -a --link-dest=$(srcdir)/$(shell basename $@) $(srcdir)/$(shell basename $@)/ $<
+ $(srcdir)/scripts/cp_s $(srcdir)/$(shell basename $@) $<
patches: $(addprefix $(srcdir)/patches/,$(PACKAGES))
@@ -144,10 +144,12 @@ build-binutils-newlib: src/binutils
$(MAKE) -C $@ install
src/newlib-gcc: src/gcc src/newlib
- rm -rf $@
- rsync -a --link-dest=$(shell pwd)/src/gcc $(shell pwd)/src/gcc/* $@
- rsync -a --link-dest=$(shell pwd)/src/newlib/newlib $(shell pwd)/src/newlib/newlib $@
- rsync -a --link-dest=$(shell pwd)/src/newlib/libgloss $(shell pwd)/src/newlib/libgloss $@
+ rm -rf $@ $@.tmp
+ cp -r src/gcc $@.tmp
+ cp -r src/newlib/newlib $@.tmp
+ cp -r src/newlib/libgloss $@.tmp
+ $(srcdir)/scripts/cp_s $(srcdir)/newlib $@.tmp
+ mv $@.tmp $@
build-gcc-newlib: src/newlib-gcc build-binutils-newlib
rm -rf $@
diff --git a/scripts/cp_s b/scripts/cp_s
new file mode 100755
index 0000000..babc5e5
--- /dev/null
+++ b/scripts/cp_s
@@ -0,0 +1,19 @@
+#!/bin/bash
+# This script emulates the cp -s command, which Mac OS doesn't support.
+
+set -e
+
+pushd $1 > /dev/null
+SRCDIR=`pwd`
+DIRS=`find . -type d`
+FILES=`find . -type f`
+popd > /dev/null
+
+pushd $2 > /dev/null
+for i in $DIRS; do
+ mkdir -p $i
+done
+for i in $FILES; do
+ ln -f -s $SRCDIR/$i $i
+done
+popd > /dev/null