1
0

Makefile 3.5 KB

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