e374e706e1dae6714da8defd349de3635a0545b2
[openwrt/staging/mkresin.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 PKG_SOURCE_URL:=$(LINUX_SITE)
21 HOST_BUILD_DIR:=$(KERNEL_BUILD_DIR)/linux-$(LINUX_VERSION)
22 PKG_HASH:=$(LINUX_KERNEL_HASH)
23 LINUX_DIR := $(HOST_BUILD_DIR)
24 FILES_DIR :=
25 PATCH_DIR := ./patches$(if $(wildcard ./patches-$(LINUX_VERSION)),-$(LINUX_VERSION))
26
27 include $(INCLUDE_DIR)/toolchain-build.mk
28 include $(INCLUDE_DIR)/kernel-defaults.mk
29
30 ifeq ($(strip $(BOARD)),uml)
31 LINUX_KARCH:=$(subst x86_64,x86,$(subst i386,x86,$(ARCH)))
32 endif
33
34 HOST_EXTRACFLAGS=
35
36 LINUX_HAS_HEADERS_INSTALL:=y
37
38 KMAKE := $(MAKE) -C $(HOST_BUILD_DIR) \
39 $(KERNEL_MAKE_FLAGS) \
40 CC="$(KERNEL_CC)" \
41 CFLAGS="$(TARGET_CFLAGS)"
42
43 define Host/Configure/all
44 mkdir -p $(BUILD_DIR_TOOLCHAIN)/linux-dev
45 $(KMAKE) \
46 INSTALL_HDR_PATH="$(BUILD_DIR_TOOLCHAIN)/linux-dev/" \
47 headers_install
48 endef
49
50 # XXX: the following is needed to build lzma-loader
51 ifneq ($(CONFIG_mips)$(CONFIG_mipsel),)
52 define Host/Configure/lzma
53 $(CP) \
54 $(HOST_BUILD_DIR)/arch/mips/include/asm/asm.h \
55 $(HOST_BUILD_DIR)/arch/mips/include/asm/regdef.h \
56 $(HOST_BUILD_DIR)/arch/mips/include/asm/asm-eva.h \
57 $(BUILD_DIR_TOOLCHAIN)/linux-dev/include/asm/
58 endef
59 endif
60
61 define Host/Configure/post/mips
62 $(call Host/Configure/lzma)
63 endef
64
65 define Host/Configure/post/mipsel
66 $(call Host/Configure/lzma)
67 endef
68
69 define Host/Prepare
70 rm -rf $(BUILD_DIR_TOOLCHAIN)/linux-*
71 $(call Kernel/Prepare/Default)
72 rm -f $(BUILD_DIR_TOOLCHAIN)/linux
73 ln -s linux-$(LINUX_VERSION) $(BUILD_DIR_TOOLCHAIN)/linux
74 $(SED) 's/@expr length/@-expr length/' $(HOST_BUILD_DIR)/Makefile
75 endef
76
77 define Host/Configure
78 env
79 yes '' | $(KMAKE) oldconfig
80 $(call Host/Configure/all)
81 $(call Host/Configure/post/$(ARCH))
82 endef
83
84 define Host/Compile
85 endef
86
87 define Host/Install
88 $(CP) $(BUILD_DIR_TOOLCHAIN)/linux-dev/* $(TOOLCHAIN_DIR)/
89 endef
90
91 define Host/Clean
92 rm -rf \
93 $(HOST_BUILD_DIR) \
94 $(BUILD_DIR_TOOLCHAIN)/linux \
95 $(BUILD_DIR_TOOLCHAIN)/linux-dev
96 endef
97
98 $(eval $(call HostBuild))