From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by dpdk.org (Postfix) with ESMTP id B44C1108D for ; Sun, 22 Jan 2017 02:50:38 +0100 (CET) Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orsmga101.jf.intel.com with ESMTP; 21 Jan 2017 17:50:37 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.33,267,1477983600"; d="scan'208";a="56079179" Received: from sivswdev02.ir.intel.com ([10.237.217.46]) by fmsmga005.fm.intel.com with ESMTP; 21 Jan 2017 17:50:36 -0800 From: Ferruh Yigit To: dev@dpdk.org, Thomas Monjalon Cc: Ferruh Yigit Date: Sun, 22 Jan 2017 01:50:34 +0000 Message-Id: <20170122015034.19824-1-ferruh.yigit@intel.com> X-Mailer: git-send-email 2.8.4 Subject: [dpdk-dev] [PATCH] mk: parallelize make config X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 22 Jan 2017 01:50:39 -0000 make config dependency resolving was always running serial, parallelize it for better performance. $ time make T=x86_64-native-linuxapp-gcc config real 0m12.633s $ time make -j8 T=x86_64-native-linuxapp-gcc config real 0m1.826s Signed-off-by: Ferruh Yigit --- mk/internal/rte.depdirs-post.mk | 11 ++++++----- mk/rte.sdkdepdirs.mk | 21 ++++++++++++--------- mk/rte.subdir.mk | 15 +++++++-------- 3 files changed, 25 insertions(+), 22 deletions(-) diff --git a/mk/internal/rte.depdirs-post.mk b/mk/internal/rte.depdirs-post.mk index 102a369..eb73ad3 100644 --- a/mk/internal/rte.depdirs-post.mk +++ b/mk/internal/rte.depdirs-post.mk @@ -29,11 +29,12 @@ # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -.PHONY: depdirs -depdirs: - @for d in $(DEPDIRS-y); do \ - $(RTE_SDK)/buildtools/depdirs-rule.sh $(S) $$d ; \ - done +.PHONY: depdirs $(DEPDIRS-y) +depdirs: $(DEPDIRS-y) + @echo "" + +$(DEPDIRS-y): + @$(RTE_SDK)/buildtools/depdirs-rule.sh $(S) $@ .PHONY: depgraph depgraph: diff --git a/mk/rte.sdkdepdirs.mk b/mk/rte.sdkdepdirs.mk index bebaf2a..daf42eb 100644 --- a/mk/rte.sdkdepdirs.mk +++ b/mk/rte.sdkdepdirs.mk @@ -36,19 +36,22 @@ ifeq (,$(wildcard $(RTE_OUTPUT)/Makefile)) $(error "need a make config first") endif +DEPDIRS = $(addsuffix /.depdirs, $(addprefix $(BUILDDIR)/,$(ROOTDIRS-y))) + # use a "for" in a shell to process dependencies: we don't want this # task to be run in parallel. .PHONY: depdirs depdirs: $(RTE_OUTPUT)/.depdirs -$(RTE_OUTPUT)/.depdirs: $(RTE_OUTPUT)/.config - @rm -f $(RTE_OUTPUT)/.depdirs ; \ - for d in $(ROOTDIRS-y); do \ - if [ -f $(RTE_SRCDIR)/$$d/Makefile ]; then \ - [ -d $(BUILDDIR)/$$d ] || mkdir -p $(BUILDDIR)/$$d ; \ - $(MAKE) S=$$d -f $(RTE_SRCDIR)/$$d/Makefile depdirs \ - >> $(RTE_OUTPUT)/.depdirs ; \ - fi ; \ - done +$(RTE_OUTPUT)/.depdirs: $(DEPDIRS) + @rm -f $@ + @for f in $(DEPDIRS); do cat $$f >> $@; done + @sort -u -o $@ $@ + +$(DEPDIRS): $(RTE_OUTPUT)/.config + @f=$(lastword $(subst /, ,$(dir $@))); \ + [ -d $(BUILDDIR)/$$f ] || mkdir -p $(BUILDDIR)/$$f; \ + rm -f $@; \ + $(MAKE) S=$$f -f $(RTE_SRCDIR)/$$f/Makefile depdirs >> $@ .PHONY: depgraph depgraph: diff --git a/mk/rte.subdir.mk b/mk/rte.subdir.mk index 256e64e..3bb3019 100644 --- a/mk/rte.subdir.mk +++ b/mk/rte.subdir.mk @@ -76,7 +76,7 @@ clean: _postclean # include .depdirs and define rules to order priorities between build # of directories. # -include $(RTE_OUTPUT)/.depdirs +-include $(RTE_OUTPUT)/.depdirs define depdirs_rule $(1): $(sort $(patsubst $(S)/%,%,$(LOCAL_DEPDIRS-$(S)/$(1)))) @@ -84,16 +84,15 @@ endef $(foreach d,$(DIRS-y),$(eval $(call depdirs_rule,$(d)))) +DEPDIRS = $(wildcard $(addprefix $(S)/,$(DIRS-y))) # use a "for" in a shell to process dependencies: we don't want this # task to be run in parallel. -.PHONY: depdirs -depdirs: - @for d in $(DIRS-y); do \ - if [ -f $(SRCDIR)/$$d/Makefile ]; then \ - $(MAKE) S=$S/$$d -f $(SRCDIR)/$$d/Makefile depdirs ; \ - fi ; \ - done +.PHONY: depdirs $(DEPDIRS) +depdirs: $(DEPDIRS) + +$(DEPDIRS): + @$(MAKE) S=$@ -f $(RTE_SRCDIR)/$@/Makefile depdirs .PHONY: depgraph depgraph: -- 2.9.3