From 8a8ecda54a14bc67e6f0df223b55c8037fc5951b Mon Sep 17 00:00:00 2001 From: Dave Cheney Date: Sat, 19 Feb 2011 10:49:46 +1100 Subject: [PATCH] build: reduce the use of subshells in recursive make 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 | 2 +- src/pkg/Makefile | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/Make.common b/src/Make.common index e3f415a1f5..1e7209cd14 100644 --- a/src/Make.common +++ b/src/Make.common @@ -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 diff --git a/src/pkg/Makefile b/src/pkg/Makefile index 619167ca43..177bfdc23a 100644 --- a/src/pkg/Makefile +++ b/src/pkg/Makefile @@ -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 -- 2.48.1