[notmuch] [PATCH] libtoolize notmuch.
Ben Gamari
bgamari.foss at gmail.com
Fri Jan 15 20:28:55 PST 2010
Here is a patch based on quad's libtool branch rebased on current master. It
has been tested and verified to work on my machine
---
Makefile | 27 ++++++++++++++++-----------
Makefile.local | 12 ++++++++----
lib/Makefile.local | 8 ++++----
3 files changed, 28 insertions(+), 19 deletions(-)
diff --git a/Makefile b/Makefile
index 021fdb8..9022a39 100644
--- a/Makefile
+++ b/Makefile
@@ -3,6 +3,10 @@ WARN_CFLAGS=$(WARN_CXXFLAGS) -Wmissing-declarations
# Additional programs that are used during the compilation process.
EMACS ?= emacs
+libtool = libtool
+# Needed so libtool replaces parameters in a modern fashion.
+CC = gcc
+CXX = g++
# Lowercase to avoid clash with GZIP environment variable for passing
# arguments to gzip.
gzip = gzip
@@ -43,34 +47,35 @@ include Makefile.local
# user how to enable verbose compiles.
ifeq ($(V),)
quiet_DOC := "Use \"$(MAKE) V=1\" to see the verbose compile lines.\n"
-quiet = @printf $(quiet_DOC)$(eval quiet_DOC:=)" $1 $2 $@\n"; $($1)
+V = 0
endif
# The user has explicitly enabled quiet compilation.
ifeq ($(V),0)
-quiet = @printf " $1 $@\n"; $($1)
+quiet = @printf $(quiet_DOC)$(eval quiet_DOC:=)" $1 $2 $@\n"; $($1)
+libtool += --silent
endif
# Otherwise, print the full command line.
quiet ?= $($1)
-%.o: %.cc $(all_deps)
- $(call quiet,CXX,$(CXXFLAGS)) -c $(FINAL_CXXFLAGS) $< -o $@
+%.lo: %.cc $(all_deps)
+ $(call quiet,libtool,$(CXXFLAGS)) --mode=compile $(CXX) -c $(FINAL_CXXFLAGS) $< -o $@
-%.o: %.c $(all_deps)
- $(call quiet,CC,$(CFLAGS)) -c $(FINAL_CFLAGS) $< -o $@
+%.lo: %.c $(all_deps)
+ $(call quiet,libtool,$(CFLAGS)) --mode=compile $(CC) -c $(FINAL_CFLAGS) $< -o $@
%.elc: %.el
$(call quiet,EMACS) -batch -f batch-byte-compile $<
.deps/%.d: %.c $(all_deps)
@set -e; rm -f $@; mkdir -p $$(dirname $@) ; \
- $(CC) -M $(CPPFLAGS) $(FINAL_CFLAGS) $< > $@.$$$$ 2>/dev/null ; \
- sed 's,'$$(basename $*)'\.o[ :]*,$*.o $@ : ,g' < $@.$$$$ > $@; \
+ $(CC) -M $(CPPFLAGS) $(FINAL_CFLAGS) $< > $@.$$$$; \
+ sed 's,'$$(basename $*)'\.lo[ :]*,$*.lo $@ : ,g' < $@.$$$$ > $@; \
rm -f $@.$$$$
.deps/%.d: %.cc $(all_deps)
@set -e; rm -f $@; mkdir -p $$(dirname $@) ; \
- $(CXX) -M $(CPPFLAGS) $(FINAL_CXXFLAGS) $< > $@.$$$$ 2>/dev/null ; \
- sed 's,'$$(basename $*)'\.o[ :]*,$*.o $@ : ,g' < $@.$$$$ > $@; \
+ $(CXX) -M $(CPPFLAGS) $(FINAL_CXXFLAGS) $< > $@.$$$$; \
+ sed 's,'$$(basename $*)'\.lo[ :]*,$*.lo $@ : ,g' < $@.$$$$ > $@; \
rm -f $@.$$$$
DEPS := $(SRCS:%.c=.deps/%.d)
@@ -79,4 +84,4 @@ DEPS := $(DEPS:%.cc=.deps/%.d)
.PHONY : clean
clean:
- rm -f $(CLEAN); rm -rf .deps
+ $(libtool) --mode=clean rm -f $(CLEAN); rm -rf .deps
diff --git a/Makefile.local b/Makefile.local
index 933ff4c..ccff76c 100644
--- a/Makefile.local
+++ b/Makefile.local
@@ -20,9 +20,9 @@ notmuch_client_srcs = \
query-string.c \
show-message.c
-notmuch_client_modules = $(notmuch_client_srcs:.c=.o)
-notmuch: $(notmuch_client_modules) lib/notmuch.a
- $(call quiet,CXX,$(LDFLAGS)) $^ $(FINAL_LDFLAGS) -o $@
+notmuch_client_modules = $(notmuch_client_srcs:.c=.lo)
+notmuch: $(notmuch_client_modules) lib/libnotmuch.la
+ $(call quiet,libtool,$(LDFLAGS)) --mode=link $(CXX) $^ $(FINAL_LDFLAGS) -o $@
notmuch.1.gz: notmuch.1
$(call quiet,gzip) --stdout $^ > $@
@@ -32,8 +32,12 @@ install: all notmuch.1.gz
do \
install -d $$d ; \
done ;
- install notmuch $(DESTDIR)$(prefix)/bin/
+ $(libtool) --mode=install install -c lib/libnotmuch.la $(DESTDIR)$(prefix)/lib/
+ $(libtool) --mode=install install -c notmuch $(DESTDIR)$(prefix)/bin/
install -m0644 notmuch.1.gz $(DESTDIR)$(prefix)/share/man/man1/
+ install contrib/notmuch-completion.bash \
+ $(DESTDIR)$(bash_completion_dir)/notmuch
+ $(libtool) --mode=finish $(DESTDIR)$(prefix)/lib/
install-emacs: install emacs
for d in $(DESTDIR)/$(emacs_lispdir) ; \
diff --git a/lib/Makefile.local b/lib/Makefile.local
index 70489e1..b03dff6 100644
--- a/lib/Makefile.local
+++ b/lib/Makefile.local
@@ -17,9 +17,9 @@ libnotmuch_cxx_srcs = \
$(dir)/query.cc \
$(dir)/thread.cc
-libnotmuch_modules = $(libnotmuch_c_srcs:.c=.o) $(libnotmuch_cxx_srcs:.cc=.o)
-$(dir)/notmuch.a: $(libnotmuch_modules)
- $(call quiet,AR) rcs $@ $^
+libnotmuch_modules = $(libnotmuch_c_srcs:.c=.lo) $(libnotmuch_cxx_srcs:.cc=.lo)
+$(dir)/libnotmuch.la: $(libnotmuch_modules)
+ $(call quiet,libtool) --mode=link $(CXX) -rpath $(DESTDIR)$(prefix)/lib -o $@ $^
SRCS := $(SRCS) $(libnotmuch_c_srcs) $(libnotmuch_cxx_srcs)
-CLEAN := $(CLEAN) $(libnotmuch_modules) $(dir)/notmuch.a
+CLEAN := $(CLEAN) $(libnotmuch_modules) $(dir)/notmuch.la
--
1.6.3.3
More information about the notmuch
mailing list