From ba750f41415e70d6ba5c2be99a91eee6519513ba Mon Sep 17 00:00:00 2001 From: jow Date: Sun, 12 Aug 2012 12:34:30 +0000 Subject: [PATCH] [tools] use HOST_STATIC_LINKING instead of hardcoding -static git-svn-id: svn://svn.openwrt.org/openwrt/trunk@33140 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- tools/bison/Makefile | 2 +- tools/ccache/Makefile | 2 +- tools/dosfstools/Makefile | 2 +- tools/e2fsprogs/Makefile | 2 +- tools/firmware-utils/Makefile | 2 +- tools/flex/Makefile | 2 +- tools/flock/Makefile | 2 +- tools/genext2fs/Makefile | 2 +- tools/m4/Makefile | 2 +- tools/mklibs/Makefile | 2 +- tools/mtd-utils/Makefile | 2 +- tools/mtools/Makefile | 2 +- tools/patch-cmdline/Makefile | 2 +- tools/pkg-config/Makefile | 5 +++-- tools/qemu/Makefile | 2 +- tools/sdcc/Makefile | 2 +- tools/squashfs/Makefile | 2 +- tools/sstrip/Makefile | 2 +- tools/upslug2/Makefile | 2 +- tools/upx/Makefile | 2 +- tools/wrt350nv2-builder/Makefile | 2 +- tools/xz/Makefile | 5 +++-- tools/yaffs2/Makefile | 2 +- 23 files changed, 27 insertions(+), 25 deletions(-) diff --git a/tools/bison/Makefile b/tools/bison/Makefile index b7fdf254a..b48862a3d 100644 --- a/tools/bison/Makefile +++ b/tools/bison/Makefile @@ -16,7 +16,7 @@ PKG_CAT:=bzcat include $(INCLUDE_DIR)/host-build.mk -HOST_LDFLAGS += -static +HOST_LDFLAGS += $(HOST_STATIC_LINKING) define Host/Clean -$(MAKE) -C $(HOST_BUILD_DIR) uninstall diff --git a/tools/ccache/Makefile b/tools/ccache/Makefile index 5d464e7de..9020c9c47 100644 --- a/tools/ccache/Makefile +++ b/tools/ccache/Makefile @@ -16,7 +16,7 @@ PKG_MD5SUM:=80a698c22d0b06b19c88ac58e8d8b632 include $(INCLUDE_DIR)/host-build.mk -HOST_LDFLAGS += -static +HOST_LDFLAGS += $(HOST_STATIC_LINKING) HOST_CONFIGURE_VARS += CC="$(HOSTCC_NOCACHE)" define Host/Install/ccache diff --git a/tools/dosfstools/Makefile b/tools/dosfstools/Makefile index 73d8e2a36..c58248910 100644 --- a/tools/dosfstools/Makefile +++ b/tools/dosfstools/Makefile @@ -16,7 +16,7 @@ PKG_CAT:=zcat include $(INCLUDE_DIR)/host-build.mk define Host/Compile - $(MAKE) -C $(HOST_BUILD_DIR) SHELL="$(BASH)" LDFLAGS="$(HOST_LDFLAGS) -static" + $(MAKE) -C $(HOST_BUILD_DIR) SHELL="$(BASH)" LDFLAGS="$(HOST_LDFLAGS) $(HOST_STATIC_LINKING)" endef define Host/Install diff --git a/tools/e2fsprogs/Makefile b/tools/e2fsprogs/Makefile index dc4dc70ae..665ca0dcd 100644 --- a/tools/e2fsprogs/Makefile +++ b/tools/e2fsprogs/Makefile @@ -18,7 +18,7 @@ PKG_SOURCE_URL:=@SF/e2fsprogs include $(INCLUDE_DIR)/host-build.mk HOST_CFLAGS += $(FPIC) -HOST_LDFLAGS += -static +HOST_LDFLAGS += $(HOST_STATIC_LINKING) HOST_CONFIGURE_ARGS += \ --disable-shared \ diff --git a/tools/firmware-utils/Makefile b/tools/firmware-utils/Makefile index 640dd23ee..299466076 100644 --- a/tools/firmware-utils/Makefile +++ b/tools/firmware-utils/Makefile @@ -12,7 +12,7 @@ include $(INCLUDE_DIR)/host-build.mk include $(INCLUDE_DIR)/kernel.mk define cc - $(HOSTCC) $(HOST_CFLAGS) -include endian.h -static -o $(HOST_BUILD_DIR)/bin/$(firstword $(1)) $(foreach src,$(1),src/$(src).c) $(2) + $(HOSTCC) $(HOST_CFLAGS) -include endian.h $(HOST_STATIC_LINKING) -o $(HOST_BUILD_DIR)/bin/$(firstword $(1)) $(foreach src,$(1),src/$(src).c) $(2) endef define Host/Compile diff --git a/tools/flex/Makefile b/tools/flex/Makefile index 8e32ace85..659324a64 100644 --- a/tools/flex/Makefile +++ b/tools/flex/Makefile @@ -16,7 +16,7 @@ PKG_CAT:=bzcat include $(INCLUDE_DIR)/host-build.mk -HOST_LDFLAGS += -static +HOST_LDFLAGS += $(HOST_STATIC_LINKING) define Host/Clean -$(MAKE) -C $(HOST_BUILD_DIR) uninstall diff --git a/tools/flock/Makefile b/tools/flock/Makefile index ead98e732..f5e13cd91 100644 --- a/tools/flock/Makefile +++ b/tools/flock/Makefile @@ -12,7 +12,7 @@ include $(INCLUDE_DIR)/host-build.mk define Host/Compile mkdir -p $(HOST_BUILD_DIR) - $(HOSTCC) $(HOST_CFLAGS) -static -o $(HOST_BUILD_DIR)/flock src/flock.c + $(HOSTCC) $(HOST_CFLAGS) $(HOST_STATIC_LINKING) -o $(HOST_BUILD_DIR)/flock src/flock.c endef define Host/Install diff --git a/tools/genext2fs/Makefile b/tools/genext2fs/Makefile index 2462b8cd8..57e8d35b5 100644 --- a/tools/genext2fs/Makefile +++ b/tools/genext2fs/Makefile @@ -36,7 +36,7 @@ HOST_CONFIGURE_ARGS = \ define Host/Compile $(MAKE) -C $(HOST_BUILD_DIR) \ CFLAGS="$(HOST_CFLAGS)" \ - LDFLAGS="$(HOST_LDFLAGS) -static" \ + LDFLAGS="$(HOST_LDFLAGS) $(HOST_STATIC_LINKING)" \ all endef diff --git a/tools/m4/Makefile b/tools/m4/Makefile index 91efb5b0d..6470a549a 100644 --- a/tools/m4/Makefile +++ b/tools/m4/Makefile @@ -16,7 +16,7 @@ PKG_CAT:=zcat include $(INCLUDE_DIR)/host-build.mk -HOST_LDFLAGS += -static +HOST_LDFLAGS += $(HOST_STATIC_LINKING) define Host/Clean -$(MAKE) -C $(HOST_BUILD_DIR) uninstall diff --git a/tools/mklibs/Makefile b/tools/mklibs/Makefile index 0858ad3d5..fd3d233c4 100644 --- a/tools/mklibs/Makefile +++ b/tools/mklibs/Makefile @@ -16,7 +16,7 @@ PKG_MD5SUM:=afe0ed527ba96b8a882b5de350603007 include $(INCLUDE_DIR)/host-build.mk HOST_CFLAGS += -I$(CURDIR)/include -HOST_LDFLAGS += -static +HOST_LDFLAGS += $(HOST_STATIC_LINKING) define Host/Install $(INSTALL_BIN) \ diff --git a/tools/mtd-utils/Makefile b/tools/mtd-utils/Makefile index 9a639fea4..3dccb591f 100644 --- a/tools/mtd-utils/Makefile +++ b/tools/mtd-utils/Makefile @@ -28,7 +28,7 @@ endif MTD_MAKEOPTS = \ CFLAGS="$(CFLAGS)" \ - LDFLAGS="$(HOST_LDFLAGS) -static" \ + LDFLAGS="$(HOST_LDFLAGS) $(HOST_STATIC_LINKING)" \ WITHOUT_LZO=1 WITHOUT_XATTR=1 \ LZMA_STATIC_LIB="$(STAGING_DIR_HOST)/lib/liblzma.a" \ SUBDIRS="" \ diff --git a/tools/mtools/Makefile b/tools/mtools/Makefile index 36f6adc86..8d227c147 100644 --- a/tools/mtools/Makefile +++ b/tools/mtools/Makefile @@ -16,7 +16,7 @@ PKG_CAT:=zcat include $(INCLUDE_DIR)/host-build.mk -HOST_LDFLAGS += -static +HOST_LDFLAGS += $(HOST_STATIC_LINKING) define Host/Compile $(MAKE) -C $(HOST_BUILD_DIR) mcopy diff --git a/tools/patch-cmdline/Makefile b/tools/patch-cmdline/Makefile index a75ba83b3..a9526397f 100644 --- a/tools/patch-cmdline/Makefile +++ b/tools/patch-cmdline/Makefile @@ -11,7 +11,7 @@ PKG_NAME:=patch-cmdline include $(INCLUDE_DIR)/host-build.mk define Host/Compile - $(HOSTCC) $(HOST_CFLAGS) -include endian.h -static -o $(HOST_BUILD_DIR)/$(PKG_NAME) src/$(PKG_NAME).c + $(HOSTCC) $(HOST_CFLAGS) -include endian.h $(HOST_STATIC_LINKING) -o $(HOST_BUILD_DIR)/$(PKG_NAME) src/$(PKG_NAME).c endef define Host/Install diff --git a/tools/pkg-config/Makefile b/tools/pkg-config/Makefile index fbdc1d0db..01bfdb0d6 100644 --- a/tools/pkg-config/Makefile +++ b/tools/pkg-config/Makefile @@ -15,10 +15,11 @@ PKG_MD5SUM:=a3270bab3f4b69b7dc6dbdacbcae9745 include $(INCLUDE_DIR)/host-build.mk -HOST_LDFLAGS += -static +HOST_LDFLAGS += $(HOST_STATIC_LINKING) define Host/Install - $(MAKE) -C $(HOST_BUILD_DIR) install AM_LDFLAGS="-all-static" + $(MAKE) -C $(HOST_BUILD_DIR) install \ + AM_LDFLAGS="$(if $(HOST_STATIC_LINKING),-all-static)" mv $(STAGING_DIR_HOST)/bin/pkg-config $(STAGING_DIR_HOST)/bin/pkg-config.real $(INSTALL_BIN) ./files/pkg-config $(STAGING_DIR_HOST)/bin/pkg-config endef diff --git a/tools/qemu/Makefile b/tools/qemu/Makefile index 92f0304ea..45d42d488 100644 --- a/tools/qemu/Makefile +++ b/tools/qemu/Makefile @@ -17,7 +17,7 @@ PKG_MD5SUM:=b6c713a8db638e173af53a62d5178640 include $(INCLUDE_DIR)/host-build.mk HOST_CFLAGS += -I$(STAGING_DIR_HOST)/include/e2fsprogs -HOST_LDFLAGS += -static +HOST_LDFLAGS += $(HOST_STATIC_LINKING) define Host/Configure (cd $(HOST_BUILD_DIR); \ diff --git a/tools/sdcc/Makefile b/tools/sdcc/Makefile index abedc3ca7..3210bb3e7 100644 --- a/tools/sdcc/Makefile +++ b/tools/sdcc/Makefile @@ -17,7 +17,7 @@ HOST_BUILD_DIR:=$(BUILD_DIR_HOST)/$(PKG_NAME) include $(INCLUDE_DIR)/host-build.mk -HOST_LDFLAGS += -static +HOST_LDFLAGS += $(HOST_STATIC_LINKING) HOST_CONFIGURE_ARGS += \ --disable-ucsim \ --enable-packihx \ diff --git a/tools/squashfs/Makefile b/tools/squashfs/Makefile index f4a546013..6dc27d675 100644 --- a/tools/squashfs/Makefile +++ b/tools/squashfs/Makefile @@ -21,7 +21,7 @@ include $(INCLUDE_DIR)/host-build.mk define Host/Compile $(MAKE) -C $(HOST_BUILD_DIR)/squashfs-tools \ CC="$(HOSTCC)" \ - CXX="$(CXX) -static" \ + CXX="$(CXX) $(HOST_STATIC_LINKING)" \ LZMAPATH=$(STAGING_DIR_HOST)/lib \ mksquashfs-lzma unsquashfs-lzma endef diff --git a/tools/sstrip/Makefile b/tools/sstrip/Makefile index b10a2523c..ea4c3e880 100644 --- a/tools/sstrip/Makefile +++ b/tools/sstrip/Makefile @@ -11,7 +11,7 @@ PKG_NAME:=sstrip include $(INCLUDE_DIR)/host-build.mk define Host/Compile - $(HOSTCC) $(HOST_CFLAGS) -I./include -include endian.h -static -o $(HOST_BUILD_DIR)/sstrip src/sstrip.c + $(HOSTCC) $(HOST_CFLAGS) -I./include -include endian.h $(HOST_STATIC_LINKING) -o $(HOST_BUILD_DIR)/sstrip src/sstrip.c endef define Host/Install diff --git a/tools/upslug2/Makefile b/tools/upslug2/Makefile index 19d160c33..e80cef0eb 100644 --- a/tools/upslug2/Makefile +++ b/tools/upslug2/Makefile @@ -18,7 +18,7 @@ PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2 include $(INCLUDE_DIR)/host-build.mk unexport CFLAGS -HOST_LDFLAGS += -static +HOST_LDFLAGS += $(HOST_STATIC_LINKING) define Host/Configure (cd $(HOST_BUILD_DIR); \ diff --git a/tools/upx/Makefile b/tools/upx/Makefile index 339c61115..3e7623201 100644 --- a/tools/upx/Makefile +++ b/tools/upx/Makefile @@ -21,7 +21,7 @@ include $(INCLUDE_DIR)/host-build.mk define Host/Compile rm -f $(HOST_BUILD_DIR)/src/.depend $(MAKE) UPX_LZMADIR="$(BUILD_DIR_HOST)/lzma-4.65" -C $(HOST_BUILD_DIR)/src \ - CXXFLAGS_WERROR="" LDFLAGS="$(HOST_LDFLAGS) -static" + CXXFLAGS_WERROR="" LDFLAGS="$(HOST_LDFLAGS) $(HOST_STATIC_LINKING)" endef define Host/Install diff --git a/tools/wrt350nv2-builder/Makefile b/tools/wrt350nv2-builder/Makefile index f471df1c5..da2bd6bc7 100644 --- a/tools/wrt350nv2-builder/Makefile +++ b/tools/wrt350nv2-builder/Makefile @@ -18,7 +18,7 @@ define Host/Compile $(HOSTCC) $(HOST_CFLAGS) -c src/md5.c -o $(HOST_BUILD_DIR)/md5.o $(HOSTCC) $(HOST_CFLAGS) -c src/ioapi.c -o $(HOST_BUILD_DIR)/ioapi.o $(HOSTCC) $(HOST_CFLAGS) -c src/wrt350nv2-builder.c -o $(HOST_BUILD_DIR)/wrt350nv2-builder.o - $(HOSTCC) $(HOST_CFLAGS) $(HOST_LDFLAGS) -static -o $(HOST_BUILD_DIR)/wrt350nv2-builder \ + $(HOSTCC) $(HOST_CFLAGS) $(HOST_LDFLAGS) $(HOST_STATIC_LINKING) -o $(HOST_BUILD_DIR)/wrt350nv2-builder \ $(HOST_BUILD_DIR)/wrt350nv2-builder.o $(HOST_BUILD_DIR)/md5.o $(HOST_BUILD_DIR)/ioapi.o endef diff --git a/tools/xz/Makefile b/tools/xz/Makefile index 41894e073..b1698be99 100644 --- a/tools/xz/Makefile +++ b/tools/xz/Makefile @@ -15,10 +15,11 @@ PKG_MD5SUM:=8d900b742b94fa9e708ca4f5a4b29003 include $(INCLUDE_DIR)/host-build.mk -HOST_LDFLAGS += -static +HOST_LDFLAGS += $(HOST_STATIC_LINKING) define Host/Install - $(MAKE) -C $(HOST_BUILD_DIR) install xzlinks="unxz xzcat" AM_LDFLAGS="-all-static" + $(MAKE) -C $(HOST_BUILD_DIR) install xzlinks="unxz xzcat" \ + AM_LDFLAGS="$(if $(HOST_STATIC_LINKING),-all-static)" endef $(eval $(call HostBuild)) diff --git a/tools/yaffs2/Makefile b/tools/yaffs2/Makefile index 8615fd30e..afa9ab998 100644 --- a/tools/yaffs2/Makefile +++ b/tools/yaffs2/Makefile @@ -22,7 +22,7 @@ include $(INCLUDE_DIR)/host-build.mk define Host/Compile $(MAKE) -C $(HOST_BUILD_DIR)/yaffs2/utils \ - CC="$(HOSTCC) -static" \ + CC="$(HOSTCC) $(HOST_STATIC_LINKING)" \ CFLAGS="$(HOST_CFLAGS) -include endian.h" \ mkyaffs2image endef