source: trunk/toolchain/kernel-headers/Makefile @ 21842

Last change on this file since 21842 was 21842, checked in by mirko, 6 years ago

[toolchain/kernel-headers] make sure directory exists before copying into

  • Property svn:eol-style set to native
File size: 3.7 KB
Line 
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#
7include $(TOPDIR)/rules.mk
8
9KERNEL_BUILD_DIR := $(BUILD_DIR_TOOLCHAIN)
10BUILD_DIR := $(KERNEL_BUILD_DIR)
11
12override QUILT:=
13override HOST_QUILT:=
14
15include $(INCLUDE_DIR)/kernel.mk
16
17PKG_NAME:=linux
18PKG_VERSION:=$(LINUX_VERSION)
19PKG_SOURCE:=$(LINUX_SOURCE)
20PKG_SOURCE_URL:=$(LINUX_SITE)
21HOST_BUILD_DIR:=$(KERNEL_BUILD_DIR)/linux-$(LINUX_VERSION)
22PKG_MD5SUM:=$(LINUX_KERNEL_MD5SUM)
23LINUX_DIR := $(HOST_BUILD_DIR)
24FILES_DIR := 
25PATCH_DIR := ./patches$(if $(wildcard ./patches-$(KERNEL_PATCHVER)),-$(KERNEL_PATCHVER))
26
27include $(INCLUDE_DIR)/toolchain-build.mk
28include $(INCLUDE_DIR)/kernel-defaults.mk
29
30ifeq ($(strip $(BOARD)),uml)
31  LINUX_KARCH:=$(subst x86_64,x86,$(subst i386,x86,$(ARCH)))
32endif
33
34ifeq ($(strip $(call CompareKernelPatchVer,$(KERNEL_PATCHVER),ge,2.6.18)),1)
35  LINUX_HAS_HEADERS_INSTALL:=y
36endif
37
38KMAKE := $(MAKE) -C $(HOST_BUILD_DIR) \
39        ARCH=$(LINUX_KARCH) \
40        CC="$(KERNEL_CC)" \
41        CFLAGS="$(TARGET_CFLAGS)" \
42        CROSS_COMPILE=$(TARGET_CROSS) \
43        KBUILD_HAVE_NLS=no \
44        CONFIG_SHELL=$(BASH)
45
46ifneq ($(LINUX_HAS_HEADERS_INSTALL),)
47  define Host/Prepare/all
48        mkdir -p $(BUILD_DIR_TOOLCHAIN)/linux-dev/usr
49        $(KMAKE) \
50                INSTALL_HDR_PATH="$(BUILD_DIR_TOOLCHAIN)/linux-dev/usr/" \
51                headers_install
52        if [ -d $(HOST_BUILD_DIR)/arch/$(LINUX_KARCH)/include/asm ]; then \
53                mkdir -p $(HOST_BUILD_DIR)/include/asm-$(LINUX_KARCH)
54                $(CP) \
55                        $(HOST_BUILD_DIR)/arch/$(LINUX_KARCH)/include/asm/. \
56                        $(HOST_BUILD_DIR)/include/asm-$(LINUX_KARCH)/; \
57        fi
58  endef
59else
60  define Host/Prepare/all
61        $(KMAKE) include/linux/version.h include/asm
62        mkdir -p $(BUILD_DIR_TOOLCHAIN)/linux-dev/usr/include
63        cp -pLR $(HOST_BUILD_DIR)/include/asm $(BUILD_DIR_TOOLCHAIN)/linux-dev/usr/include/
64        cp -pLR $(HOST_BUILD_DIR)/include/asm-generic $(BUILD_DIR_TOOLCHAIN)/linux-dev/usr/include/
65        cp -pLR $(HOST_BUILD_DIR)/include/asm-$(LINUX_KARCH) $(BUILD_DIR_TOOLCHAIN)/linux-dev/usr/include/
66        cp -pLR $(HOST_BUILD_DIR)/include/linux $(BUILD_DIR_TOOLCHAIN)/linux-dev/usr/include/
67  endef
68endif
69
70# XXX: the following is needed to build lzma-loader
71define Host/Prepare/lzma
72        $(CP) \
73                $(HOST_BUILD_DIR)/include/asm-mips/asm.h \
74                $(HOST_BUILD_DIR)/include/asm-mips/regdef.h \
75                $(BUILD_DIR_TOOLCHAIN)/linux-dev/usr/include/asm/
76endef
77
78define Host/Prepare/post/cris
79        $(CP) \
80                $(HOST_BUILD_DIR)/include/linux/user.h \
81                $(BUILD_DIR_TOOLCHAIN)/linux-dev/usr/include/linux/
82        ln -snf $(BUILD_DIR_TOOLCHAIN)/linux-dev/usr/include/arch-v10/arch \
83                $(BUILD_DIR_TOOLCHAIN)/linux-dev/usr/include/arch
84        $(SED) '/#include <asm\/page\.h>/d' $(BUILD_DIR_TOOLCHAIN)/linux-dev/usr/include/asm/user.h
85endef
86
87define Host/Prepare/post/ubicom32
88        $(CP) \
89                $(HOST_BUILD_DIR)/arch/ubicom32/include/asm/elf.h \
90                $(HOST_BUILD_DIR)/arch/ubicom32/include/asm/user.h \
91                $(HOST_BUILD_DIR)/arch/ubicom32/include/asm/page.h \
92                $(HOST_BUILD_DIR)/arch/ubicom32/include/asm/page_offset.h \
93                $(BUILD_DIR_TOOLCHAIN)/linux-dev/usr/include/asm/
94endef
95
96define Host/Prepare/post/mips
97        $(call Host/Prepare/lzma)
98endef
99
100define Host/Prepare/post/mipsel
101        $(call Host/Prepare/lzma)
102endef
103
104define Host/Prepare
105        $(call Kernel/Prepare/Default)
106        ln -sf linux-$(LINUX_VERSION) $(BUILD_DIR_TOOLCHAIN)/linux
107        $(SED) 's/@expr length/@-expr length/' $(HOST_BUILD_DIR)/Makefile
108        yes '' | $(KMAKE) oldconfig
109        $(call Host/Prepare/all)
110        $(call Host/Prepare/post/$(ARCH))
111endef
112
113define Host/Configure
114endef
115
116define Host/Compile
117endef
118
119define Host/Install
120        $(CP) $(BUILD_DIR_TOOLCHAIN)/linux-dev/* $(TOOLCHAIN_DIR)/
121endef
122
123define Host/Clean
124        rm -rf \
125                $(HOST_BUILD_DIR) \
126                $(BUILD_DIR_TOOLCHAIN)/linux \
127                $(BUILD_DIR_TOOLCHAIN)/linux-dev
128endef
129
130$(eval $(call HostBuild))
Note: See TracBrowser for help on using the repository browser.