toolchain: The glorious return of glibc, ver 2.21
[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 PKG_SOURCE_URL:=$(LINUX_SITE)
21 HOST_BUILD_DIR:=$(KERNEL_BUILD_DIR)/linux-$(LINUX_VERSION)
22 PKG_MD5SUM:=$(LINUX_KERNEL_MD5SUM)
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         HOSTCFLAGS="$(HOST_CFLAGS) -Wall -Wmissing-prototypes -Wstrict-prototypes" \
40         ARCH=$(LINUX_KARCH) \
41         CC="$(KERNEL_CC)" \
42         CFLAGS="$(TARGET_CFLAGS)" \
43         CROSS_COMPILE=$(TARGET_CROSS) \
44         KBUILD_HAVE_NLS=no \
45         CONFIG_SHELL=$(BASH)
46
47 define Host/Configure/all
48         mkdir -p $(BUILD_DIR_TOOLCHAIN)/linux-dev
49         $(KMAKE) \
50                 INSTALL_HDR_PATH="$(BUILD_DIR_TOOLCHAIN)/linux-dev/" \
51                 headers_install
52 endef
53
54 # XXX: the following is needed to build lzma-loader
55 ifneq ($(CONFIG_mips)$(CONFIG_mipsel),)
56   define Host/Configure/lzma
57         $(CP) \
58                 $(HOST_BUILD_DIR)/arch/mips/include/asm/asm.h \
59                 $(HOST_BUILD_DIR)/arch/mips/include/asm/regdef.h \
60                 $(if $(call kernel_patchver_ge,3.15.0),$(HOST_BUILD_DIR)/arch/mips/include/asm/asm-eva.h) \
61                 $(BUILD_DIR_TOOLCHAIN)/linux-dev/include/asm/
62   endef
63 endif
64
65 define Host/Configure/post/cris
66         $(CP) \
67                 $(HOST_BUILD_DIR)/include/linux/user.h \
68                 $(BUILD_DIR_TOOLCHAIN)/linux-dev/include/linux/
69         ln -snf $(BUILD_DIR_TOOLCHAIN)/linux-dev/include/arch-v10/arch \
70                 $(BUILD_DIR_TOOLCHAIN)/linux-dev/include/arch
71         $(SED) '/#include <asm\/page\.h>/d' $(BUILD_DIR_TOOLCHAIN)/linux-dev/include/asm/user.h
72 endef
73
74 define Host/Configure/post/mips
75         $(call Host/Configure/lzma)
76 endef
77
78 define Host/Configure/post/mipsel
79         $(call Host/Configure/lzma)
80 endef
81
82 define Host/Prepare
83         $(call Kernel/Prepare/Default)
84         ln -sf linux-$(LINUX_VERSION) $(BUILD_DIR_TOOLCHAIN)/linux
85         $(SED) 's/@expr length/@-expr length/' $(HOST_BUILD_DIR)/Makefile
86 endef
87
88 define Host/Configure
89         env
90         yes '' | $(KMAKE) oldconfig
91         $(call Host/Configure/all)
92         $(call Host/Configure/post/$(ARCH))
93 endef
94
95 define Host/Compile
96 endef
97
98 define Host/Install
99         $(CP) $(BUILD_DIR_TOOLCHAIN)/linux-dev/* $(TOOLCHAIN_DIR)/
100 endef
101
102 define Host/Clean
103         rm -rf \
104                 $(HOST_BUILD_DIR) \
105                 $(BUILD_DIR_TOOLCHAIN)/linux \
106                 $(BUILD_DIR_TOOLCHAIN)/linux-dev
107 endef
108
109 $(eval $(call HostBuild))