1
0
mirror of git://projects.qi-hardware.com/openwrt-xburst.git synced 2024-11-27 18:35:55 +02:00

large improvement for parallel builds. works without V=99 now and without warnings. tested with -j on an 2x dual core opteron machine

git-svn-id: svn://svn.openwrt.org/openwrt/trunk@11414 3c298f89-4303-0410-b956-a3cf2f4a3e73
This commit is contained in:
nbd 2008-06-09 15:38:45 +00:00
parent 0d66009315
commit 83b31e078f
10 changed files with 45 additions and 38 deletions

View File

@ -16,6 +16,12 @@ world:
include $(TOPDIR)/include/host.mk include $(TOPDIR)/include/host.mk
ifneq ($(OPENWRT_BUILD),1) ifneq ($(OPENWRT_BUILD),1)
# XXX: these three lines are normally defined by rules.mk
# but we can't include that file in this context
empty:=
space:= $(empty) $(empty)
_SINGLE=MAKEFLAGS=$(space)
override OPENWRT_BUILD=1 override OPENWRT_BUILD=1
export OPENWRT_BUILD export OPENWRT_BUILD
include $(TOPDIR)/include/debug.mk include $(TOPDIR)/include/debug.mk
@ -44,7 +50,7 @@ $(BUILD_DIR)/.prepared: Makefile
clean: FORCE clean: FORCE
rm -rf $(BUILD_DIR) $(BIN_DIR) rm -rf $(BUILD_DIR) $(BIN_DIR)
$(MAKE) target/linux/clean $(SUBMAKE) target/linux/clean
dirclean: clean dirclean: clean
rm -rf $(STAGING_DIR) $(STAGING_DIR_HOST) $(STAGING_DIR_TOOLCHAIN) $(TOOLCHAIN_DIR) $(BUILD_DIR_HOST) rm -rf $(STAGING_DIR) $(STAGING_DIR_HOST) $(STAGING_DIR_TOOLCHAIN) $(TOOLCHAIN_DIR) $(BUILD_DIR_HOST)
@ -55,7 +61,7 @@ prereq: $(package/stamp-prereq) $(target/stamp-prereq) ;
prepare: .config $(tools/stamp-install) $(toolchain/stamp-install) prepare: .config $(tools/stamp-install) $(toolchain/stamp-install)
world: prepare $(target/stamp-compile) $(package/stamp-cleanup) $(package/stamp-compile) $(package/stamp-install) $(package/stamp-rootfs-prepare) $(target/stamp-install) FORCE world: prepare $(target/stamp-compile) $(package/stamp-cleanup) $(package/stamp-compile) $(package/stamp-install) $(package/stamp-rootfs-prepare) $(target/stamp-install) FORCE
$(MAKE) package/index $(SUBMAKE) package/index
# update all feeds, re-create index files, install symlinks # update all feeds, re-create index files, install symlinks
package/symlinks: package/symlinks:

View File

@ -7,10 +7,6 @@
include $(INCLUDE_DIR)/host.mk include $(INCLUDE_DIR)/host.mk
include $(INCLUDE_DIR)/prereq.mk include $(INCLUDE_DIR)/prereq.mk
ifneq ($(DUMP),1)
override MAKEFLAGS=
endif
ifneq ($(DUMP),1) ifneq ($(DUMP),1)
all: compile all: compile
endif endif
@ -101,7 +97,7 @@ define BuildKernel
@$(MAKE) compile @$(MAKE) compile
image-prereq: image-prereq:
$(SUBMAKE) -s -C image prereq TARGET_BUILD= @$(NO_TRACE_MAKE) -s -C image prereq TARGET_BUILD=
prereq: image-prereq prereq: image-prereq

View File

@ -83,7 +83,7 @@ define Build/DefaultTargets
touch $$@ touch $$@
$(STAMP_INSTALLED): $(STAMP_BUILT) $(STAMP_INSTALLED): $(STAMP_BUILT)
$(SUBMAKE) clean-staging $(SUBMAKE) -j1 clean-staging
rm -rf $(TMP_DIR)/stage-$(PKG_NAME) rm -rf $(TMP_DIR)/stage-$(PKG_NAME)
mkdir -p $(TMP_DIR)/stage-$(PKG_NAME)/host $(STAGING_DIR)/packages $(STAGING_DIR_HOST)/packages mkdir -p $(TMP_DIR)/stage-$(PKG_NAME)/host $(STAGING_DIR)/packages $(STAGING_DIR_HOST)/packages
$(call Build/InstallDev,$(TMP_DIR)/stage-$(PKG_NAME),$(TMP_DIR)/stage-$(PKG_NAME)/host) $(call Build/InstallDev,$(TMP_DIR)/stage-$(PKG_NAME),$(TMP_DIR)/stage-$(PKG_NAME)/host)

View File

@ -50,7 +50,7 @@ $(TMP_DIR)/info/.files-$(SCAN_TARGET).mk: $(FILELIST)
-include $(TMP_DIR)/info/.files-$(SCAN_TARGET).mk -include $(TMP_DIR)/info/.files-$(SCAN_TARGET).mk
$(TARGET_STAMP):: $(TARGET_STAMP)::
( \ +( \
$(NO_TRACE_MAKE) $(FILELIST); \ $(NO_TRACE_MAKE) $(FILELIST); \
MD5SUM=$$(cat $(FILELIST) | (md5sum || md5) | awk '{print $$1}'); \ MD5SUM=$$(cat $(FILELIST) | (md5sum || md5) | awk '{print $$1}'); \
[ -f "$@.$$MD5SUM" ] || { \ [ -f "$@.$$MD5SUM" ] || { \

View File

@ -28,8 +28,8 @@ define subdir
$(call warn,$(1),d,BD $(1)/$(bd)) $(call warn,$(1),d,BD $(1)/$(bd))
$(foreach target,$(SUBTARGETS), $(foreach target,$(SUBTARGETS),
$(call warn_eval,$(1)/$(bd),t,T,$(1)/$(bd)/$(target): $(if $(QUILT),,$($(1)/$(bd)/$(target)) $(call $(1)//$(target),$(1)/$(bd)))) $(call warn_eval,$(1)/$(bd),t,T,$(1)/$(bd)/$(target): $(if $(QUILT),,$($(1)/$(bd)/$(target)) $(call $(1)//$(target),$(1)/$(bd))))
+$$(MAKE) -j1 -C $(1)/$(bd) $(target) $(if $(findstring $(bd),$($(1)/builddirs-ignore-$(target))), || $(call MESSAGE, ERROR: $(1)/$(bd) failed to build.)) $(if $(findstring $(bd),$($(1)/builddirs-parallel)),$$(SUBMAKE),$$(_SINGLE)$$(SUBMAKE) -j1) \
-C $(1)/$(bd) $(target) $(if $(findstring $(bd),$($(1)/builddirs-ignore-$(target))), || $(call MESSAGE, ERROR: $(1)/$(bd) failed to build.))
$$(if $(call debug,$(1)/$(bd),v),,.SILENT: $(1)/$(bd)/$(target)) $$(if $(call debug,$(1)/$(bd),v),,.SILENT: $(1)/$(bd)/$(target))
# legacy targets # legacy targets

View File

@ -35,8 +35,8 @@ prepare-mk: FORCE ;
prepare-tmpinfo: FORCE prepare-tmpinfo: FORCE
mkdir -p tmp/info mkdir -p tmp/info
+$(NO_TRACE_MAKE) -s -f include/scan.mk SCAN_TARGET="packageinfo" SCAN_DIR="package" SCAN_NAME="package" SCAN_DEPS="$(TOPDIR)/include/package*.mk" SCAN_DEPTH=5 SCAN_EXTRA="" $(_SINGLE)$(NO_TRACE_MAKE) -j1 -s -f include/scan.mk SCAN_TARGET="packageinfo" SCAN_DIR="package" SCAN_NAME="package" SCAN_DEPS="$(TOPDIR)/include/package*.mk" SCAN_DEPTH=5 SCAN_EXTRA=""
+$(NO_TRACE_MAKE) -s -f include/scan.mk SCAN_TARGET="targetinfo" SCAN_DIR="target/linux" SCAN_NAME="target" SCAN_DEPS="profiles/*.mk $(TOPDIR)/include/kernel*.mk $(TOPDIR)/include/target.mk" SCAN_DEPTH=2 SCAN_EXTRA="" SCAN_MAKEOPTS="TARGET_BUILD=1" $(_SINGLE)$(NO_TRACE_MAKE) -j1 -s -f include/scan.mk SCAN_TARGET="targetinfo" SCAN_DIR="target/linux" SCAN_NAME="target" SCAN_DEPS="profiles/*.mk $(TOPDIR)/include/kernel*.mk $(TOPDIR)/include/target.mk" SCAN_DEPTH=2 SCAN_EXTRA="" SCAN_MAKEOPTS="TARGET_BUILD=1"
for type in package target; do \ for type in package target; do \
f=tmp/.$${type}info; t=tmp/.config-$${type}.in; \ f=tmp/.$${type}info; t=tmp/.config-$${type}.in; \
[ "$$t" -nt "$$f" ] || ./scripts/metadata.pl $${type}_config "$$f" > "$$t" || { rm -f "$$t"; echo "Failed to build $$t"; false; break; }; \ [ "$$t" -nt "$$f" ] || ./scripts/metadata.pl $${type}_config "$$f" > "$$t" || { rm -f "$$t"; echo "Failed to build $$t"; false; break; }; \
@ -51,12 +51,12 @@ prepare-tmpinfo: FORCE
fi fi
scripts/config/mconf: scripts/config/mconf:
@+$(MAKE) -C scripts/config all @$(_SINGLE)$(SUBMAKE) -s -j1 -C scripts/config all
$(eval $(call rdep,scripts/config,scripts/config/mconf)) $(eval $(call rdep,scripts/config,scripts/config/mconf))
scripts/config/conf: scripts/config/conf:
@+$(MAKE) -C scripts/config conf @$(_SINGLE)$(SUBMAKE) -s -j1 -C scripts/config conf
config: scripts/config/conf prepare-tmpinfo FORCE config: scripts/config/conf prepare-tmpinfo FORCE
$< Config.in $< Config.in
@ -86,41 +86,41 @@ kernel_menuconfig: .config FORCE
tmp/.prereq-build: include/prereq-build.mk tmp/.prereq-build: include/prereq-build.mk
mkdir -p tmp mkdir -p tmp
rm -f tmp/.host.mk rm -f tmp/.host.mk
@+$(NO_TRACE_MAKE) -s -f $(TOPDIR)/include/prereq-build.mk prereq 2>/dev/null || { \ @$(_SINGLE)$(NO_TRACE_MAKE) -j1 -s -f $(TOPDIR)/include/prereq-build.mk prereq 2>/dev/null || { \
echo "Prerequisite check failed. Use FORCE=1 to override."; \ echo "Prerequisite check failed. Use FORCE=1 to override."; \
false; \ false; \
} }
touch $@ touch $@
download: .config FORCE download: .config FORCE
+$(MAKE) tools/download @+$(SUBMAKE) tools/download
+$(MAKE) toolchain/download @+$(SUBMAKE) toolchain/download
+$(MAKE) package/download @+$(SUBMAKE) package/download
+$(MAKE) target/download @+$(SUBMAKE) target/download
clean dirclean: .config clean dirclean: .config
@$(MAKE) $@ @+$(SUBMAKE) $@
prereq:: .config prereq:: .config
@+$(SUBMAKE) -s tmp/.prereq-build $(PREP_MK) @+$(MAKE) -s tmp/.prereq-build $(PREP_MK)
@$(NO_TRACE_MAKE) -s $@ @$(NO_TRACE_MAKE) -s $@
%:: %::
@+$(PREP_MK) $(NO_TRACE_MAKE) -s prereq @+$(PREP_MK) $(NO_TRACE_MAKE) -s prereq
@+$(MAKE) -r $@ @+$(SUBMAKE) -r $@
help: help:
cat README cat README
docs docs/compile: FORCE docs docs/compile: FORCE
$(MAKE) -C docs compile @$(_SINGLE)$(SUBMAKE) -j1 -C docs compile
docs/clean: FORCE docs/clean: FORCE
$(MAKE) -C docs clean @$(_SINGLE)$(SUBMAKE) -j1 -C docs clean
distclean: distclean:
rm -rf tmp build_dir staging_dir dl .config* feeds package/feeds package/openwrt-packages bin rm -rf tmp build_dir staging_dir dl .config* feeds package/feeds package/openwrt-packages bin
$(MAKE) -C scripts/config clean @$(_SINGLE)$(SUBMAKE) -j1 -C scripts/config clean
ifeq ($(findstring v,$(DEBUG)),) ifeq ($(findstring v,$(DEBUG)),)
.SILENT: symlinkclean clean dirclean distclean config-clean download help tmpinfo-clean .config scripts/config/mconf scripts/config/conf menuconfig tmp/.prereq-build tmp/.prereq-package prepare-tmpinfo .SILENT: symlinkclean clean dirclean distclean config-clean download help tmpinfo-clean .config scripts/config/mconf scripts/config/conf menuconfig tmp/.prereq-build tmp/.prereq-package prepare-tmpinfo

View File

@ -8,9 +8,7 @@
ifeq ($(NO_TRACE_MAKE),) ifeq ($(NO_TRACE_MAKE),)
NO_TRACE_MAKE := $(MAKE) V=99 NO_TRACE_MAKE := $(MAKE) V=99
SUBMAKE := $(MAKE)
export NO_TRACE_MAKE export NO_TRACE_MAKE
export SUBMAKE
endif endif
ifndef KBUILD_VERBOSE ifndef KBUILD_VERBOSE
@ -27,7 +25,7 @@ endif
ifneq ($(KBUILD_VERBOSE),99) ifneq ($(KBUILD_VERBOSE),99)
define MESSAGE define MESSAGE
printf "$(_Y)%s$(_N)\n" "$(1)" >&3 printf "$(_Y)%s$(_N)\n" "$(1)" >&254
endef endef
ifeq ($(QUIET),1) ifeq ($(QUIET),1)
@ -39,16 +37,20 @@ ifneq ($(KBUILD_VERBOSE),99)
_NULL:=$(if $(MAKECMDGOALS),$(shell \ _NULL:=$(if $(MAKECMDGOALS),$(shell \
$(call MESSAGE, make[$(MAKELEVEL)]$(if $(_DIR), -C $(_DIR)) $(MAKECMDGOALS)); \ $(call MESSAGE, make[$(MAKELEVEL)]$(if $(_DIR), -C $(_DIR)) $(MAKECMDGOALS)); \
)) ))
SUBMAKE=$(MAKE)
else else
ifeq ($(KBUILD_VERBOSE),0) ifeq ($(KBUILD_VERBOSE),0)
MAKE:=>/dev/null 2>&1 $(MAKE) SILENT:=>/dev/null 2>&1
else
SILENT:=
endif endif
export QUIET:=1 export QUIET:=1
MAKE:=cmd() { $(MAKE) -s $$* || { echo "make $$*: build failed. Please re-run make with V=99 to see what's going on"; false; } } 3>&1 4>&2; cmd SUBMAKE=cmd() { $(SILENT) $(MAKE) -s $$* || { echo "make $$*: build failed. Please re-run make with V=99 to see what's going on"; false; } } 254>&1 255>&2; cmd
endif endif
.SILENT: $(MAKECMDGOALS) .SILENT: $(MAKECMDGOALS)
else else
SUBMAKE=$(MAKE)
define MESSAGE define MESSAGE
printf "%s\n" "$(1)" printf "%s\n" "$(1)"
endef endef

View File

@ -23,6 +23,12 @@ $(strip $(subst ",,$(1)))
endef endef
#")) #"))
empty:=
space:= $(empty) $(empty)
merge=$(subst $(space),,$(1))
confvar=$(call merge,$(foreach v,$(1),$(if $($(v)),y,n)))
_SINGLE=MAKEFLAGS=$(space)
ARCH:=$(call qstrip,$(shell echo $(CONFIG_ARCH) | sed -e 's/i[3-9]86/i386/')) ARCH:=$(call qstrip,$(shell echo $(CONFIG_ARCH) | sed -e 's/i[3-9]86/i386/'))
BOARD:=$(call qstrip,$(CONFIG_TARGET_BOARD)) BOARD:=$(call qstrip,$(CONFIG_TARGET_BOARD))
TARGET_OPTIMIZATION:=$(call qstrip,$(CONFIG_TARGET_OPTIMIZATION)) TARGET_OPTIMIZATION:=$(call qstrip,$(CONFIG_TARGET_OPTIMIZATION))
@ -145,11 +151,6 @@ $(call shvar,$(1))=$$(call $(1))
export $(call shvar,$(1)) export $(call shvar,$(1))
endef endef
empty:=
space:= $(empty) $(empty)
merge=$(subst $(space),,$(1))
confvar=$(call merge,$(foreach v,$(1),$(if $($(v)),y,n)))
# file extension # file extension
ext=$(word $(words $(subst ., ,$(1))),$(subst ., ,$(1))) ext=$(word $(words $(subst ., ,$(1))),$(subst ., ,$(1)))

View File

@ -6,6 +6,7 @@
# #
curdir:=target curdir:=target
$(curdir)/builddirs-parallel:=linux
$(curdir)/builddirs:=linux sdk imagebuilder $(curdir)/builddirs:=linux sdk imagebuilder
$(curdir)/builddirs-default:=linux $(curdir)/builddirs-default:=linux
$(curdir)/builddirs-install:=linux $(if $(CONFIG_SDK),sdk) $(if $(CONFIG_IB),imagebuilder) $(curdir)/builddirs-install:=linux $(if $(CONFIG_SDK),sdk) $(if $(CONFIG_IB),imagebuilder)

View File

@ -7,6 +7,7 @@
include $(TOPDIR)/rules.mk include $(TOPDIR)/rules.mk
include $(INCLUDE_DIR)/target.mk include $(INCLUDE_DIR)/target.mk
prereq clean download prepare compile install menuconfig oldconfig update refresh: FORCE export TARGET_BUILD=1
TARGET_BUILD=1 $(MAKE) -C $(BOARD) $@
prereq clean download prepare compile install menuconfig oldconfig update refresh: FORCE
@$(NO_TRACE_MAKE) -C $(BOARD) $@