create DLL with Windows

This commit is contained in:
Przemyslaw Skibinski 2016-11-21 12:51:01 +01:00
parent 93a09eedf1
commit 8bb86e330b
2 changed files with 14 additions and 3 deletions

View File

@ -72,8 +72,11 @@ libzstd.a: $(ZSTD_FILES)
$(LIBZSTD): LDFLAGS += -shared -fPIC $(LIBZSTD): LDFLAGS += -shared -fPIC
$(LIBZSTD): $(ZSTD_FILES) $(LIBZSTD): $(ZSTD_FILES)
@echo compiling dynamic library $(LIBVER) @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 $@ @$(CC) $(FLAGS) $^ $(LDFLAGS) $(SONAME_FLAGS) -o $@
ifeq (,$(filter Windows%,$(OS)))
@echo creating versioned links @echo creating versioned links
@ln -sf $@ libzstd.$(SHARED_EXT_MAJOR) @ln -sf $@ libzstd.$(SHARED_EXT_MAJOR)
@ln -sf $@ libzstd.$(SHARED_EXT) @ln -sf $@ libzstd.$(SHARED_EXT)
@ -84,8 +87,8 @@ libzstd : $(LIBZSTD)
lib: libzstd.a libzstd lib: libzstd.a libzstd
clean: clean:
@rm -f core *.o *.a *.gcda *.$(SHARED_EXT) *.$(SHARED_EXT).* libzstd.pc @$(RM) -f core *.o *.a *.gcda *.$(SHARED_EXT) *.$(SHARED_EXT).* libzstd.pc dll/libzstd.dll dll/libzstd.lib
@rm -f decompress/*.o @$(RM) -f decompress/*.o
@echo Cleaning library completed @echo Cleaning library completed
#------------------------------------------------------------------------ #------------------------------------------------------------------------

View File

@ -82,6 +82,14 @@ fullbench : $(ZSTD_FILES) $(PRGDIR)/datagen.c fullbench.c
fullbench32 : $(ZSTD_FILES) $(PRGDIR)/datagen.c fullbench.c fullbench32 : $(ZSTD_FILES) $(PRGDIR)/datagen.c fullbench.c
$(CC) -m32 $(FLAGS) $^ -o $@$(EXT) $(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 : CPPFLAGS += -I$(ZSTDDIR)/dictBuilder
fuzzer : $(ZSTD_FILES) $(ZDICT_FILES) $(PRGDIR)/datagen.c fuzzer.c fuzzer : $(ZSTD_FILES) $(ZDICT_FILES) $(PRGDIR)/datagen.c fuzzer.c
$(CC) $(FLAGS) $^ -o $@$(EXT) $(CC) $(FLAGS) $^ -o $@$(EXT)