X-Git-Url: https://git.notmuchmail.org/git?p=notmuch;a=blobdiff_plain;f=Makefile;h=3fedcf12e87c4cb26005d09953c36f90f2ed12e2;hp=96aaa7370c558d5ad6aabab5837fc6efefc0d579;hb=aac1d6035238f6a2b18c0dc0d7a5190a2187c511;hpb=2ce25b93a72b4a8d6daa5321f9ef7df0772a789f diff --git a/Makefile b/Makefile index 96aaa737..3fedcf12 100644 --- a/Makefile +++ b/Makefile @@ -4,15 +4,25 @@ CFLAGS=-O2 # Additional flags that we will append to whatever the user set. # These aren't intended for the user to manipulate. -extra_cflags = `pkg-config --cflags glib-2.0 gmime-2.4 talloc` -extra_cxxflags = `xapian-config --cxxflags` +extra_cflags := $(shell pkg-config --cflags glib-2.0 gmime-2.4 talloc) +extra_cxxflags := $(shell xapian-config --cxxflags) + +emacs_lispdir := $(shell pkg-config emacs --variable sitepkglispdir) +# Hard-code if this system doesn't have an emacs.pc file +ifeq ($(emacs_lispdir),) + emacs_lispdir = $(prefix)/share/emacs/site-lisp +endif + +all_deps = Makefile Makefile.local Makefile.config \ + lib/Makefile lib/Makefile.local # Now smash together user's values with our extra values override CFLAGS += $(WARN_FLAGS) $(extra_cflags) override CXXFLAGS += $(WARN_FLAGS) $(extra_cflags) $(extra_cxxflags) -override LDFLAGS += `pkg-config --libs glib-2.0 gmime-2.4 talloc` \ - `xapian-config --libs` +override LDFLAGS += \ + $(shell pkg-config --libs glib-2.0 gmime-2.4 talloc) \ + $(shell xapian-config --libs) # Include our local Makefile.local first so that its first target is default include Makefile.local @@ -21,19 +31,22 @@ include lib/Makefile.local # And get user settings from the output of configure include Makefile.config -%.o: %.cc - $(CXX) -c $(CFLAGS) $(CXXFLAGS) $< -o $@ +%.o: %.cc $(all_deps) + $(CXX) -c $(CXXFLAGS) $< -o $@ -%.o: %.c +%.o: %.c $(all_deps) $(CC) -c $(CFLAGS) $< -o $@ -.deps/%.d: %.c +%.elc: %.el + emacs -batch -f batch-byte-compile $< + +.deps/%.d: %.c $(all_deps) @set -e; rm -f $@; mkdir -p $$(dirname $@) ; \ $(CC) -M $(CPPFLAGS) $(CFLAGS) $< > $@.$$$$; \ sed 's,'$$(basename $*)'\.o[ :]*,$*.o $@ : ,g' < $@.$$$$ > $@; \ rm -f $@.$$$$ -.deps/%.d: %.cc +.deps/%.d: %.cc $(all_deps) @set -e; rm -f $@; mkdir -p $$(dirname $@) ; \ $(CXX) -M $(CPPFLAGS) $(CXXFLAGS) $< > $@.$$$$; \ sed 's,'$$(basename $*)'\.o[ :]*,$*.o $@ : ,g' < $@.$$$$ > $@; \