Makefile 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  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. ifeq ($(ADK_CPU_MIPS64),y)
  15. UCLIBCCFG=uclibc.config.little.mips64
  16. else
  17. UCLIBCCFG=uclibc.config.little
  18. endif
  19. endif
  20. ifeq ($(ADK_TARGET_ENDIAN),big)
  21. ifeq ($(ADK_CPU_MIPS64),y)
  22. UCLIBCCFG=uclibc.config.big.mips64
  23. else
  24. UCLIBCCFG=uclibc.config.big
  25. endif
  26. endif
  27. ifeq ($(ADK_TARGET_SYSTEM_LEMOTE_YEELONG),y)
  28. UCLIBCCFG=uclibc.config.little.mips64
  29. endif
  30. $(WRKBUILD)/.headers:
  31. $(SED) 's,^CROSS_COMPILE=.*,CROSS_COMPILE=$(TARGET_CROSS),g' $(WRKBUILD)/Rules.mak
  32. sed -e 's^KERNEL_HEADERS.*$$KERNEL_HEADERS=\"${STAGING_TARGET_DIR}/usr/include\"' \
  33. $(TOPDIR)/target/$(ADK_TARGET_ARCH)/$(UCLIBCCFG) >${WRKBUILD}/.config
  34. ifeq ($(ADK_TARGET_ABI_N64),y)
  35. $(SED) 's/.*\(CONFIG_MIPS_N64_ABI\).*/\1=y/' ${WRKBUILD}/.config
  36. $(SED) 's/.*\(CONFIG_MIPS_O32_ABI\).*/# \1 is not set/' ${WRKBUILD}/.config
  37. $(SED) 's/.*\(CONFIG_MIPS_N32_ABI\).*/# \1 is not set/' ${WRKBUILD}/.config
  38. endif
  39. ifeq ($(ADK_TARGET_ABI_N32),y)
  40. $(SED) 's/.*\(CONFIG_MIPS_N32_ABI\).*/\1=y/' ${WRKBUILD}/.config
  41. $(SED) 's/.*\(CONFIG_MIPS_O32_ABI\).*/# \1 is not set/' ${WRKBUILD}/.config
  42. $(SED) 's/.*\(CONFIG_MIPS_N64_ABI\).*/# \1 is not set/' ${WRKBUILD}/.config
  43. endif
  44. ifeq ($(ADK_TARGET_ABI_O32),y)
  45. $(SED) 's/.*\(CONFIG_MIPS_O32_ABI\).*/\1=y/' ${WRKBUILD}/.config
  46. $(SED) 's/.*\(CONFIG_MIPS_N32_ABI\).*/# \1 is not set/' ${WRKBUILD}/.config
  47. $(SED) 's/.*\(CONFIG_MIPS_N64_ABI\).*/# \1 is not set/' ${WRKBUILD}/.config
  48. endif
  49. ifneq ($(ADK_DEBUG),)
  50. $(SED) 's,DOSTRIP,DODEBUG,' ${WRKBUILD}/.config
  51. endif
  52. ifeq ($(ADK_TOOLCHAIN_GCC_USE_SSP),y)
  53. $(SED) 's,.*UCLIBC_HAS_SSP,UCLIBC_HAS_SSP=y,' ${WRKBUILD}/.config
  54. echo "UCLIBC_HAS_SSP_COMPAT=n" >> ${WRKBUILD}/.config
  55. echo "SSP_QUICK_CANARY=n" >> ${WRKBUILD}/.config
  56. echo "UCLIBC_BUILD_SSP=y" >> ${WRKBUILD}/.config
  57. endif
  58. echo N|$(MAKE) ${UCLIBC_MAKEOPTS} -C $(WRKBUILD) \
  59. PREFIX=$(STAGING_TARGET_DIR) \
  60. DEVEL_PREFIX=/usr/ \
  61. RUNTIME_PREFIX=$(STAGING_TARGET_DIR) \
  62. HOSTCC="$(CC_FOR_BUILD)" \
  63. CPU_CFLAGS="$(TARGET_CFLAGS)" \
  64. oldconfig
  65. $(MAKE) ${UCLIBC_MAKEOPTS} -C $(WRKBUILD) \
  66. PREFIX=$(STAGING_TARGET_DIR) \
  67. DEVEL_PREFIX=/usr/ \
  68. RUNTIME_PREFIX=$(STAGING_TARGET_DIR) \
  69. HOSTCC="$(CC_FOR_BUILD)" \
  70. CPU_CFLAGS="$(TARGET_CFLAGS)" \
  71. install_headers
  72. touch $(WRKBUILD)/.configured
  73. touch $@
  74. $(WRKBUILD)/.compiled:
  75. $(MAKE) ${UCLIBC_MAKEOPTS} -C $(WRKBUILD) \
  76. PREFIX= \
  77. DEVEL_PREFIX=/ \
  78. RUNTIME_PREFIX=/ \
  79. HOSTCC="$(CC_FOR_BUILD)" \
  80. CPU_CFLAGS="$(TARGET_CFLAGS)" \
  81. all
  82. touch $@
  83. $(WRKBUILD)/.install_headers: $(WRKBUILD)/.compiled
  84. $(MAKE) -C $(WRKBUILD) \
  85. PREFIX=$(STAGING_TARGET_DIR) \
  86. DEVEL_PREFIX=/usr/ \
  87. DEVEL_PREFIX_LIB=/ \
  88. RUNTIME_PREFIX=/ \
  89. CPU_CFLAGS="$(TARGET_CFLAGS)" \
  90. install_dev
  91. touch $@
  92. $(WRKBUILD)/.installed: $(WRKBUILD)/.install_headers
  93. $(MAKE) -C $(WRKBUILD) \
  94. PREFIX=$(STAGING_TARGET_DIR) \
  95. DEVEL_PREFIX=/usr/ \
  96. DEVEL_PREFIX_LIB=/ \
  97. RUNTIME_PREFIX=/ \
  98. CPU_CFLAGS="$(TARGET_CFLAGS)" \
  99. install_runtime
  100. rm -rf $(STAGING_TARGET_DIR)/lib/libc.so
  101. ln -s libc.so.0 $(STAGING_TARGET_DIR)/lib/libc.so
  102. touch $@
  103. $(WRKBUILD)/.fixup:
  104. touch $@
  105. include ${TOPDIR}/mk/toolchain.mk