rework parallel building to get rid of some warnings
and add back support for parallelizing the kernel build fixes #3882 git-svn-id: svn://svn.openwrt.org/openwrt/trunk@12322 3c298f89-4303-0410-b956-a3cf2f4a3e73master
parent
1f00b02bb4
commit
627b34f1f2
8
Makefile
8
Makefile
|
@ -20,7 +20,7 @@ ifneq ($(OPENWRT_BUILD),1)
|
|||
# but we can't include that file in this context
|
||||
empty:=
|
||||
space:= $(empty) $(empty)
|
||||
_SINGLE=MAKEFLAGS=$(space)
|
||||
_SINGLE=export MAKEFLAGS=$(space);
|
||||
|
||||
override OPENWRT_BUILD=1
|
||||
export OPENWRT_BUILD
|
||||
|
@ -50,7 +50,7 @@ $(BUILD_DIR)/.prepared: Makefile
|
|||
|
||||
clean: FORCE
|
||||
rm -rf $(BUILD_DIR) $(BIN_DIR)
|
||||
$(SUBMAKE) target/linux/clean
|
||||
$(_SINGLE)$(SUBMAKE) target/linux/clean
|
||||
|
||||
dirclean: clean
|
||||
rm -rf $(STAGING_DIR) $(STAGING_DIR_HOST) $(STAGING_DIR_TOOLCHAIN) $(TOOLCHAIN_DIR) $(BUILD_DIR_HOST)
|
||||
|
@ -59,7 +59,7 @@ dirclean: clean
|
|||
tmp/.prereq_packages: .config
|
||||
unset ERROR; \
|
||||
for package in $(sort $(prereq-y) $(prereq-m)); do \
|
||||
$(NO_TRACE_MAKE) -s -r -C package/$$package prereq || ERROR=1; \
|
||||
$(_SINGLE)$(NO_TRACE_MAKE) -s -r -C package/$$package prereq || ERROR=1; \
|
||||
done; \
|
||||
if [ -n "$$ERROR" ]; then \
|
||||
echo "Package prerequisite check failed."; \
|
||||
|
@ -72,7 +72,7 @@ prereq: $(target/stamp-prereq) tmp/.prereq_packages
|
|||
|
||||
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
|
||||
$(SUBMAKE) package/index
|
||||
$(_SINGLE)$(SUBMAKE) package/index
|
||||
|
||||
# update all feeds, re-create index files, install symlinks
|
||||
package/symlinks:
|
||||
|
|
|
@ -10,6 +10,7 @@ include $(INCLUDE_DIR)/prereq.mk
|
|||
include $(INCLUDE_DIR)/kernel.mk
|
||||
include $(INCLUDE_DIR)/host.mk
|
||||
|
||||
.NOTPARALLEL:
|
||||
override MAKEFLAGS=
|
||||
override MAKE:=$(SUBMAKE)
|
||||
KDIR=$(KERNEL_BUILD_DIR)
|
||||
|
|
|
@ -80,25 +80,18 @@ define BuildKernel
|
|||
[ -e "$(LINUX_CONFIG)" ] || touch "$(LINUX_CONFIG)"
|
||||
$(LINUX_CONFCMD) > $(LINUX_DIR)/.config
|
||||
touch $(LINUX_CONFIG)
|
||||
$(MAKE) -C $(LINUX_DIR) $(KERNEL_MAKEOPTS) $$@
|
||||
$(_SINGLE)$(MAKE) -C $(LINUX_DIR) $(KERNEL_MAKEOPTS) $$@
|
||||
$(SCRIPT_DIR)/kconfig.pl '>' $(GENERIC_LINUX_CONFIG) $(LINUX_DIR)/.config > $(LINUX_CONFIG)
|
||||
$(Kernel/Configure)
|
||||
|
||||
install: $(LINUX_DIR)/.image
|
||||
TARGET_BUILD="" $(MAKE) -C image compile install
|
||||
+$(MAKE) -C image compile install TARGET_BUILD=
|
||||
|
||||
clean: FORCE
|
||||
rm -rf $(KERNEL_BUILD_DIR)
|
||||
|
||||
rebuild: FORCE
|
||||
@$(MAKE) mostlyclean
|
||||
@if [ -f $(LINUX_KERNEL) ]; then \
|
||||
$(MAKE) clean; \
|
||||
fi
|
||||
@$(MAKE) compile
|
||||
|
||||
image-prereq:
|
||||
@$(NO_TRACE_MAKE) -s -C image prereq TARGET_BUILD=
|
||||
@+$(NO_TRACE_MAKE) -s -C image prereq TARGET_BUILD=
|
||||
|
||||
prereq: image-prereq
|
||||
|
||||
|
|
|
@ -69,11 +69,11 @@ endif
|
|||
|
||||
define Kernel/Configure/2.4
|
||||
$(SED) "s,\-mcpu=,\-mtune=,g;" $(LINUX_DIR)/arch/mips/Makefile
|
||||
$(MAKE) $(KERNEL_MAKEOPTS) oldconfig include/linux/compile.h include/linux/version.h
|
||||
$(MAKE) $(KERNEL_MAKEOPTS) dep
|
||||
$(_SINGLE)$(MAKE) $(KERNEL_MAKEOPTS) oldconfig include/linux/compile.h include/linux/version.h
|
||||
$(_SINGLE)$(MAKE) $(KERNEL_MAKEOPTS) dep
|
||||
endef
|
||||
define Kernel/Configure/2.6
|
||||
-$(MAKE) $(KERNEL_MAKEOPTS) oldconfig prepare scripts
|
||||
-$(_SINGLE)$(MAKE) $(KERNEL_MAKEOPTS) oldconfig prepare scripts
|
||||
endef
|
||||
define Kernel/Configure/Default
|
||||
$(LINUX_CONFCMD) > $(LINUX_DIR)/.config.target
|
||||
|
@ -86,12 +86,12 @@ endef
|
|||
|
||||
define Kernel/CompileModules/Default
|
||||
rm -f $(LINUX_DIR)/vmlinux $(LINUX_DIR)/System.map
|
||||
$(MAKE) $(KERNEL_MAKEOPTS) modules
|
||||
+$(MAKE) $(KERNEL_MAKEOPTS) modules
|
||||
endef
|
||||
|
||||
define Kernel/CompileImage/Default
|
||||
$(if $(CONFIG_TARGET_ROOTFS_INITRAMFS),,rm -f $(TARGET_DIR)/init)
|
||||
$(MAKE) $(KERNEL_MAKEOPTS) $(KERNELNAME)
|
||||
+$(MAKE) $(KERNEL_MAKEOPTS) $(KERNELNAME)
|
||||
$(KERNEL_CROSS)objcopy -O binary -R .reginfo -R .note -R .comment -R .mdebug -S $(LINUX_DIR)/vmlinux $(LINUX_KERNEL)
|
||||
$(KERNEL_CROSS)objcopy -R .reginfo -R .note -R .comment -R .mdebug -S $(LINUX_DIR)/vmlinux $(KERNEL_BUILD_DIR)/vmlinux.elf
|
||||
endef
|
||||
|
@ -99,7 +99,7 @@ endef
|
|||
define Kernel/Clean/Default
|
||||
rm -f $(KERNEL_BUILD_DIR)/linux-$(LINUX_VERSION)/.configured
|
||||
rm -f $(LINUX_KERNEL)
|
||||
$(MAKE) -C $(KERNEL_BUILD_DIR)/linux-$(LINUX_VERSION) clean
|
||||
$(_SINGLE)$(MAKE) -C $(KERNEL_BUILD_DIR)/linux-$(LINUX_VERSION) clean
|
||||
endef
|
||||
|
||||
|
||||
|
|
|
@ -28,7 +28,7 @@ define subdir
|
|||
$(call warn,$(1),d,BD $(1)/$(bd))
|
||||
$(foreach target,$(SUBTARGETS),
|
||||
$(call warn_eval,$(1)/$(bd),t,T,$(1)/$(bd)/$(target): $(if $(QUILT),,$($(1)/$(bd)/$(target)) $(call $(1)//$(target),$(1)/$(bd))))
|
||||
$(if $(findstring $(bd),$($(1)/builddirs-parallel)),$$(SUBMAKE),$$(SUBMAKE) -j1) \
|
||||
+$(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))
|
||||
|
||||
|
|
|
@ -47,22 +47,22 @@ prepare-tmpinfo: FORCE
|
|||
.config: ./scripts/config/conf prepare-tmpinfo $(if $(CONFIG_HAVE_DOT_CONFIG),,FORCE)
|
||||
@+if [ \! -f .config ] || ! grep CONFIG_HAVE_DOT_CONFIG .config >/dev/null; then \
|
||||
[ -e $(HOME)/.openwrt/defconfig ] && cp $(HOME)/.openwrt/defconfig .config; \
|
||||
$(NO_TRACE_MAKE) menuconfig $(PREP_MK); \
|
||||
$(_SINGLE)$(NO_TRACE_MAKE) menuconfig $(PREP_MK); \
|
||||
fi
|
||||
|
||||
scripts/config/mconf:
|
||||
@$(SUBMAKE) -s -j1 -C scripts/config all
|
||||
@$(_SINGLE)$(SUBMAKE) -s -C scripts/config all
|
||||
|
||||
$(eval $(call rdep,scripts/config,scripts/config/mconf))
|
||||
|
||||
scripts/config/conf:
|
||||
@$(SUBMAKE) -s -j1 -C scripts/config conf
|
||||
@$(_SINGLE)$(SUBMAKE) -s -C scripts/config conf
|
||||
|
||||
config: scripts/config/conf prepare-tmpinfo FORCE
|
||||
$< Config.in
|
||||
|
||||
config-clean: FORCE
|
||||
$(NO_TRACE_MAKE) -C scripts/config clean
|
||||
$(_SINGLE)$(NO_TRACE_MAKE) -C scripts/config clean
|
||||
|
||||
defconfig: scripts/config/conf prepare-tmpinfo FORCE
|
||||
touch .config
|
||||
|
@ -78,10 +78,10 @@ menuconfig: scripts/config/mconf prepare-tmpinfo FORCE
|
|||
$< Config.in
|
||||
|
||||
kernel_oldconfig: .config FORCE
|
||||
$(NO_TRACE_MAKE) -C target/linux oldconfig
|
||||
$(_SINGLE)$(NO_TRACE_MAKE) -C target/linux oldconfig
|
||||
|
||||
kernel_menuconfig: .config FORCE
|
||||
$(NO_TRACE_MAKE) -C target/linux menuconfig
|
||||
$(_SINGLE)$(NO_TRACE_MAKE) -C target/linux menuconfig
|
||||
|
||||
tmp/.prereq-build: include/prereq-build.mk
|
||||
mkdir -p tmp
|
||||
|
@ -103,7 +103,7 @@ clean dirclean: .config
|
|||
|
||||
prereq:: .config
|
||||
@+$(MAKE) -s tmp/.prereq-build $(PREP_MK)
|
||||
@$(NO_TRACE_MAKE) -s $@
|
||||
@+$(NO_TRACE_MAKE) -s $@
|
||||
|
||||
%::
|
||||
@+$(PREP_MK) $(NO_TRACE_MAKE) -s prereq
|
||||
|
@ -113,14 +113,14 @@ help:
|
|||
cat README
|
||||
|
||||
docs docs/compile: FORCE
|
||||
@$(SUBMAKE) -j1 -C docs compile
|
||||
@$(_SINGLE)$(SUBMAKE) -C docs compile
|
||||
|
||||
docs/clean: FORCE
|
||||
@$(SUBMAKE) -j1 -C docs clean
|
||||
@$(_SINGLE)$(SUBMAKE) -C docs clean
|
||||
|
||||
distclean:
|
||||
rm -rf tmp build_dir staging_dir dl .config* feeds package/feeds package/openwrt-packages bin
|
||||
@$(SUBMAKE) -j1 -C scripts/config clean
|
||||
@$(_SINGLE)$(SUBMAKE) -C scripts/config clean
|
||||
|
||||
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
|
||||
|
|
2
rules.mk
2
rules.mk
|
@ -29,7 +29,7 @@ merge=$(subst $(space),,$(1))
|
|||
confvar=$(call merge,$(foreach v,$(1),$(if $($(v)),y,n)))
|
||||
strip_last=$(patsubst %.$(lastword $(subst .,$(space),$(1))),%,$(1))
|
||||
|
||||
_SINGLE=MAKEFLAGS=$(space)
|
||||
_SINGLE=export MAKEFLAGS=$(space);
|
||||
ARCH:=$(call qstrip,$(shell echo $(CONFIG_ARCH) | sed -e 's/i[3-9]86/i386/'))
|
||||
BOARD:=$(call qstrip,$(CONFIG_TARGET_BOARD))
|
||||
TARGET_OPTIMIZATION:=$(call qstrip,$(CONFIG_TARGET_OPTIMIZATION))
|
||||
|
|
|
@ -10,4 +10,4 @@ include $(INCLUDE_DIR)/target.mk
|
|||
export TARGET_BUILD=1
|
||||
|
||||
prereq clean download prepare compile install menuconfig oldconfig update refresh: FORCE
|
||||
@$(NO_TRACE_MAKE) -C $(BOARD) $@
|
||||
@+$(NO_TRACE_MAKE) -C $(BOARD) $@
|
||||
|
|
Loading…
Reference in New Issue