libgpg-error: fix riscv64
[openadk.git] / mk / kernel-vars.mk
blob475353d6f43c272086c58b928da1ef6f0ea64642
1 # This file is part of the OpenADK project. OpenADK is copyrighted
2 # material, please see the LICENCE file in the top-level directory.
4 KERNEL_MAKE_OPTS:= CC="$(TARGET_CC)"
5 ifeq ($(ADK_TARGET_BINFMT_FDPIC),y)
6 KERNEL_MAKE_OPTS:= CC="$(TARGET_CC) -mno-fdpic"
7 endif
8 ifeq ($(ADK_TARGET_ARCH_MICROBLAZE),y)
9 KERNEL_MAKE_OPTS:= CC="$(TARGET_CC) -fno-tree-loop-distribute-patterns"
10 endif
12 KERNEL_MAKE_OPTS+= V=1 \
13 ARCH="$(ADK_TARGET_KARCH)" \
14 CROSS_COMPILE="$(TARGET_CROSS)" \
15 HOSTCC="${HOST_CC}" \
16 HOSTCXX="${HOST_CXX}" \
17 SHELL='${SHELL}' \
18 CONFIG_SHELL='${SHELL}'
20 # regex for relocs needs pcre
21 ifeq ($(OS_FOR_BUILD),Darwin)
22 KERNEL_MAKE_OPTS+= HOSTLDFLAGS='-lpcreposix -Wl,-no_pie'
23 endif
25 # non-Linux platforms need elf.h
26 ifneq ($(OS_FOR_BUILD),Linux)
27 KERNEL_MAKE_OPTS+= HOSTCFLAGS='$(HOST_CPPFLAGS) ${HOST_CFLAGS}'
28 KERNEL_MAKE_OPTS+= HOST_EXTRACFLAGS='-I${LINUX_DIR}/tools/include -I${LINUX_DIR}/usr/include -I${LINUX_DIR}/security/selinux/include -I${ADK_TOPDIR}/adk/include -I${LINUX_DIR}/scripts/dtc/libfdt -DKBUILD_NO_NLS'
29 else
30 KERNEL_MAKE_OPTS+= HOSTCFLAGS='${HOST_CFLAGS}'
31 endif
33 ifneq ($(ADK_TARGET_KERNEL_LOADADDR),)
34 KERNEL_MAKE_OPTS+= LOADADDR=$(ADK_TARGET_KERNEL_LOADADDR)
35 endif
37 KERNEL_MAKE_ENV:= PATH="${TOOLCHAIN_DIR}/usr/bin:${STAGING_HOST_DIR}/usr/bin:$$PATH"
38 LINUX_BUILD_DIR:= $(BUILD_DIR)/$(ADK_TARGET_OS)-$(ADK_TARGET_ARCH)
40 # wrapper to simplify calling make in kernel tree
41 KERNEL_MAKE:= env $(KERNEL_MAKE_ENV) $(MAKE) -C "${LINUX_DIR}" $(KERNEL_MAKE_OPTS) -j${ADK_MAKE_JOBS}