unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
* [PATCH] RFC: quiet make
@ 2009-11-20 13:18 Mikhail Gusarov
  2009-11-21 13:16 ` Carl Worth
  0 siblings, 1 reply; 3+ messages in thread
From: Mikhail Gusarov @ 2009-11-20 13:18 UTC (permalink / raw)
  To: notmuch

I don't entirely like duplicating every command line in makefile,
so this patch is RFC. Someone with bigger Make-fu than mine probably
knows a better way.

Signed-off-by: Mikhail Gusarov <dottedmag@dottedmag.net>
---
 Makefile           |   36 ++++++++++++++++++++++++++++++++++++
 Makefile.local     |   10 ++++++++++
 lib/Makefile.local |    5 +++++
 3 files changed, 51 insertions(+), 0 deletions(-)

diff --git a/Makefile b/Makefile
index b6861e9..72a72ae 100644
--- a/Makefile
+++ b/Makefile
@@ -32,29 +32,65 @@ include lib/Makefile.local
 include Makefile.config
 
 %.o: %.cc $(all_deps)
+ifeq ($(V),1)
 	$(CXX) -c $(CFLAGS) $(CXXFLAGS) $< -o $@
+else
+	@echo CXX $<
+	@$(CXX) -c $(CFLAGS) $(CXXFLAGS) $< -o $@
+endif
 
 %.o: %.c $(all_deps)
+ifeq ($(V),1)
 	$(CC) -c $(CFLAGS) $< -o $@
+else
+	@echo CC $<
+	@$(CC) -c $(CFLAGS) $< -o $@
+endif
 
 %.elc: %.el
+ifeq ($(V),1)
 	emacs -batch -f batch-byte-compile $<
+else
+	@echo ELCOMPILE $<
+	@emacs -batch -f batch-byte-compile $<
+endif
 
 .deps/%.d: %.c $(all_deps)
+ifeq ($(V),1)
+	set -e; rm -f $@; mkdir -p $$(dirname $@) ; \
+	$(CC) -M $(CPPFLAGS) $(CFLAGS) $< > $@.$$$$; \
+	sed 's,'$$(basename $*)'\.o[ :]*,$*.o $@ : ,g' < $@.$$$$ > $@; \
+	rm -f $@.$$$$
+else
+	@echo DEPCXX $<
 	@set -e; rm -f $@; mkdir -p $$(dirname $@) ; \
 	$(CC) -M $(CPPFLAGS) $(CFLAGS) $< > $@.$$$$; \
 	sed 's,'$$(basename $*)'\.o[ :]*,$*.o $@ : ,g' < $@.$$$$ > $@; \
 	rm -f $@.$$$$
+endif
 
 .deps/%.d: %.cc $(all_deps)
+ifeq ($(V),1)
+	set -e; rm -f $@; mkdir -p $$(dirname $@) ; \
+	$(CXX) -M $(CPPFLAGS) $(CXXFLAGS) $< > $@.$$$$; \
+	sed 's,'$$(basename $*)'\.o[ :]*,$*.o $@ : ,g' < $@.$$$$ > $@; \
+	rm -f $@.$$$$
+else
+	@echo DEPCC $<
 	@set -e; rm -f $@; mkdir -p $$(dirname $@) ; \
 	$(CXX) -M $(CPPFLAGS) $(CXXFLAGS) $< > $@.$$$$; \
 	sed 's,'$$(basename $*)'\.o[ :]*,$*.o $@ : ,g' < $@.$$$$ > $@; \
 	rm -f $@.$$$$
+endif
 
 DEPS := $(SRCS:%.c=.deps/%.d)
 DEPS := $(DEPS:%.cc=.deps/%.d)
 -include $(DEPS)
 
 clean:
+ifeq ($(V),1)
 	rm -f $(CLEAN); rm -rf .deps
+else
+	@echo CLEAN
+	@rm -f $(CLEAN); rm -rf .deps
+endif
diff --git a/Makefile.local b/Makefile.local
index bf81c03..0addfed 100644
--- a/Makefile.local
+++ b/Makefile.local
@@ -20,10 +20,20 @@ notmuch_client_srcs =		\
 
 notmuch_client_modules = $(notmuch_client_srcs:.c=.o)
 notmuch: $(notmuch_client_modules) lib/notmuch.a
+ifeq ($(V),1)
 	$(CXX) $^ $(LDFLAGS) -o $@
+else
+	@echo LINK $^
+	@$(CXX) $^ $(LDFLAGS) -o $@
+endif
 
 notmuch.1.gz: notmuch.1
+ifeq ($(V),1)
 	gzip --stdout notmuch.1 > notmuch.1.gz
+else
+	@echo GZIP $<
+	@gzip --stdout notmuch.1 > notmuch.1.gz
+endif
 
 install: all notmuch.1.gz
 	for d in $(DESTDIR)$(prefix)/bin/ $(DESTDIR)$(prefix)/share/man/man1 \
diff --git a/lib/Makefile.local b/lib/Makefile.local
index 79f7b0b..5a66716 100644
--- a/lib/Makefile.local
+++ b/lib/Makefile.local
@@ -18,7 +18,12 @@ libnotmuch_cxx_srcs =		\
 
 libnotmuch_modules = $(libnotmuch_c_srcs:.c=.o) $(libnotmuch_cxx_srcs:.cc=.o)
 $(dir)/notmuch.a: $(libnotmuch_modules)
+ifeq ($(V),1)
 	$(AR) rcs $@ $^
+else
+	@echo AR $^
+	@$(AR) rcs $@ $^
+endif
 
 SRCS  := $(SRCS) $(libnotmuch_c_srcs) $(libnotmuch_cxx_srcs)
 CLEAN := $(CLEAN) $(libnotmuch_modules) $(dir)/notmuch.a
-- 
1.6.3.3

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] RFC: quiet make
  2009-11-20 13:18 [PATCH] RFC: quiet make Mikhail Gusarov
@ 2009-11-21 13:16 ` Carl Worth
  2009-11-21 13:21   ` Mikhail Gusarov
  0 siblings, 1 reply; 3+ messages in thread
From: Carl Worth @ 2009-11-21 13:16 UTC (permalink / raw)
  To: Mikhail Gusarov, notmuch

On Fri, 20 Nov 2009 19:18:27 +0600, Mikhail Gusarov <dottedmag@dottedmag.net> wrote:
> I don't entirely like duplicating every command line in makefile,
> so this patch is RFC. Someone with bigger Make-fu than mine probably
> knows a better way.

Hi Mikhail,

Getting a quieter compile out is a great idea.

But, you're right that duplicating the command line invocations is a
problem. That sets up a fragile system where we'll end up with "make"
and "make V=1" actually doing different things.

Meanwhile, the feature I've always wanted with systems like this is to
document to the user that there's the possibility of adding a "V=1" to
the command line to get the full output.

Fortunately, I'm sitting next to Chris Wilson right now, and I know that
all I need to do is to mention the idea to him, and he'll give us a
solution that doesn't duplicate the commands, documents V=1, and will
just be a tiny change to our Makefiles.

-Carl

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] RFC: quiet make
  2009-11-21 13:16 ` Carl Worth
@ 2009-11-21 13:21   ` Mikhail Gusarov
  0 siblings, 0 replies; 3+ messages in thread
From: Mikhail Gusarov @ 2009-11-21 13:21 UTC (permalink / raw)
  To: notmuch, Chris Wilson

[-- Attachment #1: Type: text/plain, Size: 583 bytes --]


Twas brillig at 14:16:52 21.11.2009 UTC+01 when cworth@cworth.org did gyre and gimble:

 CW> Meanwhile, the feature I've always wanted with systems like this is
 CW> to document to the user that there's the possibility of adding a
 CW> "V=1" to the command line to get the full output.

I have had another idea in mind which might be useful: a "header" for
silent make mode which explains what commands are run exactly, including
placeholders like $@ $^, so it is not necessary to run with make V=1 to
figure out what's going on.

-- 
  http://fossarchy.blogspot.com/

[-- Attachment #2: Type: application/pgp-signature, Size: 834 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2009-11-21 13:21 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-11-20 13:18 [PATCH] RFC: quiet make Mikhail Gusarov
2009-11-21 13:16 ` Carl Worth
2009-11-21 13:21   ` Mikhail Gusarov

Code repositories for project(s) associated with this public inbox

	https://yhetil.org/notmuch.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).