]> git.notmuchmail.org Git - notmuch/blob - Makefile.local
Makefiles: Align the columns of output.
[notmuch] / Makefile.local
1 # Get settings from the output of configure by running it to generate
2 # Makefile.config if it doesn't exist yet. And add Makefile.config to
3 # our global dependency list.
4 include Makefile.config
5 global_deps += Makefile.config
6 Makefile.config: configure
7         @echo ""
8         @echo "Note: Calling ./configure with no command-line arguments. This is often fine,"
9         @echo "      but if you want to specify any arguments (such as an alternate prefix"
10         @echo "      into which to install), call ./configure explicitly and then make again."
11         @echo "      See \"./configure --help\" for more details."
12         @echo ""
13         ./configure
14
15 # Sub-directory Makefile.local fragments can append to these variables
16 # to have directory-specific cflags as necessary.
17 extra_cflags :=
18 extra_cxxflags :=
19
20 # Smash together user's values with our extra values
21 FINAL_CFLAGS = $(CFLAGS) $(WARN_CFLAGS) $(CONFIGURE_CFLAGS) $(extra_cflags)
22 FINAL_CXXFLAGS = $(CXXFLAGS) $(WARN_CXXFLAGS) $(CONFIGURE_CXXFLAGS) $(extra_cflags) $(extra_cxxflags)
23 FINAL_LDFLAGS = $(LDFLAGS) $(CONFIGURE_LDFLAGS)
24
25 all: notmuch notmuch.1.gz
26 ifeq ($(MAKECMDGOALS),)
27         @echo ""
28         @echo "Compilation of notmuch is now complete. You can install notmuch with:"
29         @echo ""
30         @echo " make install"
31         @echo ""
32         @echo "Note that depending on the prefix to which you are installing"
33         @echo "you may need root permission (such as \"sudo make install\")."
34         @echo "See \"./configure --help\" for help on setting an alternate prefix."
35 endif
36
37 # The user has not set any verbosity, default to quiet mode and inform the
38 # user how to enable verbose compiles.
39 ifeq ($(V),)
40 quiet_DOC := "Use \"$(MAKE) V=1\" to see the verbose compile lines.\n"
41 quiet = @printf $(quiet_DOC)$(eval quiet_DOC:=)"  %12s $@\n" "$1 $2"; $($1)
42 quiet_args = @printf $(quiet_DOC)$(eval quiet_DOC:=)"  %12s$2\n" $1; $($1) $2
43 endif
44 # The user has explicitly enabled quiet compilation.
45 ifeq ($(V),0)
46 quiet = @printf "  %12s $@\n" "$1 $2"; $($1)
47 quiet_args = @printf "  %12s$2\n" $1; $($1) $2
48 endif
49 # Otherwise, print the full command line.
50 quiet ?= $($1)
51 quiet_args ?= $($1) $2
52
53 quiet_mkdir = $(call quiet_args,MKDIR,$1)
54 quiet_install_bin = $(call quiet_args,INSTALL-BIN,$1)
55 quiet_install_data = $(call quiet_args,INSTALL-DATA,$1)
56 quiet_symlink = $(call quiet_args,SYMLINK,$1)
57
58 %.o: %.cc $(global_deps)
59         $(call quiet,CXX,$(CXXFLAGS)) -c $(FINAL_CXXFLAGS) $< -o $@
60
61 %.o: %.c $(global_deps)
62         $(call quiet,CC,$(CFLAGS)) -c $(FINAL_CFLAGS) $< -o $@
63
64 %.elc: %.el
65         $(call quiet,EMACS) -batch -f batch-byte-compile $<
66
67 .deps/%.d: %.c $(global_deps)
68         @set -e; rm -f $@; mkdir -p $$(dirname $@) ; \
69         $(CC) -M $(CPPFLAGS) $(FINAL_CFLAGS) $< > $@.$$$$ 2>/dev/null ; \
70         sed 's,'$$(basename $*)'\.o[ :]*,$*.o $@ : ,g' < $@.$$$$ > $@; \
71         rm -f $@.$$$$
72
73 .deps/%.d: %.cc $(global_deps)
74         @set -e; rm -f $@; mkdir -p $$(dirname $@) ; \
75         $(CXX) -M $(CPPFLAGS) $(FINAL_CXXFLAGS) $< > $@.$$$$ 2>/dev/null ; \
76         sed 's,'$$(basename $*)'\.o[ :]*,$*.o $@ : ,g' < $@.$$$$ > $@; \
77         rm -f $@.$$$$
78
79 DEPS := $(SRCS:%.c=.deps/%.d)
80 DEPS := $(DEPS:%.cc=.deps/%.d)
81 -include $(DEPS)
82
83 .PHONY : clean
84 clean:
85         rm -f $(CLEAN); rm -rf .deps
86
87 notmuch_client_srcs =           \
88         $(notmuch_compat_srcs)  \
89         debugger.c              \
90         gmime-filter-reply.c    \
91         notmuch.c               \
92         notmuch-config.c        \
93         notmuch-count.c         \
94         notmuch-dump.c          \
95         notmuch-new.c           \
96         notmuch-reply.c         \
97         notmuch-restore.c       \
98         notmuch-search.c        \
99         notmuch-search-tags.c   \
100         notmuch-setup.c         \
101         notmuch-show.c          \
102         notmuch-tag.c           \
103         notmuch-time.c          \
104         query-string.c          \
105         show-message.c          \
106         json.c
107
108 notmuch_client_modules = $(notmuch_client_srcs:.c=.o)
109 notmuch: $(notmuch_client_modules) lib/libnotmuch.so
110         $(call quiet,CC,$(LDFLAGS)) -Llib -lnotmuch $(filter-out lib/libnotmuch.so,$^) $(FINAL_LDFLAGS) -o $@
111
112 notmuch.1.gz: notmuch.1
113         $(call quiet,gzip) --stdout $^ > $@
114
115 install: all notmuch.1.gz
116         $(call quiet_mkdir, $(DESTDIR)$(prefix)/bin/)
117         $(call quiet_mkdir, $(DESTDIR)$(libdir)/)
118         $(call quiet_mkdir, $(DESTDIR)$(prefix)/include/)
119         $(call quiet_mkdir, $(DESTDIR)$(prefix)/share/man/man1)
120         $(call quiet_install_bin, notmuch $(DESTDIR)$(prefix)/bin/)
121         $(call quiet_install_data, notmuch.1.gz $(DESTDIR)$(prefix)/share/man/man1/)
122 ifeq ($(MAKECMDGOALS), install)
123         @echo ""
124         @echo "Notmuch is now installed."
125         @echo ""
126         @echo "You may now want to install additional components to support using notmuch"
127         @echo "together with other software packages:"
128         @echo ""
129         @echo " make install-emacs"
130         @echo " make install-bash"
131         @echo " make install-zsh"
132         @echo ""
133 endif
134
135 install-desktop:
136         $(call quiet,MKDIR) $(DESTDIR)$(desktop_dir)
137         desktop-file-install --mode 0644 --dir $(DESTDIR)$(desktop_dir) notmuch.desktop
138
139 install-bash:
140         $(call quiet-mkdir, $(DESTDIR)$(bash_completion_dir))
141         $(call quiet_install_data, contrib/notmuch-completion.bash $(DESTDIR)$(bash_completion_dir)/notmuch)
142
143 install-zsh:
144         $(call quiet_mkdir, $(DESTDIR)$(zsh_completion_dir))
145         $(call quiet_install_data, contrib/notmuch-completion.zsh $(DESTDIR)$(zsh_completion_dir)/notmuch)
146
147 SRCS  := $(SRCS) $(notmuch_client_srcs)
148 CLEAN := $(CLEAN) notmuch $(notmuch_client_modules) notmuch.elc notmuch.1.gz