Makefile 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  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. $(WRKBUILD)/.headers:
  20. $(SED) 's,^CROSS=.*,CROSS=$(TARGET_CROSS),g' $(WRKBUILD)/Rules.mak
  21. sed -e 's^KERNEL_HEADERS.*$$KERNEL_HEADERS=\"${STAGING_TARGET_DIR}/usr/include\"' \
  22. $(TOPDIR)/target/$(ADK_TARGET_ARCH)/$(UCLIBCCFG) >${WRKBUILD}/.config
  23. ifneq ($(ADK_DEBUG),)
  24. $(SED) 's,DOSTRIP,DODEBUG,' ${WRKBUILD}/.config
  25. endif
  26. ifeq ($(ADK_TOOLCHAIN_GCC_USE_SSP),y)
  27. $(SED) 's,.*UCLIBC_HAS_SSP,UCLIBC_HAS_SSP=y,' ${WRKBUILD}/.config
  28. echo "UCLIBC_HAS_SSP_COMPAT=n" >> ${WRKBUILD}/.config
  29. echo "SSP_QUICK_CANARY=n" >> ${WRKBUILD}/.config
  30. echo "UCLIBC_BUILD_SSP=y" >> ${WRKBUILD}/.config
  31. endif
  32. echo N|$(MAKE) ${UCLIBC_MAKEOPTS} -C $(WRKBUILD) \
  33. PREFIX=$(STAGING_TARGET_DIR) \
  34. DEVEL_PREFIX=/usr/ \
  35. RUNTIME_PREFIX=$(STAGING_TARGET_DIR) \
  36. HOSTCC="$(CC_FOR_BUILD)" \
  37. CPU_CFLAGS="$(TARGET_CFLAGS)" \
  38. oldconfig
  39. $(MAKE) ${UCLIBC_MAKEOPTS} -C $(WRKBUILD) \
  40. PREFIX=$(STAGING_TARGET_DIR) \
  41. DEVEL_PREFIX=/usr/ \
  42. RUNTIME_PREFIX=$(STAGING_TARGET_DIR) \
  43. HOSTCC="$(CC_FOR_BUILD)" \
  44. CPU_CFLAGS="$(TARGET_CFLAGS)" \
  45. install_headers
  46. touch $(WRKBUILD)/.configured
  47. touch $@
  48. $(WRKBUILD)/.compiled:
  49. $(MAKE) ${UCLIBC_MAKEOPTS} -C $(WRKBUILD) \
  50. PREFIX= \
  51. DEVEL_PREFIX=/ \
  52. RUNTIME_PREFIX=/ \
  53. HOSTCC="$(CC_FOR_BUILD)" \
  54. CPU_CFLAGS="$(TARGET_CFLAGS)" \
  55. all
  56. touch $@
  57. $(WRKBUILD)/.install_headers: $(WRKBUILD)/.compiled
  58. $(MAKE) -C $(WRKBUILD) \
  59. PREFIX=$(STAGING_TARGET_DIR) \
  60. DEVEL_PREFIX=/usr/ \
  61. DEVEL_PREFIX_LIB=/ \
  62. RUNTIME_PREFIX=/ \
  63. CPU_CFLAGS="$(TARGET_CFLAGS)" \
  64. install_dev
  65. touch $@
  66. $(WRKBUILD)/.installed: $(WRKBUILD)/.install_headers
  67. $(MAKE) -C $(WRKBUILD) \
  68. PREFIX=$(STAGING_TARGET_DIR) \
  69. DEVEL_PREFIX=/usr/ \
  70. DEVEL_PREFIX_LIB=/ \
  71. RUNTIME_PREFIX=/ \
  72. CPU_CFLAGS="$(TARGET_CFLAGS)" \
  73. install_runtime
  74. rm -rf $(STAGING_TARGET_DIR)/lib/libc.so
  75. ln -s libc.so.0 $(STAGING_TARGET_DIR)/lib/libc.so
  76. touch $@
  77. include ${TOPDIR}/mk/toolchain.mk