Makefile 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  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. include $(TOPDIR)/rules.mk
  4. include ../rules.mk
  5. include Makefile.inc
  6. include ${TOPDIR}/mk/buildhlp.mk
  7. ifeq ($(CPU_ARCH),ppc)
  8. REAL_GNU_TARGET_NAME:= $(subst ppc,powerpc,$(REAL_GNU_TARGET_NAME))
  9. endif
  10. ifeq ($(CPU_ARCH),mips64el)
  11. REAL_GNU_TARGET_NAME:= $(subst mips64el,mips,$(REAL_GNU_TARGET_NAME))
  12. endif
  13. ifeq ($(CPU_ARCH),mips64)
  14. REAL_GNU_TARGET_NAME:= $(subst mips64,mips,$(REAL_GNU_TARGET_NAME))
  15. endif
  16. ifeq ($(CPU_ARCH),microblazeel)
  17. REAL_GNU_TARGET_NAME:= $(subst microblazeel,microblaze,$(REAL_GNU_TARGET_NAME))
  18. endif
  19. ifeq ($(CPU_ARCH),sh4)
  20. REAL_GNU_TARGET_NAME:= $(subst sh4,sh,$(REAL_GNU_TARGET_NAME))
  21. endif
  22. $(WRKBUILD)/.headers:
  23. (cd $(WRKBUILD); CC='$(TARGET_CC)' CROSS_COMPILE='$(TARGET_CROSS)' \
  24. ./configure --prefix=/usr \
  25. --target=$(REAL_GNU_TARGET_NAME) \
  26. --disable-gcc-wrapper \
  27. )
  28. $(MAKE) -C $(WRKBUILD) DESTDIR=$(STAGING_TARGET_DIR) install-headers
  29. touch $(WRKBUILD)/.configured
  30. touch $@
  31. $(WRKBUILD)/.compiled:
  32. # reconfigure musl, otherwise linking with libgcc or libgcc_eh is disabled
  33. $(MAKE) CFLAGS='$(TARGET_CFLAGS)' -C $(WRKBUILD) clean
  34. (cd $(WRKBUILD); CC='$(TARGET_CC)' CROSS_COMPILE='$(TARGET_CROSS)' \
  35. ./configure --prefix=/usr \
  36. --target=$(REAL_GNU_TARGET_NAME) \
  37. --disable-gcc-wrapper \
  38. )
  39. $(MAKE) CFLAGS='$(TARGET_CFLAGS)' -C $(WRKBUILD) all
  40. touch $@
  41. $(WRKBUILD)/.installed: $(WRKBUILD)/.compiled
  42. $(MAKE) -C $(WRKBUILD) DESTDIR=$(STAGING_TARGET_DIR) install
  43. touch $@
  44. $(WRKBUILD)/.fixup:
  45. # reconfigure musl, otherwise linking with libgcc or libgcc_eh is disabled
  46. $(MAKE) CFLAGS='$(TARGET_CFLAGS)' -C $(WRKBUILD) clean
  47. (cd $(WRKBUILD); CC='$(TARGET_CC)' CROSS_COMPILE='$(TARGET_CROSS)' \
  48. ./configure --prefix=/usr \
  49. --target=$(REAL_GNU_TARGET_NAME) \
  50. --disable-gcc-wrapper \
  51. )
  52. $(MAKE) CFLAGS='$(TARGET_CFLAGS)' -C $(WRKBUILD) all
  53. $(MAKE) -C $(WRKBUILD) DESTDIR=$(STAGING_TARGET_DIR) install
  54. # cleanup toolchain
  55. -find $(STAGING_TARGET_DIR) $(STAGING_HOST_DIR) -name \*.la -delete
  56. PATH="$(TARGET_PATH)" debug='' prefix='${TARGET_CROSS}' ${BASH} ${SCRIPT_DIR}/rstrip.sh $(STAGING_TARGET_DIR)
  57. debug='' prefix=' ' ${BASH} ${SCRIPT_DIR}/rstrip.sh $(STAGING_HOST_DIR)
  58. touch $@
  59. include ${TOPDIR}/mk/toolchain.mk