From 7fad94b8c93732b57c34553ff38f39c43f130e18 Mon Sep 17 00:00:00 2001 From: Eric Biggers Date: Thu, 6 Dec 2018 20:13:18 -0800 Subject: [PATCH] Include import library in Windows binary releases Previously: - libdeflate.dll: the dynamic library - libdeflate.lib: the static library Now: - libdeflate.dll: the dynamic library - libdeflate.lib: the import library - libdeflatestatic.lib: the static library --- Makefile | 31 +++++++++++++++++-------------- tools/make-windows-releases | 3 ++- 2 files changed, 19 insertions(+), 15 deletions(-) diff --git a/Makefile b/Makefile index eaee9bd..a0a529f 100644 --- a/Makefile +++ b/Makefile @@ -31,22 +31,24 @@ override CFLAGS := \ ############################################################################## -STATIC_LIB_SUFFIX := .a -SHARED_LIB_SUFFIX := .so -SHARED_LIB_CFLAGS := -fPIC -PROG_SUFFIX := -PROG_CFLAGS := -HARD_LINKS := 1 +STATIC_LIB_SUFFIX := .a +SHARED_LIB_SUFFIX := .so +SHARED_LIB_CFLAGS := -fPIC +SHARED_LIB_LDFLAGS := +PROG_SUFFIX := +PROG_CFLAGS := +HARD_LINKS := 1 # Compiling for Windows with MinGW? ifneq ($(findstring -mingw,$(shell $(CC) -dumpmachine 2>/dev/null)),) - STATIC_LIB_SUFFIX := .lib - SHARED_LIB_SUFFIX := .dll - SHARED_LIB_CFLAGS := - PROG_SUFFIX := .exe - PROG_CFLAGS := -static -municode - HARD_LINKS := - override CFLAGS := $(CFLAGS) $(call cc-option,-Wno-pedantic-ms-format) + STATIC_LIB_SUFFIX := static.lib + SHARED_LIB_SUFFIX := .dll + SHARED_LIB_CFLAGS := + SHARED_LIB_LDFLAGS := -Wl,--out-implib,libdeflate.lib + PROG_SUFFIX := .exe + PROG_CFLAGS := -static -municode + HARD_LINKS := + override CFLAGS := $(CFLAGS) $(call cc-option,-Wno-pedantic-ms-format) # If AR was not already overridden, then derive it from $(CC). # Note that CC may take different forms, e.g. "cc", "gcc", @@ -130,7 +132,8 @@ DEFAULT_TARGETS += $(STATIC_LIB) # Create shared library $(SHARED_LIB):$(SHARED_LIB_OBJ) - $(QUIET_CCLD) $(CC) -o $@ $(LDFLAGS) $(LIB_CFLAGS) -shared $+ + $(QUIET_CCLD) $(CC) -o $@ $(LDFLAGS) $(LIB_CFLAGS) \ + $(SHARED_LIB_LDFLAGS) -shared $+ DEFAULT_TARGETS += $(SHARED_LIB) diff --git a/tools/make-windows-releases b/tools/make-windows-releases index 7ae2853..14a5d5a 100755 --- a/tools/make-windows-releases +++ b/tools/make-windows-releases @@ -9,7 +9,8 @@ for arch in 'i686' 'x86_64'; do dir=libdeflate-$(git describe --tags | tr -d v)-windows-${arch}-bin rm -rf $dir ${dir}.zip mkdir $dir - cp libdeflate.dll libdeflate.lib libdeflate.h *.exe $dir + cp libdeflate.dll libdeflate.lib libdeflatestatic.lib \ + libdeflate.h *.exe $dir ${arch}-w64-mingw32-strip ${dir}/libdeflate.dll ${dir}/*.exe for file in COPYING NEWS; do sed < $file > ${dir}/${file}.txt -e 's/$/\r/g'