]> git.notmuchmail.org Git - notmuch/blobdiff - Makefile
Fix up Makefile for build.
[notmuch] / Makefile
index 13f2b28d3f4a2081f4fd1b2075ec5ad1fbea3290..faaaec6419b9ae7ec4d96b1b0d28ceac00739446 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,35 +1,21 @@
-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:
 
-MYCFLAGS=-Wall -O0 -g `pkg-config --cflags glib-2.0 talloc`
-MYCXXFLAGS=$(MYCFLAGS) `xapian-config --cxxflags`
+# List all subdirectories here. Each contains its own Makefile.local
+subdirs = compat completion emacs lib
 
-MYLDFLAGS=`pkg-config --libs glib-2.0 talloc` `xapian-config --libs`
+# We make all targets depend on the Makefiles themselves.
+global_deps = Makefile Makefile.local \
+       $(subdirs:%=%/Makefile) $(subdirs:%=%/Makefile.local)
 
-MODULES=               \
-       notmuch.o       \
-       database.o      \
-       date.o          \
-       message.o       \
-       message-file.o  \
-       query.o         \
-       sha1.o          \
-       libsha1.o       \
-       xutil.o
+# Sub-directory Makefile.local fragments can append to these variables
+# to have directory-specific cflags as necessary.
 
-all: $(PROGS)
+extra_cflags :=
+extra_cxxflags :=
 
-%.o: %.cc
-       $(CXX) -c $(CXXFLAGS) $(MYCXXFLAGS) $< -o $@
+# Finally, include all of the Makefile.local fragments where all the
+# real work is done.
 
-%.o: %.c
-       $(CC) -c $(CFLAGS) $(MYCFLAGS) $< -o $@
-
-notmuch: $(MODULES)
-       $(CC) $(MYLDFLAGS) $^ -o $@
-
-Makefile.dep: *.c *.cc
-       $(CC) -M $(CPPFLAGS) $(MYCFLAGS) $^ > $@
--include Makefile.dep
-
-clean:
-       rm -f $(PROGS) *.o Makefile.dep
+include $(subdirs:%=%/Makefile.local) Makefile.local