[toolchain/avr32]: add avr32 support for binutils 2.19.1 based on the Atmel 1.2.0...
[openwrt/svn-archive/archive.git] / include / autotools.mk
1 #
2 # Copyright (C) 2007-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 define replace
9 if [ -f "$(PKG_BUILD_DIR)/$(3)$(1)" -a -e "$(2)/$(if $(4),$(4),$(1))" ]; then \
10 rm -f $(PKG_BUILD_DIR)/$(3)$(1); \
11 ln -s $(2)/$(if $(4),$(4),$(1)) $(PKG_BUILD_DIR)/$(3)$(1); \
12 fi
13
14 endef
15
16 # replace copies of ltmain.sh with the build system's version
17 update_libtool_common=$(call replace,ltmain.sh,$(STAGING_DIR)/host/share/libtool,$(CONFIGURE_PATH)/)$(call replace,libtool.m4,$(STAGING_DIR)/host/share/aclocal,$(CONFIGURE_PATH)/)
18 update_libtool=$(call replace,libtool,$(STAGING_DIR)/host/bin,$(CONFIGURE_PATH)/)$(call update_libtool_common)
19 update_libtool_ucxx=$(call replace,libtool,$(STAGING_DIR)/host/bin,$(CONFIGURE_PATH)/,libtool-ucxx)$(call update_libtool_common)
20
21
22 # prevent libtool from linking against host development libraries
23 define libtool_fixup_libdir
24 find $(1) -name '*.la' | $(XARGS) \
25 $(SED) "s,\(^libdir='\| \|-L\|^dependency_libs='\)/usr/lib,\1$(STAGING_DIR)/usr/lib,g" \
26 -e "s,$(STAGING_DIR)/usr/lib/\(libstdc++\|libsupc++\).la,$(TOOLCHAIN_DIR)/usr/lib/\1.la,g"
27 find $(2) -name '*.la' | $(XARGS) \
28 $(SED) "s,\(^libdir='\| \|-L\|^dependency_libs='\)/usr/lib,\1$(STAGING_DIR)/usr/lib,g" \
29 -e "s,$(STAGING_DIR)/usr/lib/\(libstdc++\|libsupc++\).la,$(TOOLCHAIN_DIR)/usr/lib/\1.la,g"
30 endef
31
32 define remove_version_check
33 if [ -f "$(PKG_BUILD_DIR)/$(CONFIGURE_PATH)/configure" ]; then \
34 $(SED) \
35 's,pardus_ltmain_version=.*,pardus_ltmain_version="$$$$pardus_lt_version",' \
36 $(PKG_BUILD_DIR)/$(CONFIGURE_PATH)/configure; \
37 fi
38 endef
39
40 ifneq ($(filter libtool,$(PKG_FIXUP)),)
41 PKG_BUILD_DEPENDS += libtool
42 Hooks/Configure/Pre += update_libtool remove_version_check
43 Hooks/Configure/Post += update_libtool
44 Hooks/InstallDev/Post += libtool_fixup_libdir
45 endif
46
47 ifneq ($(filter libtool-ucxx,$(PKG_FIXUP)),)
48 PKG_BUILD_DEPENDS += libtool
49 Hooks/Configure/Pre += update_libtool_ucxx remove_version_check
50 Hooks/Configure/Post += update_libtool_ucxx
51 Hooks/InstallDev/Post += libtool_fixup_libdir
52 endif
53