Skip to content

Commit

Permalink
rework parallel building to get rid of some warnings and add back sup…
Browse files Browse the repository at this point in the history
…port for parallelizing the kernel build fixes #3882

SVN-Revision: 12322
  • Loading branch information
Felix Fietkau committed Aug 16, 2008
1 parent a15a10c commit a3a37d0
Show file tree
Hide file tree
Showing 8 changed files with 27 additions and 33 deletions.
8 changes: 4 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand All @@ -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."; \
Expand All @@ -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:
Expand Down
1 change: 1 addition & 0 deletions include/image.mk
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
13 changes: 3 additions & 10 deletions include/kernel-build.mk
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
12 changes: 6 additions & 6 deletions include/kernel-defaults.mk
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -86,20 +86,20 @@ 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

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


2 changes: 1 addition & 1 deletion include/subdir.mk
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down
20 changes: 10 additions & 10 deletions include/toplevel.mk
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion rules.mk
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down
2 changes: 1 addition & 1 deletion target/linux/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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) $@

0 comments on commit a3a37d0

Please sign in to comment.