ramips: Add support for the GnuBee Personal Cloud Two
[openwrt/openwrt.git] / toolchain / kernel-headers / Makefile
1 #
2 # Copyright (C) 2006-2009 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 KERNEL_BUILD_DIR := $(BUILD_DIR_TOOLCHAIN)
10 BUILD_DIR := $(KERNEL_BUILD_DIR)
11
12 override QUILT:=
13 override HOST_QUILT:=
14
15 include $(INCLUDE_DIR)/kernel.mk
16
17 PKG_NAME:=linux
18 PKG_VERSION:=$(LINUX_VERSION)
19 PKG_SOURCE:=$(LINUX_SOURCE)
20 ifneq ($(strip $(CONFIG_KERNEL_GIT_CLONE_URI)),"")
21 PKG_SOURCE_PROTO:=git
22 PKG_SOURCE_URL:=$(call qstrip,$(CONFIG_KERNEL_GIT_CLONE_URI))
23 PKG_SOURCE_VERSION:=$(CONFIG_KERNEL_GIT_REF)
24 else
25 PKG_SOURCE_URL:=$(LINUX_SITE)
26 endif
27 HOST_BUILD_DIR:=$(KERNEL_BUILD_DIR)/linux-$(LINUX_VERSION)
28 PKG_HASH:=$(LINUX_KERNEL_HASH)
29 LINUX_DIR := $(HOST_BUILD_DIR)
30 FILES_DIR :=
31 PATCH_DIR := ./patches$(if $(wildcard ./patches-$(LINUX_VERSION)),-$(LINUX_VERSION))
32
33 include $(INCLUDE_DIR)/toolchain-build.mk
34 include $(INCLUDE_DIR)/kernel-defaults.mk
35
36 ifeq ($(strip $(BOARD)),uml)
37 LINUX_KARCH:=$(subst x86_64,x86,$(subst i386,x86,$(ARCH)))
38 endif
39
40 HOST_EXTRACFLAGS=
41
42 LINUX_HAS_HEADERS_INSTALL:=y
43
44 KMAKE := $(MAKE) -C $(HOST_BUILD_DIR) \
45 $(KERNEL_MAKE_FLAGS) \
46 CC="$(KERNEL_CC)" \
47 CFLAGS="$(TARGET_CFLAGS)"
48
49 define Host/Configure/all
50 mkdir -p $(BUILD_DIR_TOOLCHAIN)/linux-dev
51 $(KMAKE) \
52 INSTALL_HDR_PATH="$(BUILD_DIR_TOOLCHAIN)/linux-dev/" \
53 headers_install
54 endef
55
56 # XXX: the following is needed to build lzma-loader
57 ifneq ($(CONFIG_mips)$(CONFIG_mipsel),)
58 define Host/Configure/lzma
59 $(CP) \
60 $(HOST_BUILD_DIR)/arch/mips/include/asm/asm.h \
61 $(HOST_BUILD_DIR)/arch/mips/include/asm/regdef.h \
62 $(HOST_BUILD_DIR)/arch/mips/include/asm/asm-eva.h \
63 $(BUILD_DIR_TOOLCHAIN)/linux-dev/include/asm/
64 endef
65 endif
66
67 define Host/Configure/post/mips
68 $(call Host/Configure/lzma)
69 endef
70
71 define Host/Configure/post/mipsel
72 $(call Host/Configure/lzma)
73 endef
74
75 define Host/Prepare
76 rm -rf $(BUILD_DIR_TOOLCHAIN)/linux-*
77 $(call Kernel/Prepare/Default)
78 rm -f $(BUILD_DIR_TOOLCHAIN)/linux
79 ln -s linux-$(LINUX_VERSION) $(BUILD_DIR_TOOLCHAIN)/linux
80 $(SED) 's/@expr length/@-expr length/' $(HOST_BUILD_DIR)/Makefile
81 endef
82
83 define Host/Configure
84 env
85 yes '' | $(KMAKE) oldconfig
86 $(call Host/Configure/all)
87 $(call Host/Configure/post/$(ARCH))
88 endef
89
90 define Host/Compile
91 endef
92
93 define Host/Install
94 $(CP) $(BUILD_DIR_TOOLCHAIN)/linux-dev/* $(TOOLCHAIN_DIR)/
95 endef
96
97 define Host/Clean
98 rm -rf \
99 $(HOST_BUILD_DIR) \
100 $(BUILD_DIR_TOOLCHAIN)/linux \
101 $(BUILD_DIR_TOOLCHAIN)/linux-dev
102 endef
103
104 $(eval $(call HostBuild))