chiark / gitweb /
Makefie: Give the main build the silent treatment.
authorMark Wooding <mdw@distorted.org.uk>
Tue, 31 May 2011 20:44:41 +0000 (21:44 +0100)
committerMark Wooding <mdw@distorted.org.uk>
Tue, 31 May 2011 20:44:41 +0000 (21:44 +0100)
Makefile

index 7fff00d51ef0aa9d9fb973822f714ec9ed2e9dfb..242bbfdd4bfc485379b310df9f7dbdd47ef18a39 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -34,6 +34,30 @@ SCRIPTS                       =
 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.
 
@@ -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