5eb28a5f29b79c98460f634bc0b10edbc44a2cbc
[openwrt/svn-archive/archive.git] / libs / uclibc++ / Makefile
1 #
2 # Copyright (C) 2006-2009 OpenWrt.org
3 #
4 # This is free software, licensed under the GNU General Public License v2.
5 # See /LICENSE for more information.
6 #
7
8 include $(TOPDIR)/rules.mk
9
10 PKG_NAME:=uclibc++
11 PKG_VERSION:=0.2.2
12 PKG_RELEASE:=2
13
14 PKG_SOURCE:=uClibc++-$(PKG_VERSION).tar.bz2
15 PKG_SOURCE_URL:=http://cxx.uclibc.org/src/
16 PKG_MD5SUM:=1ceef3209cca88be8f1bd9de99735954
17
18 PKG_BUILD_DIR:=$(BUILD_DIR)/uClibc++-$(PKG_VERSION)
19
20 include $(INCLUDE_DIR)/package.mk
21
22 define Package/uclibcxx
23 NAME:=uclibc++
24 SECTION:=libs
25 CATEGORY:=Libraries
26 TITLE:=C++ library for embedded systems
27 URL:=http://cxx.uclibc.org/src/
28 endef
29
30 UCLIBC_TARGET_ARCH:=$(shell echo $(ARCH) | sed -e s'/-.*//' \
31 -e 's/i.86/i386/' \
32 -e 's/sparc.*/sparc/' \
33 -e 's/m68k.*/m68k/' \
34 -e 's/ppc/powerpc/g' \
35 -e 's/v850.*/v850/g' \
36 -e 's/sh64/sh/' \
37 -e 's/sh[234].*/sh/' \
38 -e 's/mips.*/mips/' \
39 -e 's/mipsel.*/mips/' \
40 -e 's/cris.*/cris/' \
41 )
42
43 TARGET_CFLAGS += $(FPIC)
44
45 MAKE_FLAGS:= \
46 TOPDIR="$(PKG_BUILD_DIR)/" \
47 $(TARGET_CONFIGURE_OPTS) \
48 ARCH_CFLAGS="$(TARGET_CFLAGS)" \
49 CROSS="$(TARGET_CROSS)" \
50 CP="$(CP)" \
51 $(if $(CONFIG_TARGET_avr32),check_as_needed=)
52
53 # check_as_needed overrides dependency on libgcc_s
54
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
63 define Build/Compile
64 $(MAKE) -C $(PKG_BUILD_DIR) \
65 $(MAKE_FLAGS) \
66 DESTDIR="$(PKG_INSTALL_DIR)/usr" \
67 all install
68 endef
69
70 define Build/InstallDev
71 $(INSTALL_DIR) $(2)/bin $(1)/usr/include/uClibc++ $(1)/usr/lib
72 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/g++-uc $(2)/bin/
73 $(CP) $(PKG_INSTALL_DIR)/usr/include/* $(1)/usr/include/uClibc++/
74 $(CP) $(PKG_INSTALL_DIR)/usr/lib/libuClibc++*.{a,so*} $(1)/usr/lib/
75 $(SED) 's|-I/include/|-I$(STAGING_DIR)/usr/include/uClibc++/|g' $(2)/bin/g++-uc
76 $(SED) 's|-L/lib/|-L$(STAGING_DIR)/usr/lib/|g' $(2)/bin/g++-uc
77 # add another wrapper which links against both uClibc++ and libstdc++
78 $(INSTALL_BIN) $(2)/bin/g++-uc $(2)/bin/g++-uc+std
79 $(SED) 's|^WRAPPER_INCLUDEDIR=.*||g' $(2)/bin/g++-uc+std
80 $(SED) 's|-luClibc++|-Wl,-Bdynamic,-luClibc++,-Bstatic,-lstdc++,-Bdynamic|g' $(2)/bin/g++-uc+std
81 $(SED) 's|-nostdinc++||g' $(2)/bin/g++-uc+std
82 endef
83
84 define Package/uclibcxx/install
85 $(INSTALL_DIR) $(1)/usr/lib
86 $(CP) $(PKG_INSTALL_DIR)/usr/lib/libuClibc++.so.* $(1)/usr/lib/
87 $(CP) $(PKG_INSTALL_DIR)/usr/lib/libuClibc++-*.so $(1)/usr/lib/
88 endef
89
90 $(eval $(call BuildPackage,uclibcxx))