From: Mark Wooding Date: Tue, 31 May 2011 20:44:41 +0000 (+0100) Subject: Makefie: Give the main build the silent treatment. X-Git-Url: https://git.distorted.org.uk/~mdw/firewall/commitdiff_plain/5a4a2cdeaff3804484a3404179dd309c43040bf6?ds=sidebyside Makefie: Give the main build the silent treatment. --- diff --git a/Makefile b/Makefile index 7fff00d..242bbfd 100644 --- a/Makefile +++ b/Makefile @@ -35,6 +35,30 @@ default: all .PHONY: default ###-------------------------------------------------------------------------- +### Clever silent-rules stuff. + +## Verbosity switch. +V = 0 + +## Suppressing command output. +V_AT = $(V_AT_$V) +V_AT_0 = @ +V_AT_1 = + +## Replacing them with messages. +v_echo = $(call v_echo_$V,$1) +v_echo_0 = @printf " %-6s %s\n" "$1" "$@"; +v_echo_1 = + +## Hacking. +empty = +space = $(empty) $(empty) + +## Specific commands. +V_M4 = $(call v_echo,M4)m4 -P$(space) +V_GEN = $(call v_echo,GEN) + +###-------------------------------------------------------------------------- ### Local configuration. ## Should set up HOSTS and add stuff to MAIN_M4_SOURCES if necessary. Feel @@ -70,9 +94,8 @@ all: $(TARGETS) .PHONY: all %.sh: %.m4 $(M4_SOURCES) - m4 -P base.m4 $*.m4 $(MAIN_M4_SOURCES) >$@.new - chmod +x $@.new - mv $@.new $@ + $(V_M4)base.m4 $*.m4 $(MAIN_M4_SOURCES) >$@.new + $(V_AT)chmod +x $@.new && mv $@.new $@ clean:; rm -f $(TARGETS) *.new .PHONY: clean