aboutsummaryrefslogtreecommitdiffstats
path: root/include/kernel.mk
diff options
context:
space:
mode:
authorFelix Fietkau <nbd@nbd.name>2017-03-16 09:53:30 +0100
committerFelix Fietkau <nbd@nbd.name>2017-06-07 18:31:10 +0200
commit0aed054becb2143952bfb77cb64e23c83ce79dfd (patch)
tree44c15a3fd584809e0aba379b1734ff0a425613b6 /include/kernel.mk
parent00639586fd7892de41fa786bb48aaec4ed4b6e6a (diff)
downloadupstream-0aed054becb2143952bfb77cb64e23c83ce79dfd.tar.gz
upstream-0aed054becb2143952bfb77cb64e23c83ce79dfd.tar.bz2
upstream-0aed054becb2143952bfb77cb64e23c83ce79dfd.zip
build: add KERNEL_MAKE and KERNEL_MAKE_FLAGS variables and move to kernel.mk
This allows packages to use kernel make options without the forced -C $(LINUX_DIR). It also makes it more clear that it to be called from kernel module packages directly. Signed-off-by: Felix Fietkau <nbd@nbd.name>
Diffstat (limited to 'include/kernel.mk')
-rw-r--r--include/kernel.mk29
1 files changed, 29 insertions, 0 deletions
diff --git a/include/kernel.mk b/include/kernel.mk
index 9c01d5f2c8..effece2869 100644
--- a/include/kernel.mk
+++ b/include/kernel.mk
@@ -87,6 +87,35 @@ else
LINUX_KARCH := $(ARCH)
endif
+KERNEL_MAKE = $(MAKE) $(KERNEL_MAKEOPTS)
+
+KERNEL_MAKE_FLAGS := \
+ HOSTCFLAGS="$(HOST_CFLAGS) -Wall -Wmissing-prototypes -Wstrict-prototypes" \
+ CROSS_COMPILE="$(KERNEL_CROSS)" \
+ ARCH="$(LINUX_KARCH)" \
+ KBUILD_HAVE_NLS=no \
+ KBUILD_BUILD_USER="$(call qstrip,$(CONFIG_KERNEL_BUILD_USER))" \
+ KBUILD_BUILD_HOST="$(call qstrip,$(CONFIG_KERNEL_BUILD_DOMAIN))" \
+ KBUILD_BUILD_TIMESTAMP="$(KBUILD_BUILD_TIMESTAMP)" \
+ KBUILD_BUILD_VERSION="0" \
+ HOST_LOADLIBES="-L$(STAGING_DIR_HOST)/lib" \
+ CONFIG_SHELL="$(BASH)" \
+ $(if $(findstring c,$(OPENWRT_VERBOSE)),V=1,V='') \
+ $(if $(PKG_BUILD_ID),LDFLAGS_MODULE=--build-id=0x$(PKG_BUILD_ID)) \
+ KERNELRELEASE=$(LINUX_VERSION) \
+ cmd_syscalls=
+
+ifeq ($(call qstrip,$(CONFIG_EXTERNAL_KERNEL_TREE))$(call qstrip,$(CONFIG_KERNEL_GIT_CLONE_URI)),)
+ KERNEL_MAKEOPTS += \
+ KERNELRELEASE=$(LINUX_VERSION)
+endif
+
+KERNEL_MAKEOPTS := -C $(LINUX_DIR) $(KERNEL_MAKE_FLAGS)
+
+ifdef CONFIG_USE_SPARSE
+ KERNEL_MAKEOPTS += C=1 CHECK=$(STAGING_DIR_HOST)/bin/sparse
+endif
+
define KernelPackage/Defaults
FILES:=
AUTOLOAD:=