]> git.notmuchmail.org Git - notmuch/blobdiff - Makefile
Move bulk of rules from Makefile to Makefile.local.
[notmuch] / Makefile
index 747408a6b64313ecd672f95b98bb95a71080e0ed..f3697861e75d540f20954a46589284a3db10e278 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,41 +1,14 @@
-PROGS=notmuch
+# We want the all target to be the implicit target (if no target is
+# given explicitly on the command line) so mention it first.
+all:
 
-WARN_FLAGS=-Wall -Wextra -Wmissing-declarations -Wwrite-strings -Wswitch-enum
+# List all subdirectories here. Each contains its own Makefile.local
+subdirs = compat emacs lib
 
-CDEPENDS_FLAGS=`pkg-config --cflags glib-2.0 talloc`
-CXXDEPENDS_FLAGS=`pkg-config --cflags glib-2.0 talloc` `xapian-config --cxxflags`
+# We make all targets depend on the Makefiles themselves.
+global_deps = Makefile Makefile.local \
+       $(subdirs:%=%/Makefile) $(subdirs:%=%/Makefile.local)
 
-MYCFLAGS=$(WARN_FLAGS) -O0 -g $(CDEPENDS_FLAGS)
-MYCXXFLAGS=$(WARN_FLAGS) -O0 -g $(CXXDEPENDS_FLAGS)
-
-MYLDFLAGS=`pkg-config --libs glib-2.0 talloc` `xapian-config --libs`
-
-MODULES=               \
-       notmuch.o       \
-       database.o      \
-       date.o          \
-       message.o       \
-       message-file.o  \
-       query.o         \
-       sha1.o          \
-       thread.o        \
-       libsha1.o       \
-       xutil.o
-
-all: $(PROGS)
-
-%.o: %.cc
-       $(CXX) -c $(CFLAGS) $(CXXFLAGS) $(MYCXXFLAGS) $< -o $@
-
-%.o: %.c
-       $(CC) -c $(CFLAGS) $(MYCFLAGS) $< -o $@
-
-notmuch: $(MODULES)
-       $(CC) $(MYLDFLAGS) $^ -o $@
-
-Makefile.dep: *.c *.cc
-       $(CXX) -M $(CPPFLAGS) $(CDEPENDS_FLAGS) $(CXXDEPENDS_FLAGS) $^ > $@
--include Makefile.dep
-
-clean:
-       rm -f $(PROGS) *.o Makefile.dep
+# Finally, include all of the Makefile.local fragments where all the
+# real work is done.
+include Makefile.local $(subdirs:%=%/Makefile.local)