Makefile 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  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. #workaround for mips and gcc 4.4, where -Os does not inline code in ld.so
  9. ifeq ($(ARCH),mips)
  10. TARGET_CFLAGS:=$(subst Os,O2,$(TARGET_CFLAGS))
  11. endif
  12. #workaround for cris and gcc 4.4, where -Os generates ICE
  13. ifeq ($(ARCH),cris)
  14. TARGET_CFLAGS:=$(subst Os,O2,$(TARGET_CFLAGS))
  15. endif
  16. $(WRKBUILD)/.headers:
  17. $(SED) 's,^CROSS=.*,CROSS=$(TARGET_CROSS),g' $(WRKBUILD)/Rules.mak
  18. sed -e 's^KERNEL_HEADERS.*$$KERNEL_HEADERS=\"${TOOLCHAIN_SYSROOT}/usr/include\"' \
  19. $(TOPDIR)/target/$(DEVICE)/uclibc.config >${WRKBUILD}/.config
  20. ifeq ($(ADK_IPV6),y)
  21. $(SED) 's,# UCLIBC_HAS_IPV6.*,UCLIBC_HAS_IPV6=y,' \
  22. ${WRKBUILD}/.config
  23. endif
  24. ifeq ($(ADK_SSP),y)
  25. $(SED) 's,# UCLIBC_HAS_SSP.*,UCLIBC_HAS_SSP=y,' \
  26. ${WRKBUILD}/.config
  27. echo 'UCLIBC_BUILD_SSP=y' >> ${WRKBUILD}/.config
  28. echo '# UCLIBC_HAS_SSP_COMPAT is not set' >> ${WRKBUILD}/.config
  29. echo '# SSP_QUICK_CANARY is not set' >> ${WRKBUILD}/.config
  30. echo 'PROPOLICE_BLOCK_ABRT=y' >> ${WRKBUILD}/.config
  31. echo '# PROPOLICE_BLOCK_SEGV is not set' >> ${WRKBUILD}/.config
  32. endif
  33. ifneq ($(ADK_DEBUG),)
  34. $(SED) 's,DOSTRIP,DODEBUG,' ${WRKBUILD}/.config
  35. endif
  36. $(MAKE) -C $(WRKBUILD) \
  37. PREFIX=$(TOOLCHAIN_SYSROOT)/ \
  38. DEVEL_PREFIX=/usr/ \
  39. RUNTIME_PREFIX=$(TOOLCHAIN_SYSROOT)/ \
  40. HOSTCC="$(HOSTCC)" \
  41. CPU_CFLAGS="$(TARGET_CFLAGS)" \
  42. install_headers
  43. touch $(WRKBUILD)/.configured
  44. touch $@
  45. $(WRKBUILD)/.compiled:
  46. $(MAKE) -C $(WRKBUILD) \
  47. PREFIX= \
  48. DEVEL_PREFIX=/ \
  49. RUNTIME_PREFIX=/ \
  50. HOSTCC="$(HOSTCC)" \
  51. CPU_CFLAGS="$(TARGET_CFLAGS)" \
  52. all
  53. touch $@
  54. $(WRKBUILD)/.install_headers: $(WRKBUILD)/.compiled
  55. $(MAKE) -C $(WRKBUILD) \
  56. PREFIX=$(STAGING_DIR) \
  57. DEVEL_PREFIX=/ \
  58. RUNTIME_PREFIX=/ \
  59. CPU_CFLAGS="$(TARGET_CFLAGS)" \
  60. install_dev
  61. touch $@
  62. $(WRKBUILD)/.installed: $(WRKBUILD)/.install_headers
  63. $(MAKE) -C $(WRKBUILD) \
  64. PREFIX=$(STAGING_DIR) \
  65. DEVEL_PREFIX=/ \
  66. RUNTIME_PREFIX=/ \
  67. CPU_CFLAGS="$(TARGET_CFLAGS)" \
  68. install_runtime
  69. rm -rf $(STAGING_DIR)/lib/libc.so
  70. ln -s libc.so.0 $(STAGING_DIR)/lib/libc.so
  71. touch $@
  72. include ${TOPDIR}/mk/toolchain.mk