[notmuch] [PATCH] Makefile: Magic silent rules.
authorChris Wilson <chris@chris-wilson.co.uk>
Sat, 21 Nov 2009 19:02:22 +0000 (19:02 +0000)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:35:38 +0000 (09:35 -0800)
04/abcc89bdbecd1cabd53786afbad07227b1d7d1 [new file with mode: 0644]

diff --git a/04/abcc89bdbecd1cabd53786afbad07227b1d7d1 b/04/abcc89bdbecd1cabd53786afbad07227b1d7d1
new file mode 100644 (file)
index 0000000..cade3ca
--- /dev/null
@@ -0,0 +1,131 @@
+Return-Path: <chris@chris-wilson.co.uk>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+       by olra.theworths.org (Postfix) with ESMTP id BF42E431FC0\r
+       for <notmuch@notmuchmail.org>; Sat, 21 Nov 2009 11:02:28 -0800 (PST)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+Received: from olra.theworths.org ([127.0.0.1])\r
+       by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
+       with ESMTP id 7KscHBcn0qvN for <notmuch@notmuchmail.org>;\r
+       Sat, 21 Nov 2009 11:02:27 -0800 (PST)\r
+Received: from orsmga101.jf.intel.com (mga06.intel.com [134.134.136.21])\r
+       by olra.theworths.org (Postfix) with ESMTP id 8B395431FAE\r
+       for <notmuch@notmuchmail.org>; Sat, 21 Nov 2009 11:02:27 -0800 (PST)\r
+Received: from orsmga001.jf.intel.com ([10.7.209.18])\r
+       by orsmga101.jf.intel.com with ESMTP; 21 Nov 2009 11:02:19 -0800\r
+X-ExtLoop1: 1\r
+X-IronPort-AV: E=Sophos;i="4.47,264,1257148800"; d="scan'208";a="571844771"\r
+Received: from unknown (HELO localhost.localdomain) ([10.255.16.192])\r
+       by orsmga001.jf.intel.com with ESMTP; 21 Nov 2009 11:02:15 -0800\r
+From: Chris Wilson <chris@chris-wilson.co.uk>\r
+To: notmuch@notmuchmail.org\r
+Date: Sat, 21 Nov 2009 19:02:22 +0000\r
+Message-Id: <1258830142-13311-1-git-send-email-chris@chris-wilson.co.uk>\r
+X-Mailer: git-send-email 1.6.5.3\r
+Subject: [notmuch] [PATCH] Makefile: Magic silent rules.\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.12\r
+Precedence: list\r
+List-Id: "Use and development of the notmuch mail system."\r
+       <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
+List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
+List-Post: <mailto:notmuch@notmuchmail.org>\r
+List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
+List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Sat, 21 Nov 2009 19:02:28 -0000\r
+\r
+Use the facilities of GNU make to create a magic function that will\r
+on the first invocation print a description of how to enable verbose\r
+compile lines and then print the quiet rule.\r
+\r
+Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>\r
+Signed-off-by: Carl Worth <cworth@cworth.org>\r
+Cc: Mikhail Gusarov <dottedmag@dottedmag.net>\r
+---\r
+ Makefile           |   22 +++++++++++++++++++---\r
+ Makefile.local     |    4 ++--\r
+ lib/Makefile.local |    2 +-\r
+ 3 files changed, 22 insertions(+), 6 deletions(-)\r
+\r
+diff --git a/Makefile b/Makefile\r
+index 3fedcf1..77e70ed 100644\r
+--- a/Makefile\r
++++ b/Makefile\r
+@@ -2,6 +2,10 @@\r
+ WARN_FLAGS=-Wall -Wextra -Wmissing-declarations -Wwrite-strings -Wswitch-enum\r
+ CFLAGS=-O2\r
\r
++# Additional programs that are used during the compilation process.\r
++EMACS ?= emacs\r
++GZIP ?= gzip\r
++\r
+ # Additional flags that we will append to whatever the user set.\r
+ # These aren't intended for the user to manipulate.\r
+ extra_cflags := $(shell pkg-config --cflags glib-2.0 gmime-2.4 talloc)\r
+@@ -31,14 +35,26 @@ include lib/Makefile.local\r
+ # And get user settings from the output of configure\r
+ include Makefile.config\r
\r
++# The user has not set any verbosity, default to quiet mode and inform the\r
++# user how to enable verbose compiles.\r
++ifeq ($(V),)\r
++quiet_DOC := "Use \"$(MAKE) V=1\" to see the verbose compile lines.\n"\r
++quiet = @echo $(quiet_DOC)$(eval quiet_DOC:=)"  $1    $@"; $($1)\r
++endif\r
++# The user has explicitly enabled quiet compilation.\r
++ifeq ($(V),0)\r
++quiet = @echo "  $1   $@"; $($1)\r
++endif\r
++# Otherwise, print the full command line.\r
++\r
+ %.o: %.cc $(all_deps)\r
+-      $(CXX) -c $(CXXFLAGS) $< -o $@\r
++      $(call quiet,CXX) -c $(CXXFLAGS) $< -o $@\r
\r
+ %.o: %.c $(all_deps)\r
+-      $(CC) -c $(CFLAGS) $< -o $@\r
++      $(call quiet,CC) -c $(CFLAGS) $< -o $@\r
\r
+ %.elc: %.el\r
+-      emacs -batch -f batch-byte-compile $<\r
++      $(call quiet,EMACS) -batch -f batch-byte-compile $<\r
\r
+ .deps/%.d: %.c $(all_deps)\r
+       @set -e; rm -f $@; mkdir -p $$(dirname $@) ; \\r
+diff --git a/Makefile.local b/Makefile.local\r
+index 3c99624..5fd5d4f 100644\r
+--- a/Makefile.local\r
++++ b/Makefile.local\r
+@@ -20,10 +20,10 @@ notmuch_client_srcs =              \\r
\r
+ notmuch_client_modules = $(notmuch_client_srcs:.c=.o)\r
+ notmuch: $(notmuch_client_modules) lib/notmuch.a\r
+-      $(CXX) $^ $(LDFLAGS) -o $@\r
++      $(call quiet,CXX) $^ $(LDFLAGS) -o $@\r
\r
+ notmuch.1.gz: notmuch.1\r
+-      gzip --stdout notmuch.1 > notmuch.1.gz\r
++      $(call quiet,GZIP) --stdout $^ > $@\r
\r
+ install: all notmuch.1.gz\r
+       for d in $(DESTDIR)$(prefix)/bin/ $(DESTDIR)$(prefix)/share/man/man1 \\r
+diff --git a/lib/Makefile.local b/lib/Makefile.local\r
+index 79f7b0b..a7562c9 100644\r
+--- a/lib/Makefile.local\r
++++ b/lib/Makefile.local\r
+@@ -18,7 +18,7 @@ libnotmuch_cxx_srcs =                \\r
\r
+ libnotmuch_modules = $(libnotmuch_c_srcs:.c=.o) $(libnotmuch_cxx_srcs:.cc=.o)\r
+ $(dir)/notmuch.a: $(libnotmuch_modules)\r
+-      $(AR) rcs $@ $^\r
++      $(call quiet,AR) rcs $@ $^\r
\r
+ SRCS  := $(SRCS) $(libnotmuch_c_srcs) $(libnotmuch_cxx_srcs)\r
+ CLEAN := $(CLEAN) $(libnotmuch_modules) $(dir)/notmuch.a\r
+-- \r
+1.6.5.3\r
+\r