1 Return-Path: <chris@chris-wilson.co.uk>
\r
2 X-Original-To: notmuch@notmuchmail.org
\r
3 Delivered-To: notmuch@notmuchmail.org
\r
4 Received: from localhost (localhost [127.0.0.1])
\r
5 by olra.theworths.org (Postfix) with ESMTP id B817B431FBC
\r
6 for <notmuch@notmuchmail.org>; Sat, 21 Nov 2009 12:32:34 -0800 (PST)
\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org
\r
8 Received: from olra.theworths.org ([127.0.0.1])
\r
9 by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)
\r
10 with ESMTP id WpoVsXZXfjAQ for <notmuch@notmuchmail.org>;
\r
11 Sat, 21 Nov 2009 12:32:32 -0800 (PST)
\r
12 Received: from orsmga101.jf.intel.com (mga06.intel.com [134.134.136.21])
\r
13 by olra.theworths.org (Postfix) with ESMTP id 7007E431FAE
\r
14 for <notmuch@notmuchmail.org>; Sat, 21 Nov 2009 12:32:32 -0800 (PST)
\r
15 Received: from orsmga002.jf.intel.com ([10.7.209.21])
\r
16 by orsmga101.jf.intel.com with ESMTP; 21 Nov 2009 12:32:24 -0800
\r
18 X-IronPort-AV: E=Sophos;i="4.47,264,1257148800"; d="scan'208";a="469406063"
\r
19 Received: from unknown (HELO localhost.localdomain) ([10.255.16.192])
\r
20 by orsmga002.jf.intel.com with ESMTP; 21 Nov 2009 12:49:33 -0800
\r
21 From: Chris Wilson <chris@chris-wilson.co.uk>
\r
22 To: notmuch@notmuchmail.org
\r
23 Date: Sat, 21 Nov 2009 20:32:20 +0000
\r
24 Message-Id: <1258835540-21094-1-git-send-email-chris@chris-wilson.co.uk>
\r
25 X-Mailer: git-send-email 1.6.5.3
\r
26 In-Reply-To: <87my2fpty1.fsf@vertex.dottedmag>
\r
27 References: <87my2fpty1.fsf@vertex.dottedmag>
\r
28 Subject: [notmuch] [PATCH] Makefile: Magic silent rules.
\r
29 X-BeenThere: notmuch@notmuchmail.org
\r
30 X-Mailman-Version: 2.1.12
\r
32 List-Id: "Use and development of the notmuch mail system."
\r
33 <notmuch.notmuchmail.org>
\r
34 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
35 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
36 List-Archive: <http://notmuchmail.org/pipermail/notmuch>
\r
37 List-Post: <mailto:notmuch@notmuchmail.org>
\r
38 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
39 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
40 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
41 X-List-Received-Date: Sat, 21 Nov 2009 20:32:34 -0000
\r
43 Use the facilities of GNU make to create a magic function that will
\r
44 on the first invocation print a description of how to enable verbose
\r
45 compile lines and then print the quiet rule.
\r
47 Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
\r
48 Signed-off-by: Carl Worth <cworth@cworth.org>
\r
49 Cc: Mikhail Gusarov <dottedmag@dottedmag.net>
\r
51 [ickle: Rebased, and duplicate command string eliminated.]
\r
52 [ickle: Fixed verbose bug pointed out by Mikhail]
\r
54 Makefile | 23 ++++++++++++++++++++---
\r
55 Makefile.local | 4 ++--
\r
56 lib/Makefile.local | 2 +-
\r
57 3 files changed, 23 insertions(+), 6 deletions(-)
\r
59 diff --git a/Makefile b/Makefile
\r
60 index 3fedcf1..5d8f321 100644
\r
64 WARN_FLAGS=-Wall -Wextra -Wmissing-declarations -Wwrite-strings -Wswitch-enum
\r
67 +# Additional programs that are used during the compilation process.
\r
71 # Additional flags that we will append to whatever the user set.
\r
72 # These aren't intended for the user to manipulate.
\r
73 extra_cflags := $(shell pkg-config --cflags glib-2.0 gmime-2.4 talloc)
\r
74 @@ -31,14 +35,27 @@ include lib/Makefile.local
\r
75 # And get user settings from the output of configure
\r
76 include Makefile.config
\r
78 +# The user has not set any verbosity, default to quiet mode and inform the
\r
79 +# user how to enable verbose compiles.
\r
81 +quiet_DOC := "Use \"$(MAKE) V=1\" to see the verbose compile lines.\n"
\r
82 +quiet = @echo $(quiet_DOC)$(eval quiet_DOC:=)" $1 $@"; $($1)
\r
84 +# The user has explicitly enabled quiet compilation.
\r
86 +quiet = @echo " $1 $@"; $($1)
\r
88 +# Otherwise, print the full command line.
\r
91 %.o: %.cc $(all_deps)
\r
92 - $(CXX) -c $(CXXFLAGS) $< -o $@
\r
93 + $(call quiet,CXX) -c $(CXXFLAGS) $< -o $@
\r
95 %.o: %.c $(all_deps)
\r
96 - $(CC) -c $(CFLAGS) $< -o $@
\r
97 + $(call quiet,CC) -c $(CFLAGS) $< -o $@
\r
100 - emacs -batch -f batch-byte-compile $<
\r
101 + $(call quiet,EMACS) -batch -f batch-byte-compile $<
\r
103 .deps/%.d: %.c $(all_deps)
\r
104 @set -e; rm -f $@; mkdir -p $$(dirname $@) ; \
\r
105 diff --git a/Makefile.local b/Makefile.local
\r
106 index 3c99624..5fd5d4f 100644
\r
107 --- a/Makefile.local
\r
108 +++ b/Makefile.local
\r
109 @@ -20,10 +20,10 @@ notmuch_client_srcs = \
\r
111 notmuch_client_modules = $(notmuch_client_srcs:.c=.o)
\r
112 notmuch: $(notmuch_client_modules) lib/notmuch.a
\r
113 - $(CXX) $^ $(LDFLAGS) -o $@
\r
114 + $(call quiet,CXX) $^ $(LDFLAGS) -o $@
\r
116 notmuch.1.gz: notmuch.1
\r
117 - gzip --stdout notmuch.1 > notmuch.1.gz
\r
118 + $(call quiet,GZIP) --stdout $^ > $@
\r
120 install: all notmuch.1.gz
\r
121 for d in $(DESTDIR)$(prefix)/bin/ $(DESTDIR)$(prefix)/share/man/man1 \
\r
122 diff --git a/lib/Makefile.local b/lib/Makefile.local
\r
123 index 79f7b0b..a7562c9 100644
\r
124 --- a/lib/Makefile.local
\r
125 +++ b/lib/Makefile.local
\r
126 @@ -18,7 +18,7 @@ libnotmuch_cxx_srcs = \
\r
128 libnotmuch_modules = $(libnotmuch_c_srcs:.c=.o) $(libnotmuch_cxx_srcs:.cc=.o)
\r
129 $(dir)/notmuch.a: $(libnotmuch_modules)
\r
131 + $(call quiet,AR) rcs $@ $^
\r
133 SRCS := $(SRCS) $(libnotmuch_c_srcs) $(libnotmuch_cxx_srcs)
\r
134 CLEAN := $(CLEAN) $(libnotmuch_modules) $(dir)/notmuch.a
\r