From: Yann Collet Date: Mon, 21 Dec 2020 01:10:57 +0000 (-0800) Subject: try to keep libzstd.a "as is" once created X-Git-Tag: v1.4.9^2~41^2~6 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9648bf027bee71db8f2cad1250c6c65730b0f2a1;p=thirdparty%2Fzstd.git try to keep libzstd.a "as is" once created to be compatible with scenarios such as `make -j allmost` --- diff --git a/Makefile b/Makefile index 2832fb475..f5bc70440 100644 --- a/Makefile +++ b/Makefile @@ -48,7 +48,7 @@ allmost: allzstd zlibwrapper # skip zwrapper, can't build that on alternate architectures without the proper zlib installed .PHONY: allzstd -allzstd: lib-all +allzstd: lib $(Q)$(MAKE) -C $(PRGDIR) all $(Q)$(MAKE) -C $(TESTDIR) all @@ -57,9 +57,8 @@ all32: $(MAKE) -C $(PRGDIR) zstd32 $(MAKE) -C $(TESTDIR) all32 -.PHONY: lib lib-release libzstd.a -lib-all : lib -lib lib-release lib-all : +.PHONY: lib lib-release +lib lib-release : $(Q)$(MAKE) -C $(ZSTDDIR) $@ .PHONY: zstd zstd-release diff --git a/lib/Makefile b/lib/Makefile index 869d76630..c9bd42449 100644 --- a/lib/Makefile +++ b/lib/Makefile @@ -215,13 +215,10 @@ SET_CACHE_DIRECTORY = \ LDFLAGS="$(LDFLAGS)" -.PHONY: lib-all all clean install uninstall - -# alias -lib-all: all - +.PHONY: all all: lib + .PHONY: libzstd.a # must be run every time ifndef BUILD_DIR @@ -339,6 +336,7 @@ libzstd-nomt: $(ZSTD_NOMT_FILES) @echo files : $(ZSTD_NOMT_FILES) $(CC) $(FLAGS) $^ $(LDFLAGS) $(SONAME_FLAGS) -o $@ +.PHONY: clean clean: $(RM) -r *.dSYM # macOS-specific $(RM) core *.o *.a *.gcda *.$(SHARED_EXT) *.$(SHARED_EXT).* libzstd.pc @@ -407,6 +405,7 @@ libzstd.pc: libzstd.pc.in -e 's|@VERSION@|$(VERSION)|' \ $< >$@ +.PHONY: install install: install-pc install-static install-shared install-includes @echo zstd static and shared library installed @@ -437,6 +436,7 @@ install-includes: $(INSTALL_DATA) common/zstd_errors.h $(DESTDIR)$(INCLUDEDIR) $(INSTALL_DATA) dictBuilder/zdict.h $(DESTDIR)$(INCLUDEDIR) +.PHONY: uninstall uninstall: $(RM) $(DESTDIR)$(LIBDIR)/libzstd.a $(RM) $(DESTDIR)$(LIBDIR)/libzstd.$(SHARED_EXT) diff --git a/programs/Makefile b/programs/Makefile index 8641d0ee4..e932c1293 100644 --- a/programs/Makefile +++ b/programs/Makefile @@ -229,7 +229,7 @@ $(BUILD_DIR)/zstd : $(ZSTD_OBJ) @echo "$(LZMA_MSG)" @echo "$(LZ4_MSG)" @echo LINK $@ - $(CC) $(FLAGS) $^ -o $@$(EXT) $(LDFLAGS) + $(LINK.o) $^ -o $(LDLIBS) $@$(EXT) ifeq ($(HAVE_HASH),1) SRCBIN_HASH = $(shell cat $(BUILD_DIR)/zstd 2> $(VOID) | $(HASH) | cut -f 1 -d " ") diff --git a/tests/Makefile b/tests/Makefile index 42bc353c0..1c667cf86 100644 --- a/tests/Makefile +++ b/tests/Makefile @@ -38,8 +38,8 @@ CFLAGS += -Wall -Wextra -Wcast-qual -Wcast-align -Wshadow \ -Wstrict-prototypes -Wundef \ -Wvla -Wformat=2 -Winit-self -Wfloat-equal -Wwrite-strings \ -Wredundant-decls -Wmissing-prototypes -CFLAGS += $(DEBUGFLAGS) $(MOREFLAGS) -FLAGS = $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) +CFLAGS += $(DEBUGFLAGS) +CPPFLAGS += $(MOREFLAGS) ZSTDCOMMON_FILES := $(ZSTDDIR)/common/*.c @@ -107,7 +107,6 @@ libzstd : %-dll : libzstd %-dll : LDFLAGS += -L$(ZSTDDIR) -lzstd -.PHONY: $(ZSTDDIR)/libzstd.a $(ZSTDDIR)/libzstd.a : $(MAKE) -C $(ZSTDDIR) libzstd.a @@ -146,7 +145,7 @@ fullbench-lib : $(PRGDIR)/datagen.c $(PRGDIR)/util.c $(PRGDIR)/timefn.c $(PRGDIR # note : broken : requires symbols unavailable from dynamic library fullbench-dll: $(PRGDIR)/datagen.c $(PRGDIR)/util.c $(PRGDIR)/benchfn.c $(PRGDIR)/timefn.c fullbench.c # $(CC) $(FLAGS) $(filter %.c,$^) -o $@$(EXT) -DZSTD_DLL_IMPORT=1 $(ZSTDDIR)/dll/libzstd.dll - $(CC) $(FLAGS) $(filter %.c,$^) -o $@$(EXT) + $(LINK.c) $^ $(LDLIBS) -o $@$(EXT) fuzzer : CPPFLAGS += $(MULTITHREAD_CPP) fuzzer : LDFLAGS += $(MULTITHREAD_LD) @@ -165,7 +164,7 @@ zbufftest zbufftest32 zbufftest-dll : CPPFLAGS += -I$(ZSTDDIR)/deprecated zbufftest zbufftest32 zbufftest-dll : CFLAGS += -Wno-deprecated-declarations # required to silence deprecation warnings zbufftest32 : CFLAGS += -m32 zbufftest zbufftest32 : $(ZSTD_OBJECTS) $(ZBUFF_FILES) $(PRGDIR)/util.c $(PRGDIR)/timefn.c $(PRGDIR)/datagen.c zbufftest.c - $(CC) $(FLAGS) $^ -o $@$(EXT) + $(LINK.c) $^ -o $@$(EXT) zbufftest-dll : $(ZSTDDIR)/common/xxhash.c $(PRGDIR)/util.c $(PRGDIR)/timefn.c $(PRGDIR)/datagen.c zbufftest.c $(CC) $(CPPFLAGS) $(CFLAGS) $(filter %.c,$^) $(LDFLAGS) -o $@$(EXT)