[notmuch] [PATCH] RFC: quiet make
Mikhail Gusarov
dottedmag at dottedmag.net
Fri Nov 20 05:18:27 PST 2009
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 at 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
More information about the notmuch
mailing list