]> Cypherpunks repositories - gostls13.git/commitdiff
build: reduce the use of subshells in recursive make
authorDave Cheney <dave@cheney.net>
Fri, 18 Feb 2011 23:49:46 +0000 (10:49 +1100)
committerAndrew Gerrand <adg@golang.org>
Fri, 18 Feb 2011 23:49:46 +0000 (10:49 +1100)
Using make -C $* rather than (cd $* ; make) results in a small,
but measurable improvement in build times where compilation is
not the major component. eg.

before - ~/go/src/pkg$ time make
        real 0m1.176s
        user 0m0.639s
        sys 0m0.399s
after - ~/go/src/pkg$ time make
        real 0m0.916s
        user 0m0.571s
        sys 0m0.243s

There are other places in the distribution src/make.common for example
that could also benefit from this change.

R=adg
CC=golang-dev, rsc
https://golang.org/cl/4174055

src/Make.common
src/pkg/Makefile

index e3f415a1f5ea42d99e1759e7a51440670948efa6..1e7209cd140a8d733d652a303ece2293b0b9cb02 100644 (file)
@@ -6,7 +6,7 @@ clean:
        rm -rf *.o *.a *.[$(OS)] [$(OS)].out $(CLEANFILES)
 
 %.make:
-       (cd $* && gomake install)
+       gomake -C $* install
 
 .PHONY: all clean nuke install coverage test bench testpackage-clean\ 
        importpath dir
index 619167ca43802538eb2909e91d7583153a0c263a..177bfdc23ab38a4dd68866056ede1429591ab5e1 100644 (file)
@@ -211,19 +211,19 @@ test.dirs: $(addsuffix .test, $(TEST))
 bench.dirs: $(addsuffix .bench, $(BENCH))
 
 %.clean:
-       +cd $* && $(MAKE) clean
+       +$(MAKE) -C $* clean
 
 %.install:
-       +cd $* && $(MAKE) install
+       +$(MAKE) -C $* install
 
 %.nuke:
-       +cd $* && $(MAKE) nuke
+       +$(MAKE) -C $* nuke
 
 %.test:
-       +cd $* && $(MAKE) test
+       +$(MAKE) -C $* test
 
 %.bench:
-       +cd $* && $(MAKE) bench
+       +$(MAKE) -C $* bench    
 
 clean: clean.dirs