package/apex: fix a compile issue
[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 FILES_DIR :=
25 PATCH_DIR := ./patches$(if $(wildcard ./patches-$(KERNEL_PATCHVER)),-$(KERNEL_PATCHVER))
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 LINUX_HAS_HEADERS_INSTALL:=y
35
36 KMAKE := $(MAKE) -C $(HOST_BUILD_DIR) \
37 ARCH=$(LINUX_KARCH) \
38 CC="$(KERNEL_CC)" \
39 CFLAGS="$(TARGET_CFLAGS)" \
40 CROSS_COMPILE=$(TARGET_CROSS) \
41 KBUILD_HAVE_NLS=no \
42 CONFIG_SHELL=$(BASH)
43
44 define Host/Prepare/all
45 mkdir -p $(BUILD_DIR_TOOLCHAIN)/linux-dev
46 $(KMAKE) \
47 INSTALL_HDR_PATH="$(BUILD_DIR_TOOLCHAIN)/linux-dev/" \
48 headers_install
49 if [ -d $(HOST_BUILD_DIR)/arch/$(LINUX_KARCH)/include/asm ]; then \
50 mkdir -p $(HOST_BUILD_DIR)/include/asm-$(LINUX_KARCH); \
51 $(CP) \
52 $(HOST_BUILD_DIR)/arch/$(LINUX_KARCH)/include/asm/. \
53 $(HOST_BUILD_DIR)/include/asm-$(LINUX_KARCH)/; \
54 fi
55 endef
56
57 # XXX: the following is needed to build lzma-loader
58 define Host/Prepare/lzma
59 $(CP) \
60 $(HOST_BUILD_DIR)/include/asm-mips/asm.h \
61 $(HOST_BUILD_DIR)/include/asm-mips/regdef.h \
62 $(BUILD_DIR_TOOLCHAIN)/linux-dev/include/asm/
63 endef
64
65 define Host/Prepare/post/cris
66 $(CP) \
67 $(HOST_BUILD_DIR)/include/linux/user.h \
68 $(BUILD_DIR_TOOLCHAIN)/linux-dev/include/linux/
69 ln -snf $(BUILD_DIR_TOOLCHAIN)/linux-dev/include/arch-v10/arch \
70 $(BUILD_DIR_TOOLCHAIN)/linux-dev/include/arch
71 $(SED) '/#include <asm\/page\.h>/d' $(BUILD_DIR_TOOLCHAIN)/linux-dev/include/asm/user.h
72 endef
73
74 define Host/Prepare/post/ubicom32
75 $(CP) \
76 $(HOST_BUILD_DIR)/arch/ubicom32/include/asm/elf.h \
77 $(HOST_BUILD_DIR)/arch/ubicom32/include/asm/user.h \
78 $(HOST_BUILD_DIR)/arch/ubicom32/include/asm/page.h \
79 $(HOST_BUILD_DIR)/arch/ubicom32/include/asm/page_offset.h \
80 $(BUILD_DIR_TOOLCHAIN)/linux-dev/include/asm/
81 endef
82
83 define Host/Prepare/post/mips
84 $(call Host/Prepare/lzma)
85 endef
86
87 define Host/Prepare/post/mipsel
88 $(call Host/Prepare/lzma)
89 endef
90
91 define Host/Prepare
92 $(call Kernel/Prepare/Default)
93 ln -sf linux-$(LINUX_VERSION) $(BUILD_DIR_TOOLCHAIN)/linux
94 $(SED) 's/@expr length/@-expr length/' $(HOST_BUILD_DIR)/Makefile
95 yes '' | $(KMAKE) oldconfig
96 $(call Host/Prepare/all)
97 $(call Host/Prepare/post/$(ARCH))
98 endef
99
100 define Host/Configure
101 endef
102
103 define Host/Compile
104 endef
105
106 define Host/Install
107 $(CP) $(BUILD_DIR_TOOLCHAIN)/linux-dev/* $(TOOLCHAIN_DIR)/
108 endef
109
110 define Host/Clean
111 rm -rf \
112 $(HOST_BUILD_DIR) \
113 $(BUILD_DIR_TOOLCHAIN)/linux \
114 $(BUILD_DIR_TOOLCHAIN)/linux-dev
115 endef
116
117 $(eval $(call HostBuild))
This page took 0.043833 seconds and 5 git commands to generate.