large build system cleanup. added some stuff to control the verbosity level, but not complete, yet.
large build system cleanup. added some stuff to control the verbosity level, but not complete, yet.

git-svn-id: svn://svn.openwrt.org/openwrt/trunk/openwrt@2221 3c298f89-4303-0410-b956-a3cf2f4a3e73

file:a/Config.in -> file:b/Config.in
--- a/Config.in
+++ b/Config.in
@@ -84,10 +84,6 @@
 	bool 
 	default n
 
-config BR2_STAGING_DIR
-	string
-	default "$(BASE_DIR)/staging_dir_$(ARCH)$(ARCH_FPU_SUFFIX)"
-
 config BR2_JLEVEL
 	int
 	default "1"

file:a/Makefile -> file:b/Makefile
--- a/Makefile
+++ b/Makefile
@@ -1,4 +1,4 @@
-# Makefile for OpenWRT
+# Makefile for OpenWrt
 #
 # Copyright (C) 2005 by Felix Fietkau <openwrt@nbd.name>
 # Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org>
@@ -24,6 +24,7 @@
 #--------------------------------------------------------------
 TOPDIR=${shell pwd}
 export TOPDIR
+
 ifneq ($(DEVELOPER),)
 CONFIG_CONFIG_IN = Config.in.devel
 else
@@ -57,7 +58,8 @@
 # In this section, we need .config
 include .config.cmd
 
-world: $(DL_DIR) $(BUILD_DIR) configtest toolchain/install target/compile package/compile target/install package_index
+world: $(DL_DIR) $(BUILD_DIR) configtest 
+	$(MAKE) toolchain/install target/compile package/compile root_clean package/install target/install package_index
 
 .PHONY: all world clean dirclean distclean image_clean target_clean source configtest
 
@@ -66,9 +68,7 @@
 	-scripts/configtest.pl
 
 package_index:
-	(cd $(PACKAGE_DIR); \
-		$(STAGING_DIR)/usr/bin/ipkg-make-index . > Packages \
-	)
+	(cd $(PACKAGE_DIR); $(STAGING_DIR)/usr/bin/ipkg-make-index . > Packages)
 
 $(DL_DIR):
 	@mkdir -p $(DL_DIR)
@@ -76,16 +76,18 @@
 $(BUILD_DIR):
 	@mkdir -p $(BUILD_DIR)
 
-source: $(TARGETS_SOURCE)
-
+source: toolchain/source package/source target/source
 
 package/%:
+	@$(TRACE) $@
 	$(MAKE) -C package $(patsubst package/%,%,$@)
 
 target/%:
+	@$(TRACE) $@
 	$(MAKE) -C target $(patsubst target/%,%,$@)
 
 toolchain/%:
+	@$(TRACE) $@
 	$(MAKE) -C toolchain $(patsubst toolchain/%,%,$@)
 
 #############################################################
@@ -93,30 +95,23 @@
 # Cleanup and misc junk
 #
 #############################################################
-image_clean:
+root_clean:
+	rm -rf $(BUILD_DIR)/linux-*/root $(BUILD_DIR)/root
+
+target_clean: root_clean
 	rm -f $(STAMP_DIR)/.*-compile
 	rm -f $(STAMP_DIR)/.*-install
 	rm -rf $(BIN_DIR)
-	
-target_clean: image_clean
-	rm -rf $(BUILD_DIR)/linux-*/root
 
-clean: target_clean
+clean: dirclean
+
+dirclean:
 	@$(MAKE) -C $(CONFIG) clean
-
-dirclean: clean
 	rm -rf $(BUILD_DIR)
 
-distclean: clean
-	rm -rf $(STAMP_DIR) $(DL_DIR) $(BUILD_DIR) $(TOOL_BUILD_DIR) $(STAGING_DIR)
+distclean: dirclean
+	rm -rf $(STAMP_DIR) $(DL_DIR) $(TOOL_BUILD_DIR) $(STAGING_DIR)
 	rm -f .config* .tmpconfig.h
-
-sourceball: distclean
-	set -e; \
-	cd ..; \
-	rm -f buildroot.tar.bz2; \
-	tar -cvf buildroot.tar buildroot; \
-	bzip2 -9 buildroot.tar; \
 
 else # ifeq ($(strip $(BR2_HAVE_DOT_CONFIG)),y)
 

--- a/package/Config.in
+++ b/package/Config.in
@@ -9,6 +9,7 @@
 source "package/ipkg/Config.in"
 source "package/iptables/Config.in"
 source "package/mtd/Config.in"
+source "package/nvram/Config.in"
 
 comment "Applications"
 source "package/deco/Config.in"

--- a/package/Makefile
+++ b/package/Makefile
@@ -2,7 +2,6 @@
 include $(TOPDIR)/rules.mk
 
 package-:=tcp_wrappers
-package-y:=nvram
 package-$(BR2_PACKAGE_6TUNNEL) += 6tunnel
 package-$(BR2_PACKAGE_AICCU) += aiccu
 package-$(BR2_PACKAGE_AIRCRACK) += aircrack
@@ -125,6 +124,7 @@
 package-$(BR2_PACKAGE_NMAP) += nmap
 package-$(BR2_PACKAGE_NOCATSPLASH) += nocatsplash
 package-$(BR2_PACKAGE_NTPCLIENT) += ntpclient
+package-$(BR2_PACKAGE_NVRAM) += nvram
 package-$(BR2_PACKAGE_OLSRD) += olsrd
 package-$(BR2_PACKAGE_OPENCDK) += opencdk
 package-$(BR2_PACKAGE_OPENLDAP) += openldap
@@ -206,7 +206,7 @@
 package-$(BR2_PACKAGE_XSUPPLICANT) += xsupplicant
 package-$(BR2_PACKAGE_ZLIB) += zlib
 
-DEV_LIBS:=tcp_wrappers glib ncurses openssl pcre popt zlib libnet libpcap mysql postgresql iptables matrixssl lzo gmp fuse portmap libelf uclibc++ speex libpng libgd wireless-tools nvram linux-atm
+DEV_LIBS:=tcp_wrappers glib ncurses openssl pcre popt zlib libnet libpcap mysql postgresql iptables matrixssl lzo gmp fuse portmap libelf uclibc++ speex libpng libgd wireless-tools nvram linux-atm libamsel libao libart libdaemon libdb libdnet libevent libffi-sable libgcrypt libgdbm libgpg-error libid3tag libmad libnet libnids libogg libosip2 libpcap libtasn1 libupnp libusb libvorbis libvorbisidec libxml2 libxslt
 DEV_LIBS_COMPILE:=$(patsubst %,%-compile,$(DEV_LIBS))
 SDK_DEFAULT_PACKAGES:=busybox dnsmasq iptables wireless-tools dropbear bridge ipkg ppp
 SDK_DEFAULT_COMPILE:=$(patsubst %,%-compile,$(SDK_DEFAULT_PACKAGES))
@@ -437,27 +437,34 @@
 $(STAMP_DIR):
 	mkdir -p $@
 
-%-prepare: $(STAMP_DIR)
-	@[ -f $(STAMP_DIR)/.$@ ] || $(MAKE) -C $(patsubst %-prepare,%,$@) prepare
+$(TARGET_DIR):
+	mkdir -p $(TARGET_DIR)
+
+%-prepare: $(STAMP_DIR) $(TARGET_DIR)
+	@[ -f $(STAMP_DIR)/.$@ ] || { \
+		$(TRACE) package/$(patsubst %-prepare,%,$@)/prepare; \
+		$(MAKE) -C $(patsubst %-prepare,%,$@) prepare; \
+	}
 	@touch $(STAMP_DIR)/.$@
 
 %-compile: %-prepare 
-	@[ -f $(STAMP_DIR)/.$@ ] || $(MAKE) -C $(patsubst %-compile,%,$@) compile
+	@[ -f $(STAMP_DIR)/.$@ ] || { \
+		$(TRACE) package/$(patsubst %-compile,%,$@)/compile; \
+		$(MAKE) -C $(patsubst %-compile,%,$@) compile; \
+	}
 	@touch $(STAMP_DIR)/.$@
 
 %-install: %-compile
-	@$(MAKE) -C $(patsubst %-install,%,$@) \
-		TARGET_DIR="$(TARGET_DIR)" \
-		IPKG_CONF="$(IPKG_CONF)" \
-		BOARD="$(BOARD)" \
-		KERNEL="$(KERNEL)" \
-		install
+	@$(TRACE) package/$(patsubst %-install,%,$@)/install
+	@$(MAKE) -C $(patsubst %-install,%,$@) install
 
 %-rebuild: 
+	@$(TRACE) package/$(patsubst %-rebuild,%,$@)/rebuild
 	@rm -f $(STAMP_DIR)/.$(patsubst %-rebuild,%,$@)-*
 	$(MAKE) -C $(patsubst %-rebuild,%,$@) rebuild
 
 %-clean:
+	@$(TRACE) package/$(patsubst %-clean,%,$@)/clean
 	@$(MAKE) -C $(patsubst %-clean,%,$@) clean
 	@rm -f $(STAMP_DIR)/.$(patsubst %-clean,%,$@)-*
 

--- /dev/null
+++ b/package/nvram/Config.in
@@ -1,1 +1,8 @@
+config BR2_PACKAGE_NVRAM
+	tristate "nvram - broadcom config utility"
+	default y 
+	depends BR2_LINUX_2_4_BRCM
+	help
+	  control utility for broadcom's 'nvram' config area
 
+

--- a/package/nvram/Makefile
+++ b/package/nvram/Makefile
@@ -8,13 +8,6 @@
 PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)
 
 include $(TOPDIR)/package/rules.mk
-
-# does not depend on menuconfig
-ifneq ($(BOARD)-$(KERNEL),brcm-2.4)
-BR2_PACKAGE_NVRAM:=m
-else
-BR2_PACKAGE_NVRAM:=y
-endif
 
 $(eval $(call PKG_template,NVRAM,nvram,$(PKG_RELEASE),$(ARCH)))
 

--- a/package/rules.mk
+++ b/package/rules.mk
@@ -1,6 +1,4 @@
 # invoke ipkg with configuration in $(STAGING_DIR)/etc/ipkg.conf 
-IPKG := IPKG_INSTROOT=$(TARGET_DIR) IPKG_CONF_DIR=$(IPKG_CONF) $(SCRIPT_DIR)/ipkg -force-defaults -force-depends
-IPKG_STATE_DIR := $(TARGET_DIR)/usr/lib/ipkg
 
 define PKG_template
 IPKG_$(1):=$(PACKAGE_DIR)/$(2)_$(3)_$(4).ipk

file:a/rules.mk -> file:b/rules.mk
--- a/rules.mk
+++ b/rules.mk
@@ -2,21 +2,41 @@
 SHELL=/bin/bash
 export SHELL
 
+ifeq ($(V),)
+V=99
+endif
+
+ifneq ($(V),0)
+TRACE:=echo "---> "
+else
+TRACE:=:
+endif
+
+ifeq (${shell [ "$(V)" -ge 5 ] && echo 1},)
+PKG_TRACE:=:
+else
+PKG_TRACE:=echo "------> "
+endif
+
+ifeq (${shell [ "$(V)" -ge 10 ] && echo 1},)
+EXTRA_MAKEFLAGS:=-s
+MAKE_TRACE:=>&/dev/null
+else
+MAKE_TRACE:=
+EXTRA_MAKEFLAGS:=
+TRACE:=:
+PKG_TRACE:=:
+endif
+
 MAKE1=make
-MAKEFLAGS=-j$(BR2_JLEVEL)
-
+MAKEFLAGS=-j$(BR2_JLEVEL) V=$(V) $(EXTRA_MAKEFLAGS)
 # Strip off the annoying quoting
 ARCH:=$(strip $(subst ",, $(BR2_ARCH)))
-#"
 WGET:=$(strip $(subst ",, $(BR2_WGET)))
-#"
-
 GCC_VERSION:=$(strip $(subst ",, $(BR2_GCC_VERSION)))
-#"
 GCC_USE_SJLJ_EXCEPTIONS:=$(strip $(subst ",, $(BR2_GCC_USE_SJLJ_EXCEPTIONS)))
-#"
 TARGET_OPTIMIZATION:=$(strip $(subst ",, $(BR2_TARGET_OPTIMIZATION)))
-#""
+#"))"))"))"))")) # for vim's broken syntax highlighting :)
 
 
 ifeq ($(BR2_SOFT_FLOAT),y)
@@ -51,15 +71,14 @@
 BASE_DIR:=$(TOPDIR)
 DL_DIR:=$(BASE_DIR)/dl
 BUILD_DIR:=$(BASE_DIR)/build_$(ARCH)$(ARCH_FPU_SUFFIX)
+STAGING_DIR:=$(BASE_DIR)/staging_dir_$(ARCH)$(ARCH_FPU_SUFFIX)
 SCRIPT_DIR:=$(BASE_DIR)/scripts
 BIN_DIR:=$(BASE_DIR)/bin
 STAMP_DIR:=$(BUILD_DIR)/stamp
 PACKAGE_DIR:=$(BIN_DIR)/packages
 STAMP_DIR:=$(BUILD_DIR)/stamp
+TARGET_DIR:=$(BUILD_DIR)/root
 TOOL_BUILD_DIR=$(BASE_DIR)/toolchain_build_$(ARCH)$(ARCH_FPU_SUFFIX)
-# Strip off the annoying quoting
-STAGING_DIR:=$(strip $(subst ",, $(BR2_STAGING_DIR)))
-#"
 TARGET_PATH=$(STAGING_DIR)/usr/bin:$(STAGING_DIR)/bin:/bin:/sbin:/usr/bin:/usr/sbin
 IMAGE:=$(BUILD_DIR)/root_fs_$(ARCH)$(ARCH_FPU_SUFFIX)
 REAL_GNU_TARGET_NAME=$(OPTIMIZE_FOR_CPU)-linux-uclibc
@@ -67,7 +86,6 @@
 KERNEL_CROSS:=$(STAGING_DIR)/bin/$(OPTIMIZE_FOR_CPU)-linux-uclibc-
 TARGET_CROSS:=$(STAGING_DIR)/bin/$(OPTIMIZE_FOR_CPU)-linux-uclibc-
 TARGET_CC:=$(TARGET_CROSS)gcc
-#STRIP:=$(TARGET_CROSS)strip --remove-section=.comment --remove-section=.note
 STRIP:=$(STAGING_DIR)/bin/sstrip
 PATCH=$(SCRIPT_DIR)/patch-kernel.sh
 SED:=$(STAGING_DIR)/bin/sed -i -e
@@ -110,9 +128,10 @@
 
 # invoke ipkg-build with some default options
 IPKG_BUILD := PATH="$(TARGET_PATH)" ipkg-build -c -o root -g root
-
 # where to build (and put) .ipk packages
 IPKG_TARGET_DIR := $(PACKAGE_DIR)
+IPKG:=IPKG_TMP=$(BUILD_DIR)/tmp IPKG_INSTROOT=$(TARGET_DIR) IPKG_CONF_DIR=$(STAGING_DIR)/etc $(SCRIPT_DIR)/ipkg -force-defaults -force-depends
+IPKG_STATE_DIR := $(TARGET_DIR)/usr/lib/ipkg
 
 RSTRIP:=STRIP="$(STRIP)" $(SCRIPT_DIR)/rstrip.sh
 RSTRIP_KMOD:=STRIP="$(TARGET_CROSS)strip --strip-unneeded --remove-section=.comment" $(SCRIPT_DIR)/rstrip.sh

--- a/target/Makefile
+++ b/target/Makefile
@@ -17,16 +17,22 @@
 	rm -f $(BIN_DIR)/openwrt-*
 
 %-clean:
+	@$(TRACE) target/$(patsubst %-clean,%,$@)/clean
 	$(MAKE) -C $(patsubst %-clean,%,$@) clean
 %-prepare:
+	@$(TRACE) target/$(patsubst %-prepare,%,$@)/prepare
 	$(MAKE) -C $(patsubst %-prepare,%,$@) prepare
 %-compile: %-prepare
+	@$(TRACE) target/$(patsubst %-compile,%,$@)/compile
 	$(MAKE) -C $(patsubst %-compile,%,$@) compile
 %-rebuild: 
+	@$(TRACE) target/$(patsubst %-rebuild,%,$@)/rebuild
 	$(MAKE) -C $(patsubst %-rebuild,%,$@) rebuild
 %-install: %-compile
+	@$(TRACE) target/$(patsubst %-install,%,$@)/install
 	$(MAKE) -C $(patsubst %-install,%,$@) install
 linux-imagebuilder:
+	@$(TRACE) target/linux/imagebuilder
 	$(MAKE) -C linux imagebuilder
 
 

--- a/target/linux/Config.in
+++ b/target/linux/Config.in
@@ -1,13 +1,10 @@
-
-config BR2_LINUX_2_4
-	bool "Linux 2.4 (choose only one target board)"
-	default y
-
+choice
+	prompt "Target system"
+	
 config BR2_LINUX_2_4_BRCM
-	bool "Support for Broadcom based routers"
+	bool "Support for Broadcom based routers [2.4]"
 	default y
 	depends BR2_mipsel
-	depends BR2_LINUX_2_4
 	help
 	  Build firmware images for Broadcom based routers
 	  (e.g. Linksys WRT54G(S), Asus WL-500g, Motorola WR850G)
@@ -17,48 +14,30 @@
 	  with TFTP client too. 
 
 config BR2_LINUX_2_4_AR7
-	bool "Support for TI AR7 based devices"
+	bool "Support for TI AR7 based devices [2.4]"
 	default n
 	depends BR2_mipsel
-	depends BR2_LINUX_2_4
 	help
 	  Build firmware images for TI AR7 based routers (w.g. Linksys WAG54G v2)
 
 config BR2_LINUX_2_4_SOEKRIS
-	bool "Support for Soekris boards"
+	bool "Support for Soekris boards [2.4]"
 	default n
 	depends BR2_i386
-	depends BR2_LINUX_2_4
 	help
 	  Build firmware images for Soekris based boards
 	  (e.g. net4521, net4801)
-	  
-	config BR2_TARGET_NET4521
-		default y
-		depends BR2_LINUX_2_4_SOEKRIS
-		bool "Soekris net4521"
-
-	config BR2_TARGET_NET4801
-		default y
-		depends BR2_LINUX_2_4_SOEKRIS
-		bool "Soekris net4801"
-
-config BR2_LINUX_2_6
-	bool "Linux 2.6"
-	default n
-
+	 
 config BR2_LINUX_2_6_BRCM
-	bool "Support for Broadcom based routers"
+	bool "Support for Broadcom based routers [2.6]"
 	default n
 	depends BR2_mipsel
-	depends BR2_LINUX_2_6
-	select BR2_PACKAGE_KMOD_B44
-	select BR2_PACKAGE_KMOD_MADWIFI
-	select BR2_PACKAGE_ROBOCFG
 	help
 	  Build firmware images for Broadcom based routers
 	  (e.g. Netgear WGT634u)
-	  
+	
+endchoice
+	
 comment "Kernel Modules"
 
 config BR2_PACKAGE_KMOD_SANGAM_ATM_A
@@ -103,6 +82,7 @@
 config BR2_PACKAGE_KMOD_B44
 	tristate "Broadcom 44XX, 47XX ethernet driver"
 	default m
+	default y if BR2_LINUX_2_6_BRCM
 	help
 	  Free driver for Broadcom Ethernet chipsets (without switch support)
 
@@ -347,7 +327,6 @@
 
 config BR2_PACKAGE_KMOD_ATM
 	tristate "ATM support"
-	default m
 	default y if BR2_LINUX_2_4_AR7
 	help
 	  ATM support

--- a/target/linux/Makefile
+++ b/target/linux/Makefile
@@ -58,6 +58,7 @@
 	cp $(TOPDIR)/rules.mk $(IB_DIR)
 	cp -fpR ./image $(IB_DIR)/
 	cp $(TOPDIR)/.config $(IB_DIR)/
+	find $(IB_DIR) -name .svn | xargs rm -rf
 	find $(IB_DIR) -name CVS | xargs rm -rf
 	(cd $(BUILD_DIR); tar c $(IB_NAME) | bzip2 -c > $(BIN_DIR)/$(IB_NAME).tar.bz2)
 
@@ -66,8 +67,10 @@
 endif
 
 prepare:
+	@$(TRACE) target/linux/image/prepare
 	$(MAKE) -C image prepare
 compile:
+	@$(TRACE) target/linux/image/compile
 	$(MAKE) -C image compile
 install:
 rebuild:

--- a/target/linux/image/Makefile
+++ b/target/linux/image/Makefile
@@ -17,10 +17,15 @@
 prepare:
 compile:
 install:
+
+$(BOARD)-compile:
+	@$(TRACE) target/linux/image/$(BOARD)/prepare
 	$(MAKE) -C $(BOARD) prepare
+	@$(TRACE) target/linux/image/$(BOARD)/compile
 	$(MAKE) -C $(BOARD) compile
 
 install-ib:
+	@$(TRACE) target/linux/image/$(BOARD)/install-ib
 	-$(MAKE) -C $(BOARD) IB_DIR="$(IB_DIR)" install-ib
 	mkdir -p $(IB_DIR)/build_$(ARCH)/linux-$(KERNEL)-$(BOARD)
 	cp $(BUILD_DIR)/linux-$(KERNEL)-$(BOARD)/kernel[-_]*.ipk $(IB_DIR)/build_$(ARCH)/linux-$(KERNEL)-$(BOARD)/	

--- a/target/linux/image/jffs2.mk
+++ b/target/linux/image/jffs2.mk
@@ -19,8 +19,10 @@
 	@rm -rf $(KDIR)/root/jffs
 	$(STAGING_DIR)/bin/mkfs.jffs2 $(JFFS2OPTS) -e 0x20000 -o $@ -d $(KDIR)/root
 
-jffs2-install: $(KDIR)/root.jffs2-4MB $(KDIR)/root.jffs2-8MB
+jffs2-install: $(KDIR)/root.jffs2-4MB $(KDIR)/root.jffs2-8MB $(BOARD)-compile
+	$(TRACE) target/linux/image/$(BOARD)/install
 	$(MAKE) -C $(BOARD) install KERNEL="$(KERNEL)" FS="jffs2-4MB"
+	$(TRACE) target/linux/image/$(BOARD)/install
 	$(MAKE) -C $(BOARD) install KERNEL="$(KERNEL)" FS="jffs2-8MB"
 
 jffs2-install-ib:

--- a/target/linux/image/squashfs.mk
+++ b/target/linux/image/squashfs.mk
@@ -12,7 +12,8 @@
 	@mkdir -p $(KDIR)/root/jffs
 	$(STAGING_DIR)/bin/mksquashfs-lzma $(KDIR)/root $@ -nopad -noappend -root-owned -le
 
-squashfs-install: $(KDIR)/root.squashfs
+squashfs-install: $(KDIR)/root.squashfs $(BOARD)-compile
+	$(TRACE) target/linux/image/$(BOARD)/install
 	$(MAKE) -C $(BOARD) install KERNEL="$(KERNEL)" FS="squashfs"
 
 squashfs-install-ib:

--- a/target/linux/linux-2.4/Makefile
+++ b/target/linux/linux-2.4/Makefile
@@ -16,7 +16,7 @@
 LINUX_SOURCE := linux-$(LINUX_VERSION).tar.bz2
 LINUX_SOURCE_DIR := $(LINUX_BUILD_DIR)/linux-$(LINUX_VERSION)
 MODULES_DIR := $(LINUX_BUILD_DIR)/modules/$(MODULES_SUBDIR)
-TARGET_MODULES_DIR := $(TARGET_DIR)/lib/modules/$(LINUX_VERSION)
+TARGET_MODULES_DIR := $(LINUX_TARGET_DIR)/lib/modules/$(LINUX_VERSION)
 IPKG_KERNEL:=IPKG_TMP=$(BUILD_DIR)/tmp IPKG_INSTROOT=$(LINUX_TARGET_DIR) IPKG_CONF_DIR=$(LINUX_BUILD_DIR) $(SCRIPT_DIR)/ipkg -force-defaults -force-depends
 
 PKG_BUILD_DIR := $(LINUX_BUILD_DIR)/linux-modules
@@ -250,6 +250,7 @@
 	@mkdir -p $(STAMP_DIR)
 	@$(MAKE) $(TARGETS)
 	ln -sf $(LINUX_BUILD_DIR)/linux-$(LINUX_VERSION) $(LINUX_DIR)
+	@$(TRACE) target/linux/package
 	$(MAKE) -C $(TOPDIR)/target/linux/package \
 		$(KPKG_MAKEOPTS) \
 		compile
@@ -274,12 +275,8 @@
 
 install: compile $(TARGET_MODULES_DIR) $(KERNEL_IPKG)
 	rm -rf $(LINUX_BUILD_DIR)/root*
+	cp -fpR $(BUILD_DIR)/root $(LINUX_BUILD_DIR)/
 	echo -e 'dest root /\noption offline_root $(LINUX_BUILD_DIR)/root' > $(LINUX_BUILD_DIR)/ipkg.conf
-	$(MAKE) -C $(TOPDIR)/package \
-		TARGET_DIR="$(LINUX_TARGET_DIR)" \
-		IPKG_CONF="$(LINUX_BUILD_DIR)" \
-		BOARD="$(BOARD)" \
-		install
 	$(MAKE) -C $(TOPDIR)/target/linux/package \
 		$(KPKG_MAKEOPTS) \
 		install

--- a/target/linux/linux-2.6/Makefile
+++ b/target/linux/linux-2.6/Makefile
@@ -25,7 +25,7 @@
 LINUX_SOURCE := linux-$(LINUX_VERSION).tar.bz2
 LINUX_SOURCE_DIR := $(LINUX_BUILD_DIR)/linux-$(LINUX_VERSION)
 MODULES_DIR := $(LINUX_BUILD_DIR)/modules/$(MODULES_SUBDIR)
-TARGET_MODULES_DIR := $(TARGET_DIR)/lib/modules/$(LINUX_VERSION)
+TARGET_MODULES_DIR := $(LINUX_TARGET_DIR)/lib/modules/$(LINUX_VERSION)
 IPKG_KERNEL:=IPKG_TMP=$(BUILD_DIR)/tmp IPKG_INSTROOT=$(LINUX_TARGET_DIR) IPKG_CONF_DIR=$(LINUX_BUILD_DIR) $(SCRIPT_DIR)/ipkg -force-defaults -force-depends
 
 PKG_BUILD_DIR := $(LINUX_BUILD_DIR)/linux-modules
@@ -46,10 +46,6 @@
 
 INSTALL_TARGETS := $(KERNEL_IPKG)
 TARGETS := 
-
-ifeq ($(BOARD),brcm)
-include ./broadcom.mk
-endif
 
 $(eval $(call KMOD_template,ATM,atm,\
 	$(MODULES_DIR)/kernel/net/atm/atm.ko \
@@ -238,18 +234,15 @@
 prepare: $(LINUX_DIR)/.configured
 compile: $(LINUX_DIR)/.modules_done $(TARGETS)
 	ln -sf $(LINUX_BUILD_DIR)/linux-$(LINUX_VERSION) $(LINUX_DIR)
+	@$(TRACE) target/linux/package
 	$(MAKE) -C $(TOPDIR)/target/linux/package \
 		$(KPKG_MAKEOPTS) \
 		compile
 
 install: compile $(TARGET_MODULES_DIR) $(KERNEL_IPKG)
 	rm -rf $(LINUX_BUILD_DIR)/root*
+	cp -fpR $(BUILD_DIR)/root $(LINUX_BUILD_DIR)/
 	echo -e 'dest root /\noption offline_root $(LINUX_BUILD_DIR)/root' > $(LINUX_BUILD_DIR)/ipkg.conf
-	$(MAKE) -C $(TOPDIR)/package \
-		TARGET_DIR="$(LINUX_TARGET_DIR)" \
-		IPKG_CONF="$(LINUX_BUILD_DIR)" \
-		BOARD="$(BOARD)" \
-		install
 	$(MAKE) -C $(TOPDIR)/target/linux/package \
 		$(KPKG_MAKEOPTS) \
 		install

--- a/target/linux/linux-2.6/broadcom.mk
+++ /dev/null
@@ -1,4 +1,1 @@
-# $Id$
-#
-# broadcom specific kmod packages
 

--- a/target/linux/package/Makefile
+++ b/target/linux/package/Makefile
@@ -34,21 +34,25 @@
 
 
 %-prepare:
+	@$(TRACE) target/linux/package/$(patsubst %-prepare,%,$@)-prepare
 	$(MAKE) -C $(patsubst %-prepare,%,$@) \
 		$(MAKEOPTS) \
 		prepare
 
 %-compile: %-prepare 
+	@$(TRACE) target/linux/package/$(patsubst %-compile,%,$@)-compile
 	$(MAKE) -C $(patsubst %-compile,%,$@) \
 		$(MAKEOPTS) \
 		compile
 
 %-install: %-compile
+	@$(TRACE) target/linux/package/$(patsubst %-install,%,$@)-install
 	$(MAKE) -C $(patsubst %-install,%,$@) \
 		$(MAKEOPTS) \
 		install
 
 %-clean:
+	@$(TRACE) target/linux/package/$(patsubst %-clean,%,$@)-clean
 	@$(MAKE) -C $(patsubst %-clean,%,$@) clean
 
 

--- a/toolchain/Makefile
+++ b/toolchain/Makefile
@@ -30,18 +30,28 @@
 	@mkdir -p $(TOOL_BUILD_DIR)
 
 %-prepare: $(TOOLCHAIN_STAMP_DIR) $(STAGING_DIR) $(TOOL_BUILD_DIR)
-	@[ -f $(TOOLCHAIN_STAMP_DIR)/.toolchain_$@ ] || $(MAKE) -C $(patsubst %-prepare,%,$@) prepare
+	@[ -f $(TOOLCHAIN_STAMP_DIR)/.toolchain_$@ ] || { \
+		$(TRACE) toolchain/$(patsubst %-prepare,%,$@)/prepare; \
+		$(MAKE) -C $(patsubst %-prepare,%,$@) prepare; \
+	}
 	@touch $(TOOLCHAIN_STAMP_DIR)/.toolchain_$@
 
 %-compile: %-prepare 
-	@[ -f $(TOOLCHAIN_STAMP_DIR)/.toolchain_$@ ] || $(MAKE) -C $(patsubst %-compile,%,$@) compile
+	@[ -f $(TOOLCHAIN_STAMP_DIR)/.toolchain_$@ ] || { \
+		$(TRACE) toolchain/$(patsubst %-compile,%,$@)/compile; \
+		$(MAKE) -C $(patsubst %-compile,%,$@) compile; \
+	}
 	@touch $(TOOLCHAIN_STAMP_DIR)/.toolchain_$@
 
 %-install: %-compile
-	@[ -f $(TOOLCHAIN_STAMP_DIR)/.toolchain_$@ ] || $(MAKE) -C $(patsubst %-install,%,$@) install
+	@[ -f $(TOOLCHAIN_STAMP_DIR)/.toolchain_$@ ] || { \
+		$(TRACE) toolchain/$(patsubst %-install,%,$@)/install; \
+		$(MAKE) -C $(patsubst %-install,%,$@) install; \
+	}
 	@touch $(TOOLCHAIN_STAMP_DIR)/.toolchain_$@
 
 %-clean:
+	$(TRACE) toolchain/$(patsubst %-clean,%,$@)/clean
 	@$(MAKE) -C $(patsubst %-clean,%,$@) clean
 	@rm -f $(TOOLCHAIN_STAMP_DIR)/.toolchain_$(patsubst %-clean,%,$@)-*
 

--- a/toolchain/kernel-headers/Makefile
+++ b/toolchain/kernel-headers/Makefile
@@ -4,10 +4,11 @@
 
 LINUX_HEADERS_VERSION=2.4.30
 LINUX_KERNEL_MD5SUM:=75d8ce40a3668603017cd186909efe8d
-LINUX_HEADERS_SITE=http://www.fi.kernel.org/pub/linux/kernel/v2.4 \
-		   http://www.fr.kernel.org/pub/linux/kernel/v2.4 \
-		   http://www.kernel.org/pub/linux/kernel/v2.4 \
-		   http://www.de.kernel.org/pub/linux/kernel/v2.4 
+LINUX_HEADERS_SITE= \
+		http://www.de.kernel.org/pub/linux/kernel/v2.4 \
+		http://www.fi.kernel.org/pub/linux/kernel/v2.4 \
+		http://www.fr.kernel.org/pub/linux/kernel/v2.4 \
+		http://www.kernel.org/pub/linux/kernel/v2.4 \
 
 LINUX_HEADERS_SOURCE=linux-$(LINUX_HEADERS_VERSION).tar.bz2
 LINUX_HEADERS_ARCH:=$(shell echo $(ARCH) | sed -e 's/i[3-9]86/i386/' \

comments