ramips: sound-mt7620: fix dependencies for kernel 4.9
[openwrt/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_HASH:=$(LINUX_KERNEL_HASH)
23 LINUX_DIR := $(HOST_BUILD_DIR)
24 FILES_DIR :=
25 PATCH_DIR := ./patches$(if $(wildcard ./patches-$(LINUX_VERSION)),-$(LINUX_VERSION))
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 HOST_EXTRACFLAGS=
35
36 LINUX_HAS_HEADERS_INSTALL:=y
37
38 KMAKE := $(MAKE) -C $(HOST_BUILD_DIR) \
39 HOSTCFLAGS="$(HOST_CFLAGS) -Wall -Wmissing-prototypes -Wstrict-prototypes" \
40 ARCH=$(LINUX_KARCH) \
41 CC="$(KERNEL_CC)" \
42 CFLAGS="$(TARGET_CFLAGS)" \
43 CROSS_COMPILE=$(TARGET_CROSS) \
44 KBUILD_HAVE_NLS=no \
45 CONFIG_SHELL=$(BASH)
46
47 define Host/Configure/all
48 mkdir -p $(BUILD_DIR_TOOLCHAIN)/linux-dev
49 $(KMAKE) \
50 INSTALL_HDR_PATH="$(BUILD_DIR_TOOLCHAIN)/linux-dev/" \
51 headers_install
52 endef
53
54 # XXX: the following is needed to build lzma-loader
55 ifneq ($(CONFIG_mips)$(CONFIG_mipsel),)
56 define Host/Configure/lzma
57 $(CP) \
58 $(HOST_BUILD_DIR)/arch/mips/include/asm/asm.h \
59 $(HOST_BUILD_DIR)/arch/mips/include/asm/regdef.h \
60 $(HOST_BUILD_DIR)/arch/mips/include/asm/asm-eva.h \
61 $(BUILD_DIR_TOOLCHAIN)/linux-dev/include/asm/
62 endef
63 endif
64
65 define Host/Configure/post/mips
66 $(call Host/Configure/lzma)
67 endef
68
69 define Host/Configure/post/mipsel
70 $(call Host/Configure/lzma)
71 endef
72
73 define Host/Prepare
74 rm -rf $(BUILD_DIR_TOOLCHAIN)/linux-*
75 $(call Kernel/Prepare/Default)
76 rm -f $(BUILD_DIR_TOOLCHAIN)/linux
77 ln -s linux-$(LINUX_VERSION) $(BUILD_DIR_TOOLCHAIN)/linux
78 $(SED) 's/@expr length/@-expr length/' $(HOST_BUILD_DIR)/Makefile
79 endef
80
81 define Host/Configure
82 env
83 yes '' | $(KMAKE) oldconfig
84 $(call Host/Configure/all)
85 $(call Host/Configure/post/$(ARCH))
86 endef
87
88 define Host/Compile
89 endef
90
91 define Host/Install
92 $(CP) $(BUILD_DIR_TOOLCHAIN)/linux-dev/* $(TOOLCHAIN_DIR)/
93 endef
94
95 define Host/Clean
96 rm -rf \
97 $(HOST_BUILD_DIR) \
98 $(BUILD_DIR_TOOLCHAIN)/linux \
99 $(BUILD_DIR_TOOLCHAIN)/linux-dev
100 endef
101
102 $(eval $(call HostBuild))