X-Git-Url: https://git.notmuchmail.org/git?p=notmuch;a=blobdiff_plain;f=Makefile;h=7743ef52cf98f0b3babd0cd99d9c8c47f6de49bb;hp=c1fbd2a19bcc2d6f09c67677b25073660fb6009f;hb=97c7cffdc6e0047bb49a899b013516bc3022e580;hpb=36640b303ea68ae28e89f27694356141f515819b diff --git a/Makefile b/Makefile index c1fbd2a1..7743ef52 100644 --- a/Makefile +++ b/Makefile @@ -1,18 +1,39 @@ -PROGS=notmuch notmuch-index-message xapian-dump +WARN_FLAGS=-Wall -Wextra -Wmissing-declarations -Wwrite-strings -Wswitch-enum -MYCFLAGS=-Wall -O0 -g -MYCXXFLAGS=-Wall -O0 -g +NOTMUCH_DEPENDS_FLAGS=-I./lib `pkg-config --cflags glib-2.0 gmime-2.4 talloc` +NOTMUCH_CXX_DEPENDS_FLAGS=$(NOTMUCH_DEPENDS_FLAGS) `xapian-config --cxxflags` -all: $(PROGS) +NOTMUCH_CFLAGS=$(WARN_FLAGS) -O0 -g $(NOTMUCH_DEPENDS_FLAGS) +NOTMUCH_CXXFLAGS=$(WARN_FLAGS) -O0 -g $(NOTMUCH_CXX_DEPENDS_FLAGS) -notmuch: notmuch.c - $(CC) $(CFLAGS) $(MYCFLAGS) notmuch.c `pkg-config --cflags --libs glib-2.0` -o notmuch +NOTMUCH_LDFLAGS=`pkg-config --libs glib-2.0 gmime-2.4 talloc` \ + `xapian-config --libs` -notmuch-index-message: notmuch-index-message.cc - $(CXX) $(CXXFLAGS) $(MYCXXFLAGS) notmuch-index-message.cc `pkg-config --cflags --libs gmime-2.4` `xapian-config --cxxflags --libs` -o notmuch-index-message +# Include our local Makfile.local first so that its first target is default +include Makefile.local +include lib/Makefile.local -xapian-dump: xapian-dump.cc - $(CXX) $(CXXFLAGS) $(MYCXXFLAGS) xapian-dump.cc `xapian-config --libs --cxxflags` -o xapian-dump +%.o: %.cc + $(CXX) -c $(CFLAGS) $(CXXFLAGS) $(NOTMUCH_CXXFLAGS) $< -o $@ + +%.o: %.c + $(CC) -c $(CFLAGS) $(NOTMUCH_CFLAGS) $< -o $@ + +.deps/%.d: %.c + @set -e; rm -f $@; mkdir -p $$(dirname $@) ; \ + $(CC) -M $(CPPFLAGS) $(NOTMUCH_DEPENDS_FLAGS) $< > $@.$$$$; \ + sed 's,\($*\)\.o[ :]*,\1.o $@ : ,g' < $@.$$$$ > $@; \ + rm -f $@.$$$$ + +.deps/%.d: %.cc + @set -e; rm -f $@; mkdir -p $$(dirname $@) ; \ + $(CXX) -M $(CPPFLAGS) $(NOTMUCH_CXX_DEPENDS_FLAGS) $< > $@.$$$$; \ + sed 's,\($*\)\.o[ :]*,\1.o $@ : ,g' < $@.$$$$ > $@; \ + rm -f $@.$$$$ + +DEPS := $(SRCS:%.c=.deps/%.d) +DEPS := $(DEPS:%.cc=.deps/%.d) +-include $(DEPS) clean: - rm -f $(PROGS) + rm -f $(CLEAN); rm -rf .deps