build system cleanup/restructuring as described in http://lists.openwrt.org/pipermail...
[openwrt/staging/chunkeey.git] / toolchain / kernel-headers / Makefile
1 #
2 # Copyright (C) 2006 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 $(TOPDIR)/rules.mk
8
9 PKG_NAME:=linux
10 PKG_VERSION:=$(LINUX_VERSION)
11 PKG_SOURCE:=$(LINUX_SOURCE)
12 PKG_SOURCE_URL:=$(LINUX_SITE)
13
14 KERNEL_BUILD_DIR := $(BUILD_DIR_TOOLCHAIN)
15 PKG_BUILD_DIR := $(KERNEL_BUILD_DIR)/linux-$(LINUX_VERSION)
16 LINUX_DIR := $(PKG_BUILD_DIR)
17 BUILD_DIR := $(KERNEL_BUILD_DIR)
18
19 STAGING_DIR_HOST:=$(TOOLCHAIN_DIR)
20 BUILD_DIR_HOST:=$(BUILD_DIR_TOOLCHAIN)
21 override QUILT:=
22
23 include $(INCLUDE_DIR)/kernel.mk
24 include $(INCLUDE_DIR)/host-build.mk
25 include $(INCLUDE_DIR)/kernel-defaults.mk
26
27 define Build/Prepare/cris
28 mkdir -p $(BUILD_DIR_TOOLCHAIN)
29 bzcat $(DL_DIR)/$(PKG_SOURCE) | $(HOST_TAR) -C $(TOOLCHAIN_BUILD_DIR) $(TAR_OPTIONS)
30 $(PATCH) $(PKG_BUILD_DIR) $(TOPDIR)/target/linux/etrax-2.6/patches/generic_2.6
31 $(PATCH) $(PKG_BUILD_DIR) $(TOPDIR)/target/linux/etrax-2.6/patches/cris
32 ln -sf arch-v10 $(PKG_BUILD_DIR)/include/asm-cris/arch
33 ln -sf arch-v10 $(PKG_BUILD_DIR)/arch/cris/arch
34 endef
35
36 define Build/Configure/powerpc
37 $(CP) $(PKG_BUILD_DIR)/include/asm-ppc/* $(PKG_BUILD_DIR)/include/asm-powerpc/
38 rm -rf $(PKG_BUILD_DIR)/include/asm-ppc
39 mv $(PKG_BUILD_DIR)/include/asm-powerpc $(PKG_BUILD_DIR)/include/asm-ppc
40 endef
41
42 ifneq (,$(findstring uml,$(BOARD)))
43 LINUX_KARCH:=$(ARCH)
44 endif
45
46 KMAKE := $(MAKE) -C $(PKG_BUILD_DIR) \
47 ARCH=$(LINUX_KARCH) \
48 CONFIG_SHELL=$(BASH)
49
50 define Build/Prepare
51 $(if $(Build/Prepare/$(ARCH)),$(Build/Prepare/$(ARCH)),$(call Kernel/Prepare/Default))
52 $(SED) 's/@expr length/@-expr length/' $(PKG_BUILD_DIR)/Makefile
53 ln -sf linux-$(LINUX_VERSION) $(LINUX_HEADERS_DIR)
54 yes '' | $(KMAKE) oldconfig
55 $(KMAKE) include/linux/version.h include/asm
56 $(call Build/Configure/$(ARCH))
57 endef
58
59 define Build/Configure
60 endef
61
62 define Build/Compile
63 endef
64
65 define Build/Install
66 endef
67
68 $(eval $(call HostBuild))