musl: call a_crash() inside __stack_chk_fail_local instead of calling __stack_chk_fail
[openwrt/staging/chunkeey.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/mips
66 $(call Host/Configure/lzma)
67 endef
68
69 define Host/Configure/post/mipsel
70 $(call Host/Configure/lzma)
71 endef
72
73 define Host/Prepare
74 $(call Kernel/Prepare/Default)
75 ln -sf linux-$(LINUX_VERSION) $(BUILD_DIR_TOOLCHAIN)/linux
76 $(SED) 's/@expr length/@-expr length/' $(HOST_BUILD_DIR)/Makefile
77 endef
78
79 define Host/Configure
80 env
81 yes '' | $(KMAKE) oldconfig
82 $(call Host/Configure/all)
83 $(call Host/Configure/post/$(ARCH))
84 endef
85
86 define Host/Compile
87 endef
88
89 define Host/Install
90 $(CP) $(BUILD_DIR_TOOLCHAIN)/linux-dev/* $(TOOLCHAIN_DIR)/
91 endef
92
93 define Host/Clean
94 rm -rf \
95 $(HOST_BUILD_DIR) \
96 $(BUILD_DIR_TOOLCHAIN)/linux \
97 $(BUILD_DIR_TOOLCHAIN)/linux-dev
98 endef
99
100 $(eval $(call HostBuild))