Browse Source

Add $(verbose) to avoid completely silencing commands

Loïc Hoguin 9 years ago
parent
commit
0eb54a7160

+ 7 - 4
core/core.mk

@@ -29,6 +29,9 @@ PROJECT_VERSION ?= rolling
 
 V ?= 0
 
+verbose_0 = @
+verbose = $(verbose_$(V))
+
 gen_verbose_0 = @echo " GEN   " $@;
 gen_verbose = $(gen_verbose_$(V))
 
@@ -75,12 +78,12 @@ ifneq ($(words $(MAKECMDGOALS)),1)
 endif
 
 all:: deps
-	@$(MAKE) --no-print-directory app
-	@$(MAKE) --no-print-directory rel
+	$(verbose) $(MAKE) --no-print-directory app
+	$(verbose) $(MAKE) --no-print-directory rel
 
 # Noop to avoid a Make warning when there's nothing to do.
 rel::
-	@echo -n
+	$(verbose) echo -n
 
 check:: clean app tests
 
@@ -94,7 +97,7 @@ endif
 distclean:: clean
 
 help::
-	@printf "%s\n" \
+	$(verbose) printf "%s\n" \
 		"erlang.mk (version $(ERLANG_MK_VERSION)) is distributed under the terms of the ISC License." \
 		"Copyright (c) 2013-2015 Loïc Hoguin <essen@ninenines.eu>" \
 		"" \

+ 7 - 7
core/deps.mk

@@ -36,10 +36,10 @@ deps::
 else
 deps:: $(ALL_DEPS_DIRS)
 ifneq ($(IS_DEP),1)
-	@rm -f $(ERLANG_MK_TMP)/deps.log
+	$(verbose) rm -f $(ERLANG_MK_TMP)/deps.log
 endif
-	@mkdir -p $(ERLANG_MK_TMP)
-	@for dep in $(ALL_DEPS_DIRS) ; do \
+	$(verbose) mkdir -p $(ERLANG_MK_TMP)
+	$(verbose) for dep in $(ALL_DEPS_DIRS) ; do \
 		if grep -qs ^$$dep$$ $(ERLANG_MK_TMP)/deps.log; then \
 			echo -n; \
 		else \
@@ -505,7 +505,7 @@ endef
 
 define dep_target
 $(DEPS_DIR)/$(1):
-	@mkdir -p $(DEPS_DIR)
+	$(verbose) mkdir -p $(DEPS_DIR)
 ifeq (,$(dep_$(1)))
 	$(dep_verbose) $(call dep_fetch,$(pkg_$(1)_name),$(pkg_$(1)_fetch), \
 		$(patsubst git://github.com/%,https://github.com/%,$(pkg_$(1)_repo)), \
@@ -527,16 +527,16 @@ else
 endif
 endif
 endif
-	@if [ -f $(DEPS_DIR)/$(1)/configure.ac -o -f $(DEPS_DIR)/$(1)/configure.in ]; then \
+	$(verbose) if [ -f $(DEPS_DIR)/$(1)/configure.ac -o -f $(DEPS_DIR)/$(1)/configure.in ]; then \
 		echo " AUTO  " $(1); \
 		cd $(DEPS_DIR)/$(1) && autoreconf -Wall -vif -I m4; \
 	fi
-	-@if [ -f $(DEPS_DIR)/$(1)/configure ]; then \
+	- $(verbose) if [ -f $(DEPS_DIR)/$(1)/configure ]; then \
 		echo " CONF  " $(1); \
 		cd $(DEPS_DIR)/$(1) && ./configure; \
 	fi
 ifeq ($(filter $(1),$(NO_AUTOPATCH)),)
-	@if [ "$(1)" = "amqp_client" -a "$(RABBITMQ_CLIENT_PATCH)" ]; then \
+	$(verbose) if [ "$(1)" = "amqp_client" -a "$(RABBITMQ_CLIENT_PATCH)" ]; then \
 		if [ ! -d $(DEPS_DIR)/rabbitmq-codegen ]; then \
 			echo " PATCH  Downloading rabbitmq-codegen"; \
 			git clone https://github.com/rabbitmq/rabbitmq-codegen.git $(DEPS_DIR)/rabbitmq-codegen; \

+ 1 - 1
core/docs.mk

@@ -15,5 +15,5 @@ ifneq ($(SKIP_DEPS),)
 doc-deps:
 else
 doc-deps: $(ALL_DOC_DEPS_DIRS)
-	@for dep in $(ALL_DOC_DEPS_DIRS) ; do $(MAKE) -C $$dep; done
+	$(verbose) for dep in $(ALL_DOC_DEPS_DIRS) ; do $(MAKE) -C $$dep; done
 endif

+ 9 - 9
core/erlc.mk

@@ -77,7 +77,7 @@ ifeq ($(wildcard src/$(PROJECT).app.src),)
 	$(app_verbose) echo $(subst $(newline),,$(subst ",\",$(call app_file,$(GITDESCRIBE),$(MODULES)))) \
 		> ebin/$(PROJECT).app
 else
-	@if [ -z "$$(grep -E '^[^%]*{\s*modules\s*,' src/$(PROJECT).app.src)" ]; then \
+	$(verbose) if [ -z "$$(grep -E '^[^%]*{\s*modules\s*,' src/$(PROJECT).app.src)" ]; then \
 		echo "Empty modules entry not found in $(PROJECT).app.src. Please consult the erlang.mk README for instructions." >&2; \
 		exit 1; \
 	fi
@@ -88,7 +88,7 @@ else
 endif
 
 erlc-include:
-	-@if [ -d ebin/ ]; then \
+	- $(verbose) if [ -d ebin/ ]; then \
 		find include/ src/ -type f -name \*.hrl -newer ebin -exec touch $(shell find src/ -type f -name "*.erl") \; 2>/dev/null || printf ''; \
 	fi
 
@@ -101,14 +101,14 @@ endef
 define compile_xyrl
 	$(xyrl_verbose) erlc -v -o ebin/ $(1)
 	$(xyrl_verbose) erlc $(ERLC_OPTS) -o ebin/ ebin/*.erl
-	@rm ebin/*.erl
+	$(verbose) rm ebin/*.erl
 endef
 
 define compile_asn1
 	$(asn1_verbose) erlc -v -I include/ -o ebin/ $(1)
-	@mv ebin/*.hrl include/
-	@mv ebin/*.asn1db include/
-	@rm ebin/*.erl
+	$(verbose) mv ebin/*.hrl include/
+	$(verbose) mv ebin/*.asn1db include/
+	$(verbose) rm ebin/*.erl
 endef
 
 define compile_mib
@@ -119,17 +119,17 @@ endef
 
 ifneq ($(wildcard src/),)
 ebin/$(PROJECT).app::
-	@mkdir -p ebin/
+	$(verbose) mkdir -p ebin/
 
 ifneq ($(wildcard asn1/),)
 ebin/$(PROJECT).app:: $(sort $(call core_find,asn1/,*.asn1))
-	@mkdir -p include
+	$(verbose) mkdir -p include
 	$(if $(strip $?),$(call compile_asn1,$?))
 endif
 
 ifneq ($(wildcard mibs/),)
 ebin/$(PROJECT).app:: $(sort $(call core_find,mibs/,*.mib))
-	@mkdir -p priv/mibs/ include
+	$(verbose) mkdir -p priv/mibs/ include
 	$(if $(strip $?),$(call compile_mib,$?))
 endif
 

+ 1 - 1
core/index.mk

@@ -4,7 +4,7 @@
 .PHONY: search
 
 define pkg_print
-	@printf "%s\n" \
+	$(verbose) printf "%s\n" \
 		$(if $(call core_eq,$(1),$(pkg_$(1)_name)),,"Pkg name:    $(1)") \
 		"App name:    $(pkg_$(1)_name)" \
 		"Description: $(pkg_$(1)_description)" \

+ 3 - 3
core/test.mk

@@ -20,7 +20,7 @@ ifneq ($(SKIP_DEPS),)
 test-deps:
 else
 test-deps: $(ALL_TEST_DEPS_DIRS)
-	@for dep in $(ALL_TEST_DEPS_DIRS) ; do $(MAKE) -C $$dep; done
+	$(verbose) for dep in $(ALL_TEST_DEPS_DIRS) ; do $(MAKE) -C $$dep; done
 endif
 
 ifneq ($(wildcard $(TEST_DIR)),)
@@ -32,12 +32,12 @@ endif
 ifeq ($(wildcard ebin/test),)
 test-build:: ERLC_OPTS=$(TEST_ERLC_OPTS)
 test-build:: clean deps test-deps
-	@$(MAKE) --no-print-directory app-build test-dir ERLC_OPTS="$(TEST_ERLC_OPTS)"
+	$(verbose) $(MAKE) --no-print-directory app-build test-dir ERLC_OPTS="$(TEST_ERLC_OPTS)"
 	$(gen_verbose) touch ebin/test
 else
 test-build:: ERLC_OPTS=$(TEST_ERLC_OPTS)
 test-build:: deps test-deps
-	@$(MAKE) --no-print-directory app-build test-dir ERLC_OPTS="$(TEST_ERLC_OPTS)"
+	$(verbose) $(MAKE) --no-print-directory app-build test-dir ERLC_OPTS="$(TEST_ERLC_OPTS)"
 endif
 
 clean:: clean-test-dir

+ 6 - 6
plugins/bootstrap.mk

@@ -6,7 +6,7 @@
 # Core targets.
 
 help::
-	@printf "%s\n" "" \
+	$(verbose) printf "%s\n" "" \
 		"Bootstrap targets:" \
 		"  bootstrap          Generate a skeleton of an OTP application" \
 		"  bootstrap-lib      Generate a skeleton of an OTP library" \
@@ -334,7 +334,7 @@ endef
 # Plugin-specific targets.
 
 define render_template
-	@echo "$${_$(1)}" > $(2)
+	$(verbose) echo "$${_$(1)}" > $(2)
 endef
 
 ifndef WS
@@ -354,7 +354,7 @@ ifneq ($(wildcard src/),)
 	$(error Error: src/ directory already exists)
 endif
 	$(call render_template,bs_Makefile,Makefile)
-	@mkdir src/
+	$(verbose) mkdir src/
 	$(call render_template,bs_appsrc,src/$(PROJECT).app.src)
 	$(call render_template,bs_app,src/$(PROJECT)_app.erl)
 	$(eval n := $(PROJECT)_sup)
@@ -365,7 +365,7 @@ ifneq ($(wildcard src/),)
 	$(error Error: src/ directory already exists)
 endif
 	$(call render_template,bs_Makefile,Makefile)
-	@mkdir src/
+	$(verbose) mkdir src/
 	$(call render_template,bs_appsrc_lib,src/$(PROJECT).app.src)
 
 bootstrap-rel:
@@ -376,7 +376,7 @@ ifneq ($(wildcard rel/),)
 	$(error Error: rel/ directory already exists)
 endif
 	$(call render_template,bs_relx_config,relx.config)
-	@mkdir rel/
+	$(verbose) mkdir rel/
 	$(call render_template,bs_sys_config,rel/sys.config)
 	$(call render_template,bs_vm_args,rel/vm.args)
 
@@ -396,4 +396,4 @@ endif
 	$(call render_template,tpl_$(t),src/$(n).erl)
 
 list-templates:
-	@echo Available templates: $(sort $(patsubst tpl_%,%,$(filter tpl_%,$(.VARIABLES))))
+	$(verbose) echo Available templates: $(sort $(patsubst tpl_%,%,$(filter tpl_%,$(.VARIABLES))))

+ 2 - 2
plugins/c_src.mk

@@ -76,7 +76,7 @@ app:: $(C_SRC_ENV) $(C_SRC_OUTPUT)
 test-build:: $(C_SRC_ENV) $(C_SRC_OUTPUT)
 
 $(C_SRC_OUTPUT): $(OBJECTS)
-	@mkdir -p priv/
+	$(verbose) mkdir -p priv/
 	$(link_verbose) $(CC) $(OBJECTS) $(LDFLAGS) $(LDLIBS) -o $(C_SRC_OUTPUT)
 
 %.o: %.c
@@ -100,7 +100,7 @@ endif
 
 ifneq ($(wildcard $(C_SRC_DIR)),)
 $(C_SRC_ENV):
-	@$(ERL) -eval "file:write_file(\"$(C_SRC_ENV)\", \
+	$(verbose) $(ERL) -eval "file:write_file(\"$(C_SRC_ENV)\", \
 		io_lib:format( \
 			\"ERTS_INCLUDE_DIR ?= ~s/erts-~s/include/~n\" \
 			\"ERL_INTERFACE_INCLUDE_DIR ?= ~s~n\" \

+ 3 - 7
plugins/ci.mk

@@ -42,16 +42,12 @@ endef
 
 $(foreach otp,$(CI_OTP),$(eval $(call ci_otp_target,$(otp))))
 
-define kerl_fetch
-	$(call core_http_get,$(KERL),$(KERL_URL))
-	chmod +x $(KERL)
-endef
-
 $(KERL):
-	@$(call kerl_fetch)
+	$(gen_verbose) $(call core_http_get,$(KERL),$(KERL_URL))
+	$(verbose) chmod +x $(KERL)
 
 help::
-	@printf "%s\n" "" \
+	$(verbose) printf "%s\n" "" \
 		"Continuous Integration targets:" \
 		"  ci          Run '$(MAKE) tests' on all configured Erlang versions." \
 		"" \

+ 3 - 3
plugins/cover.mk

@@ -13,7 +13,7 @@ COVER_MODS = $(notdir $(basename $(call core_ls,ebin/*.beam)))
 test-build:: $(TEST_DIR)/ct.cover.spec
 
 $(TEST_DIR)/ct.cover.spec:
-	@echo Cover mods: $(COVER_MODS)
+	$(verbose) echo Cover mods: $(COVER_MODS)
 	$(gen_verbose) printf "%s\n" \
 		'{incl_mods,[$(subst $(space),$(comma),$(COVER_MODS))]}.' \
 		'{export,"$(CURDIR)/ct.coverdata"}.' > $@
@@ -27,7 +27,7 @@ endif
 ifdef COVER
 ifneq ($(COVER_REPORT_DIR),)
 tests::
-	@$(MAKE) --no-print-directory cover-report
+	$(verbose) $(MAKE) --no-print-directory cover-report
 endif
 endif
 
@@ -38,7 +38,7 @@ distclean:: cover-report-clean
 endif
 
 help::
-	@printf "%s\n" "" \
+	$(verbose) printf "%s\n" "" \
 		"Cover targets:" \
 		"  cover-report  Generate a HTML coverage report from previously collected" \
 		"                cover data." \

+ 3 - 3
plugins/ct.mk

@@ -19,7 +19,7 @@ tests:: ct
 distclean:: distclean-ct
 
 help::
-	@printf "%s\n" "" \
+	$(verbose) printf "%s\n" "" \
 		"Common_test targets:" \
 		"  ct          Run all the common_test suites for this project" \
 		"" \
@@ -39,13 +39,13 @@ ifeq ($(CT_SUITES),)
 ct:
 else
 ct: test-build
-	@mkdir -p $(CURDIR)/logs/
+	$(verbose) mkdir -p $(CURDIR)/logs/
 	$(gen_verbose) $(CT_RUN) -suite $(addsuffix _SUITE,$(CT_SUITES)) $(CT_OPTS)
 endif
 
 define ct_suite_target
 ct-$(1): test-build
-	@mkdir -p $(CURDIR)/logs/
+	$(verbose) mkdir -p $(CURDIR)/logs/
 	$(gen_verbose) $(CT_RUN) -suite $(addsuffix _SUITE,$(1)) $(CT_OPTS)
 endef
 

+ 3 - 3
plugins/dialyzer.mk

@@ -20,7 +20,7 @@ check:: dialyze
 distclean:: distclean-plt
 
 help::
-	@printf "%s\n" "" \
+	$(verbose) printf "%s\n" "" \
 		"Dialyzer targets:" \
 		"  plt         Build a PLT file for this project" \
 		"  dialyze     Analyze the project using Dialyzer"
@@ -28,7 +28,7 @@ help::
 # Plugin-specific targets.
 
 $(DIALYZER_PLT): deps app
-	@dialyzer --build_plt --apps erts kernel stdlib $(PLT_APPS) $(OTP_DEPS) $(ALL_DEPS_DIRS)
+	$(verbose) dialyzer --build_plt --apps erts kernel stdlib $(PLT_APPS) $(OTP_DEPS) $(ALL_DEPS_DIRS)
 
 plt: $(DIALYZER_PLT)
 
@@ -40,4 +40,4 @@ dialyze:
 else
 dialyze: $(DIALYZER_PLT)
 endif
-	@dialyzer --no_native $(DIALYZER_DIRS) $(DIALYZER_OPTS)
+	$(verbose) dialyzer --no_native $(DIALYZER_DIRS) $(DIALYZER_OPTS)

+ 5 - 5
plugins/elvis.mk

@@ -17,7 +17,7 @@ ELVIS_OPTS ?=
 # Core targets.
 
 help::
-	@printf "%s\n" "" \
+	$(verbose) printf "%s\n" "" \
 		"Elvis targets:" \
 		"  elvis       Run Elvis using the local elvis.config or download the default otherwise"
 
@@ -26,14 +26,14 @@ distclean:: distclean-elvis
 # Plugin-specific targets.
 
 $(ELVIS):
-	@$(call core_http_get,$(ELVIS),$(ELVIS_URL))
-	@chmod +x $(ELVIS)
+	$(gen_verbose) $(call core_http_get,$(ELVIS),$(ELVIS_URL))
+	$(verbose) chmod +x $(ELVIS)
 
 $(ELVIS_CONFIG):
-	@$(call core_http_get,$(ELVIS_CONFIG),$(ELVIS_CONFIG_URL))
+	$(verbose) $(call core_http_get,$(ELVIS_CONFIG),$(ELVIS_CONFIG_URL))
 
 elvis: $(ELVIS) $(ELVIS_CONFIG)
-	@$(ELVIS) rock -c $(ELVIS_CONFIG) $(ELVIS_OPTS)
+	$(verbose) $(ELVIS) rock -c $(ELVIS_CONFIG) $(ELVIS_OPTS)
 
 distclean-elvis:
 	$(gen_verbose) rm -rf $(ELVIS)

+ 1 - 1
plugins/escript.mk

@@ -21,7 +21,7 @@ ESCRIPT_STATIC ?= "deps/*/priv/**", "priv/**"
 distclean:: distclean-escript
 
 help::
-	@printf "%s\n" "" \
+	$(verbose) printf "%s\n" "" \
 		"Escript targets:" \
 		"  escript     Build an executable escript archive" \
 

+ 1 - 1
plugins/eunit.mk

@@ -13,7 +13,7 @@ EUNIT_OPTS ?=
 tests:: eunit
 
 help::
-	@printf "%s\n" "" \
+	$(verbose) printf "%s\n" "" \
 		"EUnit targets:" \
 		"  eunit       Run all the EUnit tests for this project"
 

+ 2 - 2
plugins/protobuffs.mk

@@ -9,10 +9,10 @@ proto_verbose = $(proto_verbose_$(V))
 # Core targets.
 
 define compile_proto
-	@mkdir -p ebin/ include/
+	$(verbose) mkdir -p ebin/ include/
 	$(proto_verbose) $(call erlang,$(call compile_proto.erl,$(1)))
 	$(proto_verbose) erlc +debug_info -o ebin/ ebin/*.erl
-	@rm ebin/*.erl
+	$(verbose) rm ebin/*.erl
 endef
 
 define compile_proto.erl

+ 5 - 9
plugins/relx.mk

@@ -32,16 +32,12 @@ distclean:: distclean-relx-rel distclean-relx
 
 # Plugin-specific targets.
 
-define relx_fetch
-	$(call core_http_get,$(RELX),$(RELX_URL))
-	chmod +x $(RELX)
-endef
-
 $(RELX):
-	@$(call relx_fetch)
+	$(gen_verbose) $(call core_http_get,$(RELX),$(RELX_URL))
+	$(verbose) chmod +x $(RELX)
 
 relx-rel: $(RELX)
-	@$(RELX) -c $(RELX_CONFIG) $(RELX_OPTS)
+	$(verbose) $(RELX) -c $(RELX_CONFIG) $(RELX_OPTS)
 
 distclean-relx-rel:
 	$(gen_verbose) rm -rf $(RELX_OUTPUT_DIR)
@@ -65,10 +61,10 @@ endef
 RELX_RELEASE = `$(call erlang,$(get_relx_release.erl))`
 
 run: all
-	@$(RELX_OUTPUT_DIR)/$(RELX_RELEASE)/bin/$(RELX_RELEASE) console
+	$(verbose) $(RELX_OUTPUT_DIR)/$(RELX_RELEASE)/bin/$(RELX_RELEASE) console
 
 help::
-	@printf "%s\n" "" \
+	$(verbose) printf "%s\n" "" \
 		"Relx targets:" \
 		"  run         Compile the project, build the release and run it"
 

+ 2 - 2
plugins/shell.mk

@@ -13,7 +13,7 @@ ALL_SHELL_DEPS_DIRS = $(addprefix $(DEPS_DIR)/,$(SHELL_DEPS))
 # Core targets
 
 help::
-	@printf "%s\n" "" \
+	$(verbose) printf "%s\n" "" \
 		"Shell targets:" \
 		"  shell       Run an erlang shell with SHELL_OPTS or reasonable default"
 
@@ -22,7 +22,7 @@ help::
 $(foreach dep,$(SHELL_DEPS),$(eval $(call dep_target,$(dep))))
 
 build-shell-deps: $(ALL_SHELL_DEPS_DIRS)
-	@for dep in $(ALL_SHELL_DEPS_DIRS) ; do $(MAKE) -C $$dep ; done
+	$(verbose) for dep in $(ALL_SHELL_DEPS_DIRS) ; do $(MAKE) -C $$dep ; done
 
 shell: build-shell-deps
 	$(gen_verbose) erl $(SHELL_PATH) $(SHELL_OPTS)

+ 3 - 3
plugins/triq.mk

@@ -28,11 +28,11 @@ endef
 ifdef t
 ifeq (,$(findstring :,$(t)))
 triq: test-build
-	@$(call erlang,$(call triq_check.erl,module,$(t)))
+	$(verbose) $(call erlang,$(call triq_check.erl,module,$(t)))
 else
 triq: test-build
-	@echo Testing $(t)/0
-	@$(call erlang,$(call triq_check.erl,function,$(t)()))
+	$(verbose) echo Testing $(t)/0
+	$(verbose) $(call erlang,$(call triq_check.erl,function,$(t)()))
 endif
 else
 triq: test-build

+ 3 - 3
plugins/xref.mk

@@ -19,7 +19,7 @@ XREFR_URL ?= https://github.com/inaka/xref_runner/releases/download/0.2.2/xrefr
 # Core targets.
 
 help::
-	@printf "%s\n" "" \
+	$(verbose) printf "%s\n" "" \
 		"Xref targets:" \
 		"  xref        Run Xrefr using $XREF_CONFIG as config file if defined"
 
@@ -28,8 +28,8 @@ distclean:: distclean-xref
 # Plugin-specific targets.
 
 $(XREFR):
-	@$(call core_http_get,$(XREFR),$(XREFR_URL))
-	@chmod +x $(XREFR)
+	$(gen_verbose) $(call core_http_get,$(XREFR),$(XREFR_URL))
+	$(verbose) chmod +x $(XREFR)
 
 xref: deps app $(XREFR)
 	$(gen_verbose) $(XREFR) $(XREFR_ARGS)