Changeset 11414


Ignore:
Timestamp:
2008-06-09T17:38:45+02:00 (8 years ago)
Author:
nbd
Message:

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

Location:
trunk
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • trunk/Makefile

    r10634 r11414  
    1717 
    1818ifneq ($(OPENWRT_BUILD),1) 
     19  # XXX: these three lines are normally defined by rules.mk 
     20  # but we can't include that file in this context 
     21  empty:= 
     22  space:= $(empty) $(empty) 
     23  _SINGLE=MAKEFLAGS=$(space) 
     24 
    1925  override OPENWRT_BUILD=1 
    2026  export OPENWRT_BUILD 
     
    4551clean: FORCE 
    4652        rm -rf $(BUILD_DIR) $(BIN_DIR) 
    47         $(MAKE) target/linux/clean 
     53        $(SUBMAKE) target/linux/clean 
    4854 
    4955dirclean: clean 
     
    5662prepare: .config $(tools/stamp-install) $(toolchain/stamp-install) 
    5763world: prepare $(target/stamp-compile) $(package/stamp-cleanup) $(package/stamp-compile) $(package/stamp-install) $(package/stamp-rootfs-prepare) $(target/stamp-install) FORCE 
    58         $(MAKE) package/index 
     64        $(SUBMAKE) package/index 
    5965 
    6066# update all feeds, re-create index files, install symlinks 
  • trunk/include/kernel-build.mk

    r11076 r11414  
    77include $(INCLUDE_DIR)/host.mk 
    88include $(INCLUDE_DIR)/prereq.mk 
    9  
    10 ifneq ($(DUMP),1) 
    11   override MAKEFLAGS= 
    12 endif 
    139 
    1410ifneq ($(DUMP),1) 
     
    10298 
    10399  image-prereq: 
    104         $(SUBMAKE) -s -C image prereq TARGET_BUILD= 
     100        @$(NO_TRACE_MAKE) -s -C image prereq TARGET_BUILD= 
    105101 
    106102  prereq: image-prereq 
  • trunk/include/package.mk

    r10458 r11414  
    8484 
    8585  $(STAMP_INSTALLED): $(STAMP_BUILT) 
    86         $(SUBMAKE) clean-staging 
     86        $(SUBMAKE) -j1 clean-staging 
    8787        rm -rf $(TMP_DIR)/stage-$(PKG_NAME) 
    8888        mkdir -p $(TMP_DIR)/stage-$(PKG_NAME)/host $(STAGING_DIR)/packages $(STAGING_DIR_HOST)/packages 
  • trunk/include/scan.mk

    r10273 r11414  
    5151 
    5252$(TARGET_STAMP):: 
    53         ( \ 
     53        +( \ 
    5454                $(NO_TRACE_MAKE) $(FILELIST); \ 
    5555                MD5SUM=$$(cat $(FILELIST) | (md5sum || md5) | awk '{print $$1}'); \ 
  • trunk/include/subdir.mk

    r11059 r11414  
    2929    $(foreach target,$(SUBTARGETS), 
    3030      $(call warn_eval,$(1)/$(bd),t,T,$(1)/$(bd)/$(target): $(if $(QUILT),,$($(1)/$(bd)/$(target)) $(call $(1)//$(target),$(1)/$(bd)))) 
    31                 +$$(MAKE) -j1 -C $(1)/$(bd) $(target) $(if $(findstring $(bd),$($(1)/builddirs-ignore-$(target))), || $(call MESSAGE,   ERROR: $(1)/$(bd) failed to build.)) 
    32  
     31                $(if $(findstring $(bd),$($(1)/builddirs-parallel)),$$(SUBMAKE),$$(_SINGLE)$$(SUBMAKE) -j1) \ 
     32                        -C $(1)/$(bd) $(target) $(if $(findstring $(bd),$($(1)/builddirs-ignore-$(target))), || $(call MESSAGE,   ERROR: $(1)/$(bd) failed to build.)) 
    3333        $$(if $(call debug,$(1)/$(bd),v),,.SILENT: $(1)/$(bd)/$(target)) 
    3434 
  • trunk/include/toplevel.mk

    r11411 r11414  
    3636prepare-tmpinfo: FORCE 
    3737        mkdir -p tmp/info 
    38         +$(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="" 
    39         +$(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" 
     38        $(_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="" 
     39        $(_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" 
    4040        for type in package target; do \ 
    4141                f=tmp/.$${type}info; t=tmp/.config-$${type}.in; \ 
     
    5252 
    5353scripts/config/mconf: 
    54         @+$(MAKE) -C scripts/config all 
     54        @$(_SINGLE)$(SUBMAKE) -s -j1 -C scripts/config all 
    5555 
    5656$(eval $(call rdep,scripts/config,scripts/config/mconf)) 
    5757 
    5858scripts/config/conf: 
    59         @+$(MAKE) -C scripts/config conf 
     59        @$(_SINGLE)$(SUBMAKE) -s -j1 -C scripts/config conf 
    6060 
    6161config: scripts/config/conf prepare-tmpinfo FORCE 
     
    8787        mkdir -p tmp 
    8888        rm -f tmp/.host.mk 
    89         @+$(NO_TRACE_MAKE) -s -f $(TOPDIR)/include/prereq-build.mk prereq 2>/dev/null || { \ 
     89        @$(_SINGLE)$(NO_TRACE_MAKE) -j1 -s -f $(TOPDIR)/include/prereq-build.mk prereq 2>/dev/null || { \ 
    9090                echo "Prerequisite check failed. Use FORCE=1 to override."; \ 
    9191                false; \ 
     
    9494 
    9595download: .config FORCE 
    96         +$(MAKE) tools/download 
    97         +$(MAKE) toolchain/download 
    98         +$(MAKE) package/download 
    99         +$(MAKE) target/download 
     96        @+$(SUBMAKE) tools/download 
     97        @+$(SUBMAKE) toolchain/download 
     98        @+$(SUBMAKE) package/download 
     99        @+$(SUBMAKE) target/download 
    100100 
    101101clean dirclean: .config 
    102         @$(MAKE) $@  
     102        @+$(SUBMAKE) $@  
    103103 
    104104prereq:: .config 
    105         @+$(SUBMAKE) -s tmp/.prereq-build $(PREP_MK) 
     105        @+$(MAKE) -s tmp/.prereq-build $(PREP_MK) 
    106106        @$(NO_TRACE_MAKE) -s $@ 
    107107 
    108108%:: 
    109109        @+$(PREP_MK) $(NO_TRACE_MAKE) -s prereq 
    110         @+$(MAKE) -r $@ 
     110        @+$(SUBMAKE) -r $@ 
    111111 
    112112help: 
     
    114114 
    115115docs docs/compile: FORCE 
    116         $(MAKE) -C docs compile 
     116        @$(_SINGLE)$(SUBMAKE) -j1 -C docs compile 
    117117 
    118118docs/clean: FORCE 
    119         $(MAKE) -C docs clean 
     119        @$(_SINGLE)$(SUBMAKE) -j1 -C docs clean 
    120120 
    121121distclean: 
    122122        rm -rf tmp build_dir staging_dir dl .config* feeds package/feeds package/openwrt-packages bin 
    123         $(MAKE) -C scripts/config clean 
     123        @$(_SINGLE)$(SUBMAKE) -j1 -C scripts/config clean 
    124124 
    125125ifeq ($(findstring v,$(DEBUG)),) 
  • trunk/include/verbose.mk

    r11059 r11414  
    99ifeq ($(NO_TRACE_MAKE),) 
    1010NO_TRACE_MAKE := $(MAKE) V=99 
    11 SUBMAKE := $(MAKE) 
    1211export NO_TRACE_MAKE 
    13 export SUBMAKE 
    1412endif 
    1513 
     
    2826ifneq ($(KBUILD_VERBOSE),99) 
    2927  define MESSAGE 
    30         printf "$(_Y)%s$(_N)\n" "$(1)" >&3 
     28        printf "$(_Y)%s$(_N)\n" "$(1)" >&254 
    3129  endef 
    3230 
     
    4038                $(call MESSAGE, make[$(MAKELEVEL)]$(if $(_DIR), -C $(_DIR)) $(MAKECMDGOALS)); \ 
    4139    )) 
     40    SUBMAKE=$(MAKE) 
    4241  else 
    4342    ifeq ($(KBUILD_VERBOSE),0) 
    44       MAKE:=>/dev/null 2>&1 $(MAKE) 
     43      SILENT:=>/dev/null 2>&1 
     44    else 
     45      SILENT:= 
    4546    endif 
    4647    export QUIET:=1 
    47     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 
     48    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 
    4849  endif 
    4950 
    5051  .SILENT: $(MAKECMDGOALS) 
    5152else 
     53  SUBMAKE=$(MAKE) 
    5254  define MESSAGE 
    5355    printf "%s\n" "$(1)" 
  • trunk/rules.mk

    r10840 r11414  
    2424#")) 
    2525 
     26empty:= 
     27space:= $(empty) $(empty) 
     28merge=$(subst $(space),,$(1)) 
     29confvar=$(call merge,$(foreach v,$(1),$(if $($(v)),y,n))) 
     30 
     31_SINGLE=MAKEFLAGS=$(space) 
    2632ARCH:=$(call qstrip,$(shell echo $(CONFIG_ARCH) | sed -e 's/i[3-9]86/i386/')) 
    2733BOARD:=$(call qstrip,$(CONFIG_TARGET_BOARD)) 
     
    146152endef 
    147153 
    148 empty:= 
    149 space:= $(empty) $(empty) 
    150 merge=$(subst $(space),,$(1)) 
    151 confvar=$(call merge,$(foreach v,$(1),$(if $($(v)),y,n))) 
    152  
    153154# file extension 
    154155ext=$(word $(words $(subst ., ,$(1))),$(subst ., ,$(1))) 
  • trunk/target/Makefile

    r8561 r11414  
    77curdir:=target 
    88 
     9$(curdir)/builddirs-parallel:=linux 
    910$(curdir)/builddirs:=linux sdk imagebuilder 
    1011$(curdir)/builddirs-default:=linux 
  • trunk/target/linux/Makefile

    r8694 r11414  
    88include $(INCLUDE_DIR)/target.mk 
    99 
     10export TARGET_BUILD=1 
     11 
    1012prereq clean download prepare compile install menuconfig oldconfig update refresh: FORCE 
    11         TARGET_BUILD=1 $(MAKE) -C $(BOARD) $@ 
    12  
     13        @$(NO_TRACE_MAKE) -C $(BOARD) $@ 
Note: See TracChangeset for help on using the changeset viewer.