From 6ac6472988631cfa137637d186178ad977e3f372 Mon Sep 17 00:00:00 2001 From: Yann Collet Date: Fri, 29 May 2020 12:09:51 -0700 Subject: [PATCH 1/2] fixed double-compilation of lib with make -j all also implemented verbose mode (make V=1) --- Makefile | 45 ++++++++++++++++++++++++--------------------- 1 file changed, 24 insertions(+), 21 deletions(-) diff --git a/Makefile b/Makefile index 2c1d3460..a267c79d 100644 --- a/Makefile +++ b/Makefile @@ -8,6 +8,8 @@ # You may select, at your option, one of the above-listed licenses. # ################################################################ +Q = $(if $(filter 1,$(V) $(VERBOSE)),,@) + PRGDIR = programs ZSTDDIR = lib BUILDIR = build @@ -55,18 +57,19 @@ all32: $(MAKE) -C $(TESTDIR) all32 .PHONY: lib lib-release libzstd.a +lib-all : lib lib lib-release lib-all : - @$(MAKE) -C $(ZSTDDIR) $@ + $(Q)$(MAKE) -C $(ZSTDDIR) $@ .PHONY: zstd zstd-release zstd zstd-release: - @$(MAKE) -C $(PRGDIR) $@ - cp $(PRGDIR)/zstd$(EXT) . + $(Q)$(MAKE) -C $(PRGDIR) $@ + $(Q)cp $(PRGDIR)/zstd$(EXT) . .PHONY: zstdmt zstdmt: - @$(MAKE) -C $(PRGDIR) $@ - cp $(PRGDIR)/zstd$(EXT) ./zstdmt$(EXT) + $(Q)$(MAKE) -C $(PRGDIR) $@ + $(Q)cp $(PRGDIR)/zstd$(EXT) ./zstdmt$(EXT) .PHONY: zlibwrapper zlibwrapper: lib @@ -127,17 +130,17 @@ cleanTabs: .PHONY: clean clean: - @$(MAKE) -C $(ZSTDDIR) $@ > $(VOID) - @$(MAKE) -C $(PRGDIR) $@ > $(VOID) - @$(MAKE) -C $(TESTDIR) $@ > $(VOID) - @$(MAKE) -C $(ZWRAPDIR) $@ > $(VOID) - @$(MAKE) -C examples/ $@ > $(VOID) - @$(MAKE) -C contrib/gen_html $@ > $(VOID) - @$(MAKE) -C contrib/pzstd $@ > $(VOID) - @$(MAKE) -C contrib/seekable_format/examples $@ > $(VOID) - @$(MAKE) -C contrib/largeNbDicts $@ > $(VOID) - @$(RM) zstd$(EXT) zstdmt$(EXT) tmp* - @$(RM) -r lz4 + $(Q)$(MAKE) -C $(ZSTDDIR) $@ > $(VOID) + $(Q)$(MAKE) -C $(PRGDIR) $@ > $(VOID) + $(Q)$(MAKE) -C $(TESTDIR) $@ > $(VOID) + $(Q)$(MAKE) -C $(ZWRAPDIR) $@ > $(VOID) + $(Q)$(MAKE) -C examples/ $@ > $(VOID) + $(Q)$(MAKE) -C contrib/gen_html $@ > $(VOID) + $(Q)$(MAKE) -C contrib/pzstd $@ > $(VOID) + $(Q)$(MAKE) -C contrib/seekable_format/examples $@ > $(VOID) + $(Q)$(MAKE) -C contrib/largeNbDicts $@ > $(VOID) + $(Q)$(RM) zstd$(EXT) zstdmt$(EXT) tmp* + $(Q)$(RM) -r lz4 @echo Cleaning completed #------------------------------------------------------------------------------ @@ -161,7 +164,7 @@ EGREP = egrep $(EGREP_OPTIONS) ## list: Print all targets and their descriptions (if provided) .PHONY: list list: - @TARGETS=$$($(MAKE) -pRrq -f $(lastword $(MAKEFILE_LIST)) : 2>/dev/null \ + $(Q)TARGETS=$$($(MAKE) -pRrq -f $(lastword $(MAKEFILE_LIST)) : 2>/dev/null \ | awk -v RS= -F: '/^# File/,/^# Finished Make data base/ {if ($$1 !~ "^[#.]") {print $$1}}' \ | $(EGREP) -v -e '^[^[:alnum:]]' | sort); \ { \ @@ -176,13 +179,13 @@ list: .PHONY: install armtest usan asan uasan install: - @$(MAKE) -C $(ZSTDDIR) $@ - @$(MAKE) -C $(PRGDIR) $@ + $(Q)$(MAKE) -C $(ZSTDDIR) $@ + $(Q)$(MAKE) -C $(PRGDIR) $@ .PHONY: uninstall uninstall: - @$(MAKE) -C $(ZSTDDIR) $@ - @$(MAKE) -C $(PRGDIR) $@ + $(Q)$(MAKE) -C $(ZSTDDIR) $@ + $(Q)$(MAKE) -C $(PRGDIR) $@ .PHONY: travis-install travis-install: From 105b5839de37c08480d678c99caabf6da74cc9ea Mon Sep 17 00:00:00 2001 From: Yann Collet Date: Fri, 29 May 2020 12:40:59 -0700 Subject: [PATCH 2/2] added comment on $(Q) --- Makefile | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index a267c79d..1735ab86 100644 --- a/Makefile +++ b/Makefile @@ -8,6 +8,7 @@ # You may select, at your option, one of the above-listed licenses. # ################################################################ +# verbose mode (print commands) on V=1 or VERBOSE=1 Q = $(if $(filter 1,$(V) $(VERBOSE)),,@) PRGDIR = programs @@ -48,8 +49,8 @@ allmost: allzstd zlibwrapper # skip zwrapper, can't build that on alternate architectures without the proper zlib installed .PHONY: allzstd allzstd: lib-all - $(MAKE) -C $(PRGDIR) all - $(MAKE) -C $(TESTDIR) all + $(Q)$(MAKE) -C $(PRGDIR) all + $(Q)$(MAKE) -C $(TESTDIR) all .PHONY: all32 all32: @@ -82,12 +83,12 @@ test: MOREFLAGS += -g -DDEBUGLEVEL=$(DEBUGLEVEL) -Werror test: MOREFLAGS="$(MOREFLAGS)" $(MAKE) -j -C $(PRGDIR) allVariants $(MAKE) -C $(TESTDIR) $@ - ZSTD=../../programs/zstd $(MAKE) -C doc/educational_decoder test + ZSTD=../../programs/zstd $(MAKE) -C doc/educational_decoder $@ ## shortest: same as `make check` .PHONY: shortest shortest: - $(MAKE) -C $(TESTDIR) $@ + $(Q)$(MAKE) -C $(TESTDIR) $@ ## check: run basic tests for `zstd` cli .PHONY: check