enable eabi support by default
[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
25 include $(INCLUDE_DIR)/toolchain-build.mk
26 include $(INCLUDE_DIR)/kernel-defaults.mk
27
28 ifeq ($(strip $(BOARD)),uml)
29 LINUX_KARCH:=$(ARCH)
30 endif
31
32 ifeq ($(strip $(call CompareKernelPatchVer,$(KERNEL_PATCHVER),ge,2.6.18)),1)
33 LINUX_HAS_HEADERS_INSTALL:=y
34 endif
35
36 KMAKE := $(MAKE) -C $(HOST_BUILD_DIR) \
37 ARCH=$(LINUX_KARCH) \
38 KBUILD_HAVE_NLS=no \
39 CONFIG_SHELL=$(BASH)
40
41 define Host/Prepare/pre/cris
42 ln -sf $(HOST_BUILD_DIR)/include/asm-cris/arch-v10 $(HOST_BUILD_DIR)/include/asm-cris/arch
43 ln -sf $(HOST_BUILD_DIR)/include/asm-cris/arch-v10 $(HOST_BUILD_DIR)/arch/cris/arch
44 endef
45
46 define Host/Prepare/pre/powerpc
47 if [ -d $(HOST_BUILD_DIR)/include/asm-ppc ]; then \
48 mkdir -p $(PKG_BUILD_DIR)/include/asm-powerpc/; \
49 $(CP) $(HOST_BUILD_DIR)/include/asm-ppc/* $(HOST_BUILD_DIR)/include/asm-powerpc/; \
50 rm -rf $(HOST_BUILD_DIR)/include/asm-ppc; \
51 ln -s $(HOST_BUILD_DIR)/include/asm-powerpc $(HOST_BUILD_DIR)/include/asm-ppc; \
52 fi
53 endef
54
55 ifneq ($(LINUX_HAS_HEADERS_INSTALL),)
56 define Host/Prepare/all
57 mkdir -p $(BUILD_DIR_TOOLCHAIN)/linux-dev/usr
58 $(KMAKE) \
59 CROSS_COMPILE=$(TARGET_CROSS) \
60 INSTALL_HDR_PATH="$(BUILD_DIR_TOOLCHAIN)/linux-dev/usr/" \
61 headers_install
62 endef
63 else
64 define Host/Prepare/all
65 mkdir -p $(BUILD_DIR_TOOLCHAIN)/linux-dev/usr/include
66 cp -pLR $(HOST_BUILD_DIR)/include/asm $(BUILD_DIR_TOOLCHAIN)/linux-dev/usr/include/
67 cp -pLR $(HOST_BUILD_DIR)/include/asm-generic $(BUILD_DIR_TOOLCHAIN)/linux-dev/usr/include/
68 cp -pLR $(HOST_BUILD_DIR)/include/asm-$(LINUX_KARCH) $(BUILD_DIR_TOOLCHAIN)/linux-dev/usr/include/
69 cp -pLR $(HOST_BUILD_DIR)/include/linux $(BUILD_DIR_TOOLCHAIN)/linux-dev/usr/include/
70 endef
71 endif
72
73 # XXX: the following is needed to build lzma-loader
74 define Host/Prepare/lzma
75 $(CP) \
76 $(HOST_BUILD_DIR)/include/asm-mips/asm.h \
77 $(HOST_BUILD_DIR)/include/asm-mips/regdef.h \
78 $(BUILD_DIR_TOOLCHAIN)/linux-dev/usr/include/asm/
79 endef
80
81 # XXX: the following are needed to build a cris toolchain
82 define Host/Prepare/post/cris
83 $(CP) \
84 $(HOST_BUILD_DIR)/include/linux/user.h \
85 $(BUILD_DIR_TOOLCHAIN)/linux-dev/usr/include/linux/
86 $(CP) \
87 $(HOST_BUILD_DIR)/include/asm-cris/elf.h \
88 $(HOST_BUILD_DIR)/include/asm-cris/page.h \
89 $(HOST_BUILD_DIR)/include/asm-cris/user.h \
90 $(BUILD_DIR_TOOLCHAIN)/linux-dev/usr/include/asm/
91 mkdir -p $(BUILD_DIR_TOOLCHAIN)/linux-dev/usr/include/asm/arch
92 $(CP) \
93 $(HOST_BUILD_DIR)/include/asm-cris/arch/elf.h \
94 $(HOST_BUILD_DIR)/include/asm-cris/arch/page.h \
95 $(HOST_BUILD_DIR)/include/asm-cris/arch/ptrace.h \
96 $(HOST_BUILD_DIR)/include/asm-cris/arch/user.h \
97 $(BUILD_DIR_TOOLCHAIN)/linux-dev/usr/include/asm/arch/
98 $(CP) \
99 $(HOST_BUILD_DIR)/include/asm-generic/memory_model.h \
100 $(HOST_BUILD_DIR)/include/asm-generic/page.h \
101 $(BUILD_DIR_TOOLCHAIN)/linux-dev/usr/include/asm-generic/
102 endef
103
104 define Host/Prepare/post/mips
105 $(call Host/Prepare/lzma)
106 endef
107
108 define Host/Prepare/post/mipsel
109 $(call Host/Prepare/lzma)
110 endef
111
112 define Host/Prepare
113 $(call Kernel/Prepare/Default)
114 ln -sf linux-$(LINUX_VERSION) $(BUILD_DIR_TOOLCHAIN)/linux
115 $(SED) 's/@expr length/@-expr length/' $(HOST_BUILD_DIR)/Makefile
116 yes '' | $(KMAKE) oldconfig
117 $(KMAKE) include/linux/version.h include/asm
118 if [ -d $(HOST_BUILD_DIR)/arch/$(LINUX_KARCH)/include/asm ]; then \
119 $(CP) \
120 $(HOST_BUILD_DIR)/arch/$(LINUX_KARCH)/include/asm/. \
121 $(HOST_BUILD_DIR)/include/asm-$(LINUX_KARCH)/; \
122 fi
123 $(call Host/Prepare/pre/$(ARCH))
124 $(call Host/Prepare/all)
125 $(call Host/Prepare/post/$(ARCH))
126 endef
127
128 define Host/Configure
129 endef
130
131 define Host/Compile
132 endef
133
134 define Host/Install
135 $(CP) $(BUILD_DIR_TOOLCHAIN)/linux-dev/* $(TOOLCHAIN_DIR)/
136 endef
137
138 define Host/Clean
139 rm -rf \
140 $(HOST_BUILD_DIR) \
141 $(BUILD_DIR_TOOLCHAIN)/linux \
142 $(BUILD_DIR_TOOLCHAIN)/linux-dev
143 endef
144
145 $(eval $(call HostBuild))
This page took 0.047453 seconds and 5 git commands to generate.