kernel-vars.mk 1.4 KB

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