1
0

Makefile 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  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. # glibc does not compile with Os
  6. TARGET_CFLAGS_LIBC:= $(subst Os,O2,$(TARGET_CFLAGS_LIBC))
  7. ifneq ($(ADK_DEBUG),)
  8. TARGET_CFLAGS_LIBC+= -O2
  9. endif
  10. # ssp partially supported
  11. TARGET_CFLAGS_LIBC:= $(filter-out -fstack-protector,$(TARGET_CFLAGS_LIBC))
  12. include Makefile.inc
  13. include ${TOPDIR}/mk/buildhlp.mk
  14. GLIBC_MAKEOPTS+= cross-compiling=yes
  15. ifeq (${ADK_MAKE_PARALLEL},y)
  16. GLIBC_MAKEOPTS+= PARALLELMFLAGS="-j1"
  17. endif
  18. GLIBC_BUILD_DIR_INITIAL:= ${WRKDIR}/$(PKG_NAME)-$(PKG_VERSION)-headers
  19. GLIBC_BUILD_DIR_FINAL:= ${WRKDIR}/$(PKG_NAME)-$(PKG_VERSION)-final
  20. $(WRKBUILD)/.headers_configure:
  21. mkdir -p $(GLIBC_BUILD_DIR_INITIAL)
  22. (cd $(GLIBC_BUILD_DIR_INITIAL); \
  23. ${GLIBC_ENV} \
  24. $(WRKBUILD)/configure \
  25. --prefix=$(STAGING_TARGET_DIR)/usr \
  26. --with-sysroot=$(STAGING_TARGET_DIR) \
  27. ${GLIBC_CONFOPTS} \
  28. );
  29. touch $@
  30. $(WRKBUILD)/.headers: $(WRKBUILD)/.headers_configure
  31. (cd $(GLIBC_BUILD_DIR_INITIAL); \
  32. ${GLIBC_ENV} \
  33. $(MAKE) ${GLIBC_MAKEOPTS} install-headers \
  34. );
  35. touch $(STAGING_TARGET_DIR)/usr/include/gnu/stubs.h
  36. touch $(STAGING_TARGET_DIR)/usr/include/gnu/stubs-{32,x32,64,soft,hard}.h
  37. touch $@
  38. $(WRKBUILD)/.configured:
  39. mkdir -p $(GLIBC_BUILD_DIR_FINAL)
  40. (cd $(GLIBC_BUILD_DIR_FINAL); \
  41. ${GLIBC_ENV} \
  42. $(WRKBUILD)/configure \
  43. --prefix=/usr \
  44. --enable-shared \
  45. --enable-stackguard-randomization \
  46. ${GLIBC_CONFOPTS} \
  47. );
  48. touch $@
  49. $(WRKBUILD)/.compiled:
  50. ${GLIBC_ENV} $(MAKE) ${GLIBC_MAKEOPTS} -C $(GLIBC_BUILD_DIR_FINAL) all
  51. touch $@
  52. $(WRKBUILD)/.installed:
  53. ${GLIBC_ENV} $(MAKE) -C $(GLIBC_BUILD_DIR_FINAL) install_root=$(STAGING_TARGET_DIR) install
  54. mkdir -p ${STAGING_TARGET_DIR}/etc
  55. ${INSTALL_DATA} ${WRKBUILD}/posix/gai.conf ${STAGING_TARGET_DIR}/etc
  56. ${INSTALL_DATA} ${WRKBUILD}/nscd/nscd.conf ${STAGING_TARGET_DIR}/etc
  57. ${INSTALL_DATA} ${WRKBUILD}/nss/nsswitch.conf ${STAGING_TARGET_DIR}/etc
  58. touch $@
  59. $(WRKBUILD)/.fixup:
  60. -find $(STAGING_TARGET_DIR) $(STAGING_HOST_DIR) -name \*.la -delete
  61. -find $(STAGING_TARGET_DIR) -type f -name \*_pic\* -delete
  62. rm -rf $(STAGING_TARGET_DIR)/usr/share/locale $(STAGING_TARGET_DIR)/usr/share/i18n
  63. rm -rf $(STAGING_TARGET_DIR)/usr/lib/gconv
  64. ifeq ($(ADK_TOOLCHAIN),y)
  65. # strip target libs and host tools for toolchain builds
  66. PATH="$(TARGET_PATH)" debug='0' prefix='${TARGET_CROSS}' ${BASH} ${SCRIPT_DIR}/rstrip.sh $(STAGING_TARGET_DIR)
  67. debug='0' prefix=' ' ${BASH} ${SCRIPT_DIR}/rstrip.sh $(STAGING_HOST_DIR)/bin $(STAGING_HOST_DIR)/$(GNU_TARGET_NAME)/
  68. endif
  69. touch $@
  70. include ${TOPDIR}/mk/toolchain.mk