[ar71xx] aw-nr580: add support for the LAN ports
[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 $(CP) $(HOST_BUILD_DIR)/include/asm-ppc/* $(HOST_BUILD_DIR)/include/asm-powerpc/; \
49 rm -rf $(HOST_BUILD_DIR)/include/asm-ppc; \
50 ln -s $(HOST_BUILD_DIR)/include/asm-powerpc $(HOST_BUILD_DIR)/include/asm-ppc; \
51 fi
52 endef
53
54 ifneq ($(LINUX_HAS_HEADERS_INSTALL),)
55 define Host/Prepare/all
56 mkdir -p $(BUILD_DIR_TOOLCHAIN)/linux-dev/usr
57 $(KMAKE) \
58 CROSS_COMPILE=$(TARGET_CROSS) \
59 INSTALL_HDR_PATH="$(BUILD_DIR_TOOLCHAIN)/linux-dev/usr/" \
60 headers_install
61 endef
62 else
63 define Host/Prepare/all
64 mkdir -p $(BUILD_DIR_TOOLCHAIN)/linux-dev/usr/include
65 cp -pLR \
66 $(HOST_BUILD_DIR)/include/asm \
67 $(HOST_BUILD_DIR)/include/asm-generic \
68 $(HOST_BUILD_DIR)/include/asm-$(LINUX_KARCH) \
69 $(HOST_BUILD_DIR)/include/linux \
70 $(BUILD_DIR_TOOLCHAIN)/linux-dev/usr/include/
71 endef
72 endif
73
74 # XXX: the following is needed to build lzma-loader
75 define Host/Prepare/lzma
76 $(CP) \
77 $(HOST_BUILD_DIR)/include/asm-mips/asm.h \
78 $(HOST_BUILD_DIR)/include/asm-mips/regdef.h \
79 $(BUILD_DIR_TOOLCHAIN)/linux-dev/usr/include/asm/
80 endef
81
82 # XXX: the following are needed to build a cris toolchain
83 define Host/Prepare/post/cris
84 $(CP) \
85 $(HOST_BUILD_DIR)/include/linux/user.h \
86 $(BUILD_DIR_TOOLCHAIN)/linux-dev/usr/include/linux/
87 $(CP) \
88 $(HOST_BUILD_DIR)/include/asm-cris/elf.h \
89 $(HOST_BUILD_DIR)/include/asm-cris/page.h \
90 $(HOST_BUILD_DIR)/include/asm-cris/user.h \
91 $(BUILD_DIR_TOOLCHAIN)/linux-dev/usr/include/asm/
92 mkdir -p $(BUILD_DIR_TOOLCHAIN)/linux-dev/usr/include/asm/arch
93 $(CP) \
94 $(HOST_BUILD_DIR)/include/asm-cris/arch/elf.h \
95 $(HOST_BUILD_DIR)/include/asm-cris/arch/page.h \
96 $(HOST_BUILD_DIR)/include/asm-cris/arch/ptrace.h \
97 $(HOST_BUILD_DIR)/include/asm-cris/arch/user.h \
98 $(BUILD_DIR_TOOLCHAIN)/linux-dev/usr/include/asm/arch/
99 $(CP) \
100 $(HOST_BUILD_DIR)/include/asm-generic/memory_model.h \
101 $(HOST_BUILD_DIR)/include/asm-generic/page.h \
102 $(BUILD_DIR_TOOLCHAIN)/linux-dev/usr/include/asm-generic/
103 endef
104
105 define Host/Prepare/post/mips
106 $(call Host/Prepare/lzma)
107 endef
108
109 define Host/Prepare/post/mipsel
110 $(call Host/Prepare/lzma)
111 endef
112
113 define Host/Prepare
114 $(call Kernel/Prepare/Default)
115 ln -sf linux-$(LINUX_VERSION) $(BUILD_DIR_TOOLCHAIN)/linux
116 $(SED) 's/@expr length/@-expr length/' $(HOST_BUILD_DIR)/Makefile
117 yes '' | $(KMAKE) oldconfig
118 $(KMAKE) include/linux/version.h include/asm
119 if [ -d $(HOST_BUILD_DIR)/arch/$(LINUX_KARCH)/include/asm ]; then \
120 $(CP) \
121 $(HOST_BUILD_DIR)/arch/$(LINUX_KARCH)/include/asm/. \
122 $(HOST_BUILD_DIR)/include/asm-$(LINUX_KARCH)/; \
123 fi
124 $(call Host/Prepare/pre/$(ARCH))
125 $(call Host/Prepare/all)
126 $(call Host/Prepare/post/$(ARCH))
127 endef
128
129 define Host/Configure
130 endef
131
132 define Host/Compile
133 endef
134
135 define Host/Install
136 $(CP) $(BUILD_DIR_TOOLCHAIN)/linux-dev/* $(TOOLCHAIN_DIR)/
137 endef
138
139 define Host/Clean
140 rm -rf \
141 $(HOST_BUILD_DIR) \
142 $(BUILD_DIR_TOOLCHAIN)/linux \
143 $(BUILD_DIR_TOOLCHAIN)/linux-dev
144 endef
145
146 $(eval $(call HostBuild))
This page took 0.05945 seconds and 5 git commands to generate.