aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRuss Cox <rsc@golang.org>2011-04-13 16:24:57 -0400
committerRuss Cox <rsc@golang.org>2011-04-13 16:24:57 -0400
commit1499c78281d15fcc26198f3d61eb87b18729ed96 (patch)
tree21d6a3f1dba5ae9b4790c496894f28e114e93111
parent1d26908d3f625e7bb932fb297e50857f6af224cc (diff)
downloadgo-1499c78281d15fcc26198f3d61eb87b18729ed96.tar.gz
go-1499c78281d15fcc26198f3d61eb87b18729ed96.zip
build: tidy intermediate files during build
This CL changes the behavior of 'make install' and 'make test' in the src/cmd directory and the src/pkg directory to have each recursive make clean up after itself immediately. It does the same in test/run, removing $F.$A and $A.out (the common byproducts) between runs. On machines with slow disks and aggressive kernel caching, cleaning up immediately can mean that the intermediate objects never get written to disk. This change eliminates almost all the disk waiting during all.bash on my laptop (a Thinkpad X201s with an SSD running Linux). 147.50u 19.95s 277.34r before 148.53u 21.64s 179.59r after R=golang-dev, r, iant2 CC=golang-dev https://golang.org/cl/4413042
-rw-r--r--src/Make.common9
-rw-r--r--src/pkg/Makefile6
-rwxr-xr-xtest/run1
3 files changed, 13 insertions, 3 deletions
diff --git a/src/Make.common b/src/Make.common
index af6d04adc1..34d7016f42 100644
--- a/src/Make.common
+++ b/src/Make.common
@@ -5,6 +5,15 @@
clean:
rm -rf *.o *.a *.[$(OS)] [$(OS)].out $(CLEANFILES)
+install.clean: install
+ rm -rf *.o *.a *.[$(OS)] [$(OS)].out $(CLEANFILES)
+
+test.clean: test
+ rm -rf *.o *.a *.[$(OS)] [$(OS)].out $(CLEANFILES)
+
+testshort.clean: testshort
+ rm -rf *.o *.a *.[$(OS)] [$(OS)].out $(CLEANFILES)
+
%.make:
$(MAKE) -C $* install
diff --git a/src/pkg/Makefile b/src/pkg/Makefile
index 8eaf39d79d..2e6e092b0b 100644
--- a/src/pkg/Makefile
+++ b/src/pkg/Makefile
@@ -233,18 +233,18 @@ bench.dirs: $(addsuffix .bench, $(BENCH))
%.install:
+@echo install $*
- +@$(MAKE) -C $* install >$*/build.out 2>&1 || (echo INSTALL FAIL $*; cat $*/build.out; exit 1)
+ +@$(MAKE) -C $* install.clean >$*/build.out 2>&1 || (echo INSTALL FAIL $*; cat $*/build.out; exit 1)
%.nuke:
+$(MAKE) -C $* nuke
%.test:
+@echo test $*
- +@$(MAKE) -C $* test >$*/test.out 2>&1 || (echo TEST FAIL $*; cat $*/test.out; exit 1)
+ +@$(MAKE) -C $* test.clean >$*/test.out 2>&1 || (echo TEST FAIL $*; cat $*/test.out; exit 1)
%.testshort:
+@echo test $*
- +@$(MAKE) -C $* testshort >$*/test.out 2>&1 || (echo TEST FAIL $*; cat $*/test.out; exit 1)
+ +@$(MAKE) -C $* testshort.clean >$*/test.out 2>&1 || (echo TEST FAIL $*; cat $*/test.out; exit 1)
%.bench:
+$(MAKE) -C $* bench
diff --git a/test/run b/test/run
index a74933f358..628cc2d7b4 100755
--- a/test/run
+++ b/test/run
@@ -99,6 +99,7 @@ do
echo $i >>pass.out
fi
echo $(awk 'NR==1{print $2}' $TMP2FILE) $D/$F >>times.out
+ rm -f $F.$A $A.out
) done
done | # clean up some stack noise
egrep -v '^(r[0-9a-z]+|[cfg]s) +0x' |