Makefile 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. #
  2. # Copyright (C) 2006-2012 OpenWrt.org
  3. #
  4. # This is free software, licensed under the GNU General Public License v2.
  5. # See /LICENSE for more information.
  6. #
  7. include $(TOPDIR)/rules.mk
  8. PKG_NAME:=uclibc++
  9. PKG_VERSION:=0.2.4
  10. PKG_RELEASE:=2
  11. PKG_SOURCE:=uClibc++-$(PKG_VERSION).tar.bz2
  12. PKG_SOURCE_URL:=http://cxx.uclibc.org/src/
  13. PKG_MD5SUM:=394c119363dd8b469fb898442a6764b8
  14. PKG_BUILD_DIR:=$(BUILD_DIR)/uClibc++-$(PKG_VERSION)
  15. PKG_BUILD_PARALLEL:=1
  16. PKG_USE_MIPS16:=0
  17. PKG_LICENSE:=LGPL-2.1+
  18. PKG_INSTALL:=1
  19. include $(INCLUDE_DIR)/package.mk
  20. define Package/uclibcxx
  21. NAME:=uclibc++
  22. SECTION:=libs
  23. CATEGORY:=Libraries
  24. TITLE:=C++ library for embedded systems
  25. URL:=http://cxx.uclibc.org/src/
  26. endef
  27. UCLIBC_TARGET_ARCH:=$(shell echo $(ARCH) | sed -e s'/-.*//' \
  28. -e 's/i.86/i386/' \
  29. -e 's/sparc.*/sparc/' \
  30. -e 's/m68k.*/m68k/' \
  31. -e 's/ppc/powerpc/g' \
  32. -e 's/v850.*/v850/g' \
  33. -e 's/sh64/sh/' \
  34. -e 's/sh[234].*/sh/' \
  35. -e 's/mips.*/mips/' \
  36. -e 's/mipsel.*/mips/' \
  37. )
  38. TARGET_CFLAGS += $(FPIC)
  39. ifneq ($(CONFIG_CCACHE),)
  40. TARGET_CXX=$(TARGET_CXX_NOCACHE)
  41. endif
  42. ifeq ($(CONFIG_USE_MUSL),y)
  43. SSP_LIB=-lssp_nonshared
  44. endif
  45. MAKE_FLAGS:= \
  46. TOPDIR="$(PKG_BUILD_DIR)/" \
  47. $(TARGET_CONFIGURE_OPTS) \
  48. CPU_CFLAGS="$(TARGET_CFLAGS)" \
  49. CROSS="$(TARGET_CROSS)" \
  50. LDFLAGS="-Wl,--warn-common -Wl,--warn-once -Wl,-z,combreloc -Wl,-z,defs $(TARGET_LDFLAGS)" \
  51. CP="$(CP)" \
  52. GEN_LIBS="-lc $(LIBGCC_S) $(SSP_LIB)" \
  53. check_as_needed=
  54. # check_as_needed overrides dependency on libgcc_s
  55. define Build/Configure
  56. if [ -f ./files/config.$(UCLIBC_TARGET_ARCH) ]; then \
  57. cp ./files/config.$(UCLIBC_TARGET_ARCH) $(PKG_BUILD_DIR)/.config; \
  58. else \
  59. cp ./files/config.default $(PKG_BUILD_DIR)/.config; \
  60. fi
  61. endef
  62. define Build/InstallDev
  63. $(INSTALL_DIR) $(2)/bin $(1)/usr/include/uClibc++ $(1)/usr/lib
  64. $(INSTALL_BIN) $(PKG_INSTALL_DIR)/bin/g++-uc $(TOOLCHAIN_DIR)/bin/
  65. $(CP) $(PKG_INSTALL_DIR)/include/* $(1)/usr/include/uClibc++/
  66. $(CP) $(PKG_INSTALL_DIR)/lib/libuClibc++*.{a,so}* $(1)/usr/lib/
  67. $(SED) 's!\(^\|[[:space:]]\)-[IL]$(TOOLCHAIN_DIR)/[^[:space:]]*!!g' $(TOOLCHAIN_DIR)/bin/g++-uc
  68. $(SED) 's|-I/include/|-I$$$${STAGING_DIR:-$(STAGING_DIR)}/usr/include/uClibc++/|g' $(TOOLCHAIN_DIR)/bin/g++-uc
  69. $(SED) 's|-L/lib/|-L$$$${STAGING_DIR:-$(STAGING_DIR)}/lib/|g' $(TOOLCHAIN_DIR)/bin/g++-uc
  70. # add another wrapper which links against both uClibc++ and libstdc++
  71. $(INSTALL_BIN) $(TOOLCHAIN_DIR)/bin/g++-uc $(TOOLCHAIN_DIR)/bin/g++-uc+std
  72. $(SED) 's|^WRAPPER_INCLUDEDIR=.*||g' $(TOOLCHAIN_DIR)/bin/g++-uc+std
  73. $(SED) 's|-luClibc++|-Wl,-Bdynamic,-luClibc++,-Bstatic,-lstdc++,-Bdynamic|g' $(TOOLCHAIN_DIR)/bin/g++-uc+std
  74. $(SED) 's|-nostdinc++||g' $(TOOLCHAIN_DIR)/bin/g++-uc+std
  75. endef
  76. define Package/uclibcxx/install
  77. $(INSTALL_DIR) $(1)/usr/lib
  78. $(CP) $(PKG_INSTALL_DIR)/lib/libuClibc++.so.* $(1)/usr/lib/
  79. $(CP) $(PKG_INSTALL_DIR)/lib/libuClibc++-*.so $(1)/usr/lib/
  80. endef
  81. $(eval $(call BuildPackage,uclibcxx))