add support for parallel build of packages (tested with -j8)
add support for parallel build of packages (tested with -j8)

git-svn-id: svn://svn.openwrt.org/openwrt/branches/buildroot-ng/openwrt@3874 3c298f89-4303-0410-b956-a3cf2f4a3e73

--- a/package/Makefile
+++ b/package/Makefile
@@ -10,18 +10,18 @@
 	mkdir -p $@
 
 %-prepare: $(STAMP_DIR) $(TARGET_DIR)
-	$(MAKE) -C $(patsubst %-prepare,%,$@) prepare
+	$(MAKE) -C $(patsubst %-prepare,%,$@) prepare MAKEFLAGS="$(BUILD_MAKEFLAGS)"
 
 %-compile: $(STAMP_DIR) $(TARGET_DIR)
 	@echo "-> make $@"
-	$(MAKE) -C $(patsubst %-compile,%,$@) compile
+	$(MAKE) -C $(patsubst %-compile,%,$@) compile MAKEFLAGS="$(BUILD_MAKEFLAGS)"
 
 %-install: $(STAMP_DIR) $(TARGET_DIR)
 	@echo "-> make $@"
-	$(MAKE) -C $(patsubst %-install,%,$@) install
+	$(MAKE) -C $(patsubst %-install,%,$@) install MAKEFLAGS="$(BUILD_MAKEFLAGS)"
 
 %-clean: $(STAMP_DIR) $(TARGET_DIR)
-	$(MAKE) -C $(patsubst %-clean,%,$@) clean
+	$(MAKE) -C $(patsubst %-clean,%,$@) clean MAKEFLAGS="$(BUILD_MAKEFLAGS)"
 
 
 $(TOPDIR)/.pkgdeps: $(TOPDIR)/.pkginfo
@@ -29,8 +29,12 @@
 
 all: compile
 clean: $(patsubst %,%-clean,$(package-) $(package-y) $(package-m))
-compile: $(COMPILE_PACKAGES)
-install: base-files-install $(INSTALL_PACKAGES)
+compile-targets: $(COMPILE_PACKAGES)
+compile:
+	$(MAKE) -j$(CONFIG_JLEVEL) compile-targets
+install-targets: base-files-install $(INSTALL_PACKAGES)
+install:
+	rm -rf $(BUILD_DIR)/root
+	$(MAKE) install-targets
 
 
-

file:a/rules.mk -> file:b/rules.mk
--- a/rules.mk
+++ b/rules.mk
@@ -24,8 +24,8 @@
 
 
 CP=cp -fpR
-MAKE1=make
-MAKEFLAGS=-j$(CONFIG_JLEVEL) V=$(V) $(EXTRA_MAKEFLAGS)
+BUILD_MAKEFLAGS= V=$(V) $(EXTRA_MAKEFLAGS)
+MAKEFLAGS=$(BUILD_MAKEFLAGS)
 # Strip off the annoying quoting
 ARCH:=$(strip $(subst ",, $(CONFIG_ARCH)))
 WGET:=$(strip $(subst ",, $(CONFIG_WGET)))

comments