rework parallel building to get rid of some warnings
[openwrt/svn-archive/archive.git] / include / kernel-build.mk
1 #
2 # Copyright (C) 2006-2007 OpenWrt.org
3 #
4 # This is free software, licensed under the GNU General Public License v2.
5 # See /LICENSE for more information.
6 #
7 include $(INCLUDE_DIR)/host.mk
8 include $(INCLUDE_DIR)/prereq.mk
9
10 ifneq ($(DUMP),1)
11 all: compile
12 endif
13
14 STAMP_PREPARED:=$(LINUX_DIR)/.prepared
15 STAMP_CONFIGURED:=$(LINUX_DIR)/.configured
16 include $(INCLUDE_DIR)/download.mk
17 include $(INCLUDE_DIR)/quilt.mk
18 include $(INCLUDE_DIR)/kernel-defaults.mk
19
20 define Kernel/Prepare
21 $(call Kernel/Prepare/Default)
22 endef
23
24 define Kernel/Configure
25 $(call Kernel/Configure/Default)
26 endef
27
28 define Kernel/CompileModules
29 $(call Kernel/CompileModules/Default)
30 endef
31
32 define Kernel/CompileImage
33 $(call Kernel/CompileImage/Default)
34 endef
35
36 define Kernel/Clean
37 $(call Kernel/Clean/Default)
38 endef
39
40 define Download/kernel
41 URL:=$(LINUX_SITE)
42 FILE:=$(LINUX_SOURCE)
43 MD5SUM:=$(LINUX_KERNEL_MD5SUM)
44 endef
45
46 define BuildKernel
47 $(if $(QUILT),$(Build/Quilt))
48 $(if $(LINUX_SITE),$(call Download,kernel))
49
50 $(STAMP_PREPARED): $(DL_DIR)/$(LINUX_SOURCE)
51 -rm -rf $(KERNEL_BUILD_DIR)
52 -mkdir -p $(KERNEL_BUILD_DIR)
53 $(Kernel/Prepare)
54 touch $$@
55
56 $(STAMP_CONFIGURED): $(STAMP_PREPARED) $(LINUX_CONFIG) $(GENERIC_LINUX_CONFIG) $(TOPDIR)/.config
57 $(Kernel/Configure)
58 touch $$@
59
60 $(LINUX_DIR)/.modules: $(STAMP_CONFIGURED) $(LINUX_DIR)/.config FORCE
61 $(Kernel/CompileModules)
62 touch $$@
63
64 $(LINUX_DIR)/.image: $(STAMP_CONFIGURED) FORCE
65 $(Kernel/CompileImage)
66 touch $$@
67
68 mostlyclean: FORCE
69 $(Kernel/Clean)
70
71 define BuildKernel
72 endef
73
74 download: $(DL_DIR)/$(LINUX_SOURCE)
75 prepare: $(STAMP_CONFIGURED)
76 compile: $(LINUX_DIR)/.modules
77 $(MAKE) -C image compile TARGET_BUILD=
78
79 oldconfig menuconfig: $(STAMP_PREPARED) FORCE
80 [ -e "$(LINUX_CONFIG)" ] || touch "$(LINUX_CONFIG)"
81 $(LINUX_CONFCMD) > $(LINUX_DIR)/.config
82 touch $(LINUX_CONFIG)
83 $(_SINGLE)$(MAKE) -C $(LINUX_DIR) $(KERNEL_MAKEOPTS) $$@
84 $(SCRIPT_DIR)/kconfig.pl '>' $(GENERIC_LINUX_CONFIG) $(LINUX_DIR)/.config > $(LINUX_CONFIG)
85 $(Kernel/Configure)
86
87 install: $(LINUX_DIR)/.image
88 +$(MAKE) -C image compile install TARGET_BUILD=
89
90 clean: FORCE
91 rm -rf $(KERNEL_BUILD_DIR)
92
93 image-prereq:
94 @+$(NO_TRACE_MAKE) -s -C image prereq TARGET_BUILD=
95
96 prereq: image-prereq
97
98 endef