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