Makefile 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  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. _IN_CVTC= 1
  4. include $(TOPDIR)/rules.mk
  5. include ../rules.mk
  6. include Makefile.inc
  7. include ${TOPDIR}/mk/buildhlp.mk
  8. TARGET_CFLAGS:=$(filter-out -flto,$(TARGET_CFLAGS))
  9. ifeq (${ADK_MAKE_PARALLEL},y)
  10. UCLIBC_MAKEOPTS+= -j${ADK_MAKE_JOBS}
  11. endif
  12. UCLIBCCFG=uclibc.config
  13. ifeq ($(ADK_TARGET_ENDIAN),little)
  14. UCLIBCCFG=uclibc.config.little
  15. endif
  16. ifeq ($(ADK_TARGET_ENDIAN),big)
  17. UCLIBCCFG=uclibc.config.big
  18. endif
  19. ifeq ($(ADK_TARGET_SYSTEM_QEMU_CRIS),y)
  20. UCLIBCCFG=uclibc.config.v32
  21. endif
  22. $(WRKBUILD)/.headers:
  23. $(SED) 's,^CROSS=.*,CROSS=$(TARGET_CROSS),g' $(WRKBUILD)/Rules.mak
  24. sed -e 's^KERNEL_HEADERS.*$$KERNEL_HEADERS=\"${STAGING_TARGET_DIR}/usr/include\"' \
  25. $(TOPDIR)/target/$(ADK_TARGET_ARCH)/$(UCLIBCCFG) >${WRKBUILD}/.config
  26. ifneq ($(ADK_DEBUG),)
  27. $(SED) 's,DOSTRIP,DODEBUG,' ${WRKBUILD}/.config
  28. endif
  29. ifeq ($(ADK_TOOLCHAIN_GCC_USE_SSP),y)
  30. $(SED) 's,.*UCLIBC_HAS_SSP,UCLIBC_HAS_SSP=y,' ${WRKBUILD}/.config
  31. echo "UCLIBC_HAS_SSP_COMPAT=n" >> ${WRKBUILD}/.config
  32. echo "SSP_QUICK_CANARY=n" >> ${WRKBUILD}/.config
  33. echo "UCLIBC_BUILD_SSP=y" >> ${WRKBUILD}/.config
  34. endif
  35. echo N|$(MAKE) ${UCLIBC_MAKEOPTS} -C $(WRKBUILD) \
  36. PREFIX=$(STAGING_TARGET_DIR) \
  37. DEVEL_PREFIX=/usr/ \
  38. RUNTIME_PREFIX=$(STAGING_TARGET_DIR) \
  39. HOSTCC="$(CC_FOR_BUILD)" \
  40. CPU_CFLAGS="$(TARGET_CFLAGS)" \
  41. oldconfig
  42. $(MAKE) ${UCLIBC_MAKEOPTS} -C $(WRKBUILD) \
  43. PREFIX=$(STAGING_TARGET_DIR) \
  44. DEVEL_PREFIX=/usr/ \
  45. RUNTIME_PREFIX=$(STAGING_TARGET_DIR) \
  46. HOSTCC="$(CC_FOR_BUILD)" \
  47. CPU_CFLAGS="$(TARGET_CFLAGS)" \
  48. install_headers
  49. touch $(WRKBUILD)/.configured
  50. touch $@
  51. $(WRKBUILD)/.compiled:
  52. $(MAKE) ${UCLIBC_MAKEOPTS} -C $(WRKBUILD) \
  53. PREFIX= \
  54. DEVEL_PREFIX=/ \
  55. RUNTIME_PREFIX=/ \
  56. HOSTCC="$(CC_FOR_BUILD)" \
  57. CPU_CFLAGS="$(TARGET_CFLAGS)" \
  58. all
  59. touch $@
  60. $(WRKBUILD)/.install_headers: $(WRKBUILD)/.compiled
  61. $(MAKE) -C $(WRKBUILD) \
  62. PREFIX=$(STAGING_TARGET_DIR) \
  63. DEVEL_PREFIX=/usr/ \
  64. DEVEL_PREFIX_LIB=/ \
  65. RUNTIME_PREFIX=/ \
  66. CPU_CFLAGS="$(TARGET_CFLAGS)" \
  67. install_dev
  68. touch $@
  69. $(WRKBUILD)/.installed: $(WRKBUILD)/.install_headers
  70. $(MAKE) -C $(WRKBUILD) \
  71. PREFIX=$(STAGING_TARGET_DIR) \
  72. DEVEL_PREFIX=/usr/ \
  73. DEVEL_PREFIX_LIB=/ \
  74. RUNTIME_PREFIX=/ \
  75. CPU_CFLAGS="$(TARGET_CFLAGS)" \
  76. install_runtime
  77. rm -rf $(STAGING_TARGET_DIR)/lib/libc.so
  78. ln -s libc.so.0 $(STAGING_TARGET_DIR)/lib/libc.so
  79. touch $@
  80. include ${TOPDIR}/mk/toolchain.mk