Makefile 2.0 KB

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