From 8bb86e330b80bfb29fffc25fa38affdb2dfa44e9 Mon Sep 17 00:00:00 2001 From: Przemyslaw Skibinski Date: Mon, 21 Nov 2016 12:51:01 +0100 Subject: [PATCH] create DLL with Windows --- lib/Makefile | 9 ++++++--- tests/Makefile | 8 ++++++++ 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/lib/Makefile b/lib/Makefile index 3aacb831c..681c048c6 100644 --- a/lib/Makefile +++ b/lib/Makefile @@ -72,8 +72,11 @@ libzstd.a: $(ZSTD_FILES) $(LIBZSTD): LDFLAGS += -shared -fPIC $(LIBZSTD): $(ZSTD_FILES) @echo compiling dynamic library $(LIBVER) +ifneq (,$(filter Windows%,$(OS))) + @$(CC) $(FLAGS) -DZSTD_DLL_EXPORT=1 -shared $^ -o dll\libzstd.dll + dlltool -D dll\libzstd.dll -d dll\libzstd.def -l dll\libzstd.lib +else @$(CC) $(FLAGS) $^ $(LDFLAGS) $(SONAME_FLAGS) -o $@ -ifeq (,$(filter Windows%,$(OS))) @echo creating versioned links @ln -sf $@ libzstd.$(SHARED_EXT_MAJOR) @ln -sf $@ libzstd.$(SHARED_EXT) @@ -84,8 +87,8 @@ libzstd : $(LIBZSTD) lib: libzstd.a libzstd clean: - @rm -f core *.o *.a *.gcda *.$(SHARED_EXT) *.$(SHARED_EXT).* libzstd.pc - @rm -f decompress/*.o + @$(RM) -f core *.o *.a *.gcda *.$(SHARED_EXT) *.$(SHARED_EXT).* libzstd.pc dll/libzstd.dll dll/libzstd.lib + @$(RM) -f decompress/*.o @echo Cleaning library completed #------------------------------------------------------------------------ diff --git a/tests/Makefile b/tests/Makefile index d3a280e58..e2e8e0881 100644 --- a/tests/Makefile +++ b/tests/Makefile @@ -82,6 +82,14 @@ fullbench : $(ZSTD_FILES) $(PRGDIR)/datagen.c fullbench.c fullbench32 : $(ZSTD_FILES) $(PRGDIR)/datagen.c fullbench.c $(CC) -m32 $(FLAGS) $^ -o $@$(EXT) +fullbench-lib: $(PRGDIR)/datagen.c fullbench.c + $(MAKE) -C $(ZSTDDIR) libzstd.a + $(CC) $(FLAGS) $^ -o $@$(EXT) $(ZSTDDIR)/libzstd.a + +fullbench-dll: $(PRGDIR)/datagen.c fullbench.c + $(MAKE) -C $(ZSTDDIR) libzstd + $(CC) $(FLAGS) $^ -o $@$(EXT) -DZSTD_DLL_IMPORT=1 $(ZSTDDIR)/dll/libzstd.dll + fuzzer : CPPFLAGS += -I$(ZSTDDIR)/dictBuilder fuzzer : $(ZSTD_FILES) $(ZDICT_FILES) $(PRGDIR)/datagen.c fuzzer.c $(CC) $(FLAGS) $^ -o $@$(EXT)