From da0444cb98e698043fa3b208e3dc80b82a928d03 Mon Sep 17 00:00:00 2001
From: nbd <nbd@3c298f89-4303-0410-b956-a3cf2f4a3e73>
Date: Thu, 19 Oct 2006 05:01:04 +0000
Subject: cleanup

git-svn-id: svn://svn.openwrt.org/openwrt/trunk@5224 3c298f89-4303-0410-b956-a3cf2f4a3e73
---
 include/kernel-build.mk | 15 +++++++--------
 include/kernel.mk       |  7 +++++--
 2 files changed, 12 insertions(+), 10 deletions(-)

(limited to 'include')

diff --git a/include/kernel-build.mk b/include/kernel-build.mk
index 0697b79a5..04c3c7f8e 100644
--- a/include/kernel-build.mk
+++ b/include/kernel-build.mk
@@ -4,7 +4,10 @@
 # This is free software, licensed under the GNU General Public License v2.
 # See /LICENSE for more information.
 #
+KERNEL_BUILD:=1
+
 include $(INCLUDE_DIR)/host.mk
+include $(INCLUDE_DIR)/kernel.mk
 
 LINUX_SOURCE:=linux-$(LINUX_VERSION).tar.bz2
 LINUX_SITE=http://www.us.kernel.org/pub/linux/kernel/v$(KERNEL) \
@@ -43,7 +46,7 @@ $(LINUX_DIR)/.unpacked: $(DL_DIR)/$(LINUX_SOURCE)
 	touch $@
 
 ifeq ($(KERNEL),2.4)
-$(LINUX_DIR)/.configured: $(LINUX_DIR)/.patched
+$(LINUX_DIR)/.configured: $(LINUX_DIR)/.patched $(LINUX_DIR)/.config
 	$(SED) "s,\-mcpu=,\-mtune=,g;" $(LINUX_DIR)/arch/mips/Makefile
 	$(MAKE) -C $(LINUX_DIR) CROSS_COMPILE="$(KERNEL_CROSS)" CC="$(KERNEL_CC)" ARCH=$(LINUX_KARCH) oldconfig include/linux/compile.h include/linux/version.h
 	touch $@
@@ -73,25 +76,22 @@ else
 	echo 'CONFIG_INITRAMFS_SOURCE=""' >> $(LINUX_DIR)/.config
 endif
 
-$(LINUX_DIR)/vmlinux: $(LINUX_DIR)/.linux-compile ramdisk-config
+$(LINUX_DIR)/vmlinux: ramdisk-config
 	$(MAKE) -j$(CONFIG_JLEVEL) -C $(LINUX_DIR) CROSS_COMPILE="$(KERNEL_CROSS)" CC="$(KERNEL_CC)" ARCH=$(LINUX_KARCH) $(KERNELNAME)
 
 $(LINUX_KERNEL): $(LINUX_DIR)/vmlinux
 	$(KERNEL_CROSS)objcopy -O binary -R .reginfo -R .note -R .comment -R .mdebug -S $< $@
 	touch -c $(LINUX_KERNEL)
 
-$(LINUX_DIR)/.modules_done:
+$(LINUX_DIR)/.modules_done: $(LINUX_DIR)/.config
 	rm -rf $(KERNEL_BUILD_DIR)/modules
 	$(MAKE) -j$(CONFIG_JLEVEL) -C "$(LINUX_DIR)" CROSS_COMPILE="$(KERNEL_CROSS)" CC="$(KERNEL_CC)" ARCH=$(LINUX_KARCH) modules
 	$(MAKE) -C "$(LINUX_DIR)" CROSS_COMPILE="$(KERNEL_CROSS)" CC="$(KERNEL_CC)" ARCH=$(LINUX_KARCH) DEPMOD=true INSTALL_MOD_PATH=$(KERNEL_BUILD_DIR)/modules modules_install
 	touch $(LINUX_DIR)/.modules_done
 
-modules: $(LINUX_DIR)/.modules_done
-
-$(LINUX_DIR)/.linux-compile:
+$(LINUX_DIR)/.linux-compile: $(LINUX_DIR)/.modules_done
 	@rm -f $(BUILD_DIR)/linux
 	ln -sf $(KERNEL_BUILD_DIR)/linux-$(LINUX_VERSION) $(BUILD_DIR)/linux
-	@$(MAKE) modules
 	touch $@
 
 $(TOPDIR)/.kernel.mk: $(TOPDIR)/target/linux/$(BOARD)-$(KERNEL)/Makefile
@@ -106,7 +106,6 @@ prepare: $(LINUX_DIR)/.configured
 	@mkdir -p $(LINUX_DIR)
 
 compile: prepare $(LINUX_DIR)/.linux-compile
-
 install: compile $(LINUX_KERNEL)
 
 mostlyclean: FORCE
diff --git a/include/kernel.mk b/include/kernel.mk
index af5d9455f..42c9cdf3a 100644
--- a/include/kernel.mk
+++ b/include/kernel.mk
@@ -18,11 +18,14 @@ else
      LINUX_VERSION:=$(CONFIG_LINUX_VERSION)
      LINUX_RELEASE:=$(CONFIG_LINUX_RELEASE)
      LINUX_KARCH:=$(CONFIG_LINUX_KARCH)
-  else
+  else 
   # oops, old .kernel.config; rebuild it (hiding the misleading errors this produces)
     $(warning rebuilding .kernel.mk)
     $(TOPDIR)/.kernel.mk: FORCE
-	@$(MAKE) -C $(TOPDIR)/target/linux/$(BOARD)-$(KERNEL) $@ &>/dev/null
+    ifneq ($(KERNEL_BUILD),1)
+      $(TOPDIR)/.kernel.mk:
+		@$(MAKE) -C $(TOPDIR)/target/linux/$(BOARD)-$(KERNEL) $@ &>/dev/null
+    endif
   endif
 
   ifeq ($(KERNEL),2.6)
-- 
cgit v1.2.3