Makefile 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  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 $(ADK_TOPDIR)/rules.mk
  4. include ../rules.mk
  5. include Makefile.inc
  6. include ${ADK_TOPDIR}/mk/buildhlp.mk
  7. ifeq ($(ADK_TARGET_CPU_ARCH),ppc)
  8. GNU_TARGET_NAME:= $(subst ppc,powerpc,$(GNU_TARGET_NAME))
  9. endif
  10. # not yet possible
  11. TARGET_CFLAGS:= $(filter-out -fstack-protector-all,$(TARGET_CFLAGS))
  12. TARGET_LDFLAGS:= $(filter-out -fstack-protector-all,$(TARGET_LDFLAGS))
  13. $(WRKBUILD)/.headers:
  14. (cd $(WRKBUILD); CC='$(TARGET_CC)' CROSS_COMPILE='$(TARGET_CROSS)' \
  15. CFLAGS='$(TARGET_CFLAGS)' \
  16. ./configure --prefix=/usr \
  17. --target=$(GNU_TARGET_NAME) \
  18. --disable-gcc-wrapper \
  19. )
  20. $(MAKE) -C $(WRKBUILD) DESTDIR=$(STAGING_TARGET_DIR) install-headers
  21. touch $(WRKBUILD)/.configured
  22. touch $@
  23. $(WRKBUILD)/.compiled:
  24. # reconfigure musl, otherwise linking with libgcc or libgcc_eh is disabled
  25. $(MAKE) -C $(WRKBUILD) clean
  26. (cd $(WRKBUILD); CC='$(TARGET_CC)' CROSS_COMPILE='$(TARGET_CROSS)' \
  27. CFLAGS='$(TARGET_CFLAGS)' \
  28. ./configure --prefix=/usr \
  29. --target=$(GNU_TARGET_NAME) \
  30. --disable-gcc-wrapper \
  31. )
  32. $(MAKE) -C $(WRKBUILD) CFLAGS='$(TARGET_CFLAGS)' all
  33. touch $@
  34. $(WRKBUILD)/.installed: $(WRKBUILD)/.compiled
  35. $(MAKE) -C $(WRKBUILD) CFLAGS='$(TARGET_CFLAGS)' DESTDIR=$(STAGING_TARGET_DIR) install
  36. touch $@
  37. $(WRKBUILD)/.fixup:
  38. # reconfigure musl, otherwise linking with libgcc or libgcc_eh is disabled
  39. $(MAKE) -C $(WRKBUILD) clean
  40. (cd $(WRKBUILD); CC='$(TARGET_CC)' CROSS_COMPILE='$(TARGET_CROSS)' \
  41. CFLAGS='$(TARGET_CFLAGS)' \
  42. ./configure --prefix=/usr \
  43. --target=$(GNU_TARGET_NAME) \
  44. --disable-gcc-wrapper \
  45. )
  46. $(MAKE) -C $(WRKBUILD) CFLAGS='$(TARGET_CFLAGS)' all
  47. $(MAKE) -C $(WRKBUILD) CFLAGS='$(TARGET_CFLAGS)' DESTDIR=$(STAGING_TARGET_DIR) install
  48. # cleanup toolchain
  49. -find $(STAGING_TARGET_DIR) $(STAGING_HOST_DIR) -name \*.la -delete
  50. ifeq ($(ADK_TARGET_TOOLCHAIN),y)
  51. # strip target libs and host tools for toolchain builds
  52. PATH="$(TARGET_PATH)" debug='0' prefix='${TARGET_CROSS}' ${BASH} ${SCRIPT_DIR}/rstrip.sh \
  53. $(STAGING_TARGET_DIR) $(TOOLCHAIN_DIR)/usr/lib/gcc/$(GNU_TARGET_NAME)
  54. debug='0' prefix=' ' ${BASH} ${SCRIPT_DIR}/rstrip.sh $(TOOLCHAIN_DIR)/usr/bin
  55. endif
  56. touch $@
  57. include ${ADK_TOPDIR}/mk/toolchain.mk