Add updated support for buffalo routers (#1874)
[openwrt/openwrt.git] / toolchain / kernel-headers / Makefile
1 #
2 # Copyright (C) 2006 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 include $(INCLUDE_DIR)/kernel.mk
9
10 PKG_NAME=kernel-headers
11 PKG_VERSION=$(LINUX_VERSION)
12
13 PKG_SOURCE=$(LINUX_SOURCE)
14 PKG_SOURCE_URL=$(LINUX_SITE)
15
16 PKG_BUILD_DIR:=$(TOOLCHAIN_BUILD_DIR)/linux-$(PKG_VERSION)
17
18 LINUX_DIR:=$(PKG_BUILD_DIR)
19 KERNEL_BUILD_DIR:=$(TOOLCHAIN_BUILD_DIR)
20 include $(INCLUDE_DIR)/kernel-defaults.mk
21
22 include $(INCLUDE_DIR)/host-build.mk
23
24 define Build/Prepare/cris
25 mkdir -p $(TOOLCHAIN_BUILD_DIR)
26 bzcat $(DL_DIR)/$(PKG_SOURCE) | $(HOST_TAR) -C $(TOOLCHAIN_BUILD_DIR) $(TAR_OPTIONS)
27 $(PATCH) $(PKG_BUILD_DIR) $(TOPDIR)/target/linux/etrax-2.6/patches/generic_2.6
28 $(PATCH) $(PKG_BUILD_DIR) $(TOPDIR)/target/linux/etrax-2.6/patches/cris
29 ln -sf $(PKG_BUILD_DIR)/include/asm-cris/arch-v10 $(PKG_BUILD_DIR)/include/asm-cris/arch
30 ln -sf $(PKG_BUILD_DIR)/arch/cris/arch-v10 $(PKG_BUILD_DIR)/arch/cris/arch
31 $(SED) 's/@expr length/@-expr length/' $(PKG_BUILD_DIR)/Makefile
32 ln -sf $(PKG_BUILD_DIR) $(LINUX_HEADERS_DIR)
33 endef
34
35 ifdef Build/Prepare/$(ARCH)
36 define Build/Prepare
37 $(call Build/Prepare/$(ARCH))
38 endef
39 else
40 define Build/Prepare
41 $(call Kernel/Prepare/Default)
42 $(SED) 's/@expr length/@-expr length/' $(PKG_BUILD_DIR)/Makefile
43 ln -sf $(PKG_BUILD_DIR) $(LINUX_HEADERS_DIR)
44 endef
45 endif
46
47 define Build/Configure/powerpc
48 $(CP) $(PKG_BUILD_DIR)/include/asm-ppc/* $(PKG_BUILD_DIR)/include/asm-powerpc/
49 rm -rf $(PKG_BUILD_DIR)/include/asm-ppc
50 mv $(PKG_BUILD_DIR)/include/asm-powerpc $(PKG_BUILD_DIR)/include/asm-ppc
51 endef
52
53 ifneq (,$(findstring uml,$(BOARD)))
54 LINUX_KARCH:=$(ARCH)
55 endif
56
57 KMAKE := $(MAKE) -C $(PKG_BUILD_DIR) \
58 ARCH=$(LINUX_KARCH) \
59 CONFIG_SHELL=$(BASH)
60
61 define Build/Configure
62 yes '' | $(KMAKE) oldconfig
63 $(KMAKE) include/linux/version.h include/asm
64 $(call Build/Configure/$(ARCH))
65 endef
66
67 define Build/Compile
68 endef
69
70 define Build/Install
71 endef
72
73 $(eval $(call HostBuild))