kernel-vars.mk 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. # This file is part of the OpenADK project. OpenADK is copyrighted
  2. # material, please see the LICENCE file in the top-level directory.
  3. KERNEL_MAKE_OPTS:= V=1 \
  4. ARCH="$(ADK_TARGET_KARCH)" \
  5. CROSS_COMPILE="$(TARGET_CROSS)" \
  6. HOSTCC="${HOST_CC}" \
  7. HOSTCXX="${HOST_CXX}" \
  8. SHELL='${SHELL}' \
  9. CONFIG_SHELL='${SHELL}'
  10. ifeq ($(ADK_TARGET_BINFMT_FDPIC),y)
  11. KERNEL_MAKE_OPTS+= CC="$(TARGET_CC) -mno-fdpic"
  12. else
  13. KERNEL_MAKE_OPTS+= CC="$(TARGET_CC) -fno-tree-loop-distribute-patterns"
  14. endif
  15. # regex for relocs needs pcre
  16. ifeq ($(OS_FOR_BUILD),Darwin)
  17. KERNEL_MAKE_OPTS+= HOSTLDFLAGS='-lpcreposix -Wl,-no_pie'
  18. endif
  19. # non-Linux platforms need elf.h
  20. ifneq ($(OS_FOR_BUILD),Linux)
  21. KERNEL_MAKE_OPTS+= HOSTCFLAGS='$(HOST_CPPFLAGS) ${HOST_CFLAGS}'
  22. 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 -DKBUILD_NO_NLS'
  23. else
  24. KERNEL_MAKE_OPTS+= HOSTCFLAGS='${HOST_CFLAGS}'
  25. endif
  26. ifneq ($(ADK_TARGET_KERNEL_LOADADDR),)
  27. KERNEL_MAKE_OPTS+= LOADADDR=$(ADK_TARGET_KERNEL_LOADADDR)
  28. endif
  29. KERNEL_MAKE_ENV:= PATH="${TOOLCHAIN_DIR}/usr/bin:${STAGING_HOST_DIR}/usr/bin:$$PATH"
  30. LINUX_BUILD_DIR:= $(BUILD_DIR)/$(ADK_TARGET_OS)-$(ADK_TARGET_ARCH)
  31. # wrapper to simplify calling make in kernel tree
  32. KERNEL_MAKE:= env $(KERNEL_MAKE_ENV) $(MAKE) -C "${LINUX_DIR}" $(KERNEL_MAKE_OPTS) -j${ADK_MAKE_JOBS}