]> git.cworth.org Git - notmuch/blob - man/Makefile.local
lib: use the compaction backup path provided by the caller
[notmuch] / man / Makefile.local
1 # -*- Makefile -*-
2
3 dir := man
4
5 # this variable seems to be needed to prevent lazy evaluation causing
6 # problems with $(dir) changing values.
7 MAIN_PAGE := $(dir)/man1/notmuch.1
8
9 MAN1 := \
10         $(MAIN_PAGE) \
11         $(dir)/man1/notmuch-compact.1 \
12         $(dir)/man1/notmuch-config.1 \
13         $(dir)/man1/notmuch-count.1 \
14         $(dir)/man1/notmuch-dump.1 \
15         $(dir)/man1/notmuch-restore.1 \
16         $(dir)/man1/notmuch-insert.1 \
17         $(dir)/man1/notmuch-new.1 \
18         $(dir)/man1/notmuch-reply.1 \
19         $(dir)/man1/notmuch-search.1 \
20         $(dir)/man1/notmuch-show.1 \
21         $(dir)/man1/notmuch-tag.1
22
23 MAN5 := $(dir)/man5/notmuch-hooks.5
24 MAN7 := $(dir)/man7/notmuch-search-terms.7
25
26 MAN1_GZ := $(addsuffix .gz,$(MAN1))
27 MAN5_GZ := $(addsuffix .gz,$(MAN5))
28 MAN7_GZ := $(addsuffix .gz,$(MAN7))
29
30 MAN_SOURCE := $(MAN1) $(MAN5) $(MAN7)
31 MAN_BACKUP := $(addsuffix .bak,$(MAN_SOURCE))
32 COMPRESSED_MAN := $(MAN1_GZ) $(MAN5_GZ) $(MAN7_GZ)
33
34 %.gz: %
35         gzip --stdout $^ > $@
36
37 .PHONY: install-man update-man-versions
38
39 install-man: $(COMPRESSED_MAN)
40         mkdir -p "$(DESTDIR)$(mandir)/man1"
41         mkdir -p "$(DESTDIR)$(mandir)/man5"
42         mkdir -p "$(DESTDIR)$(mandir)/man7"
43         install -m0644 $(MAN1_GZ) $(DESTDIR)/$(mandir)/man1
44         install -m0644 $(MAN5_GZ) $(DESTDIR)/$(mandir)/man5
45         install -m0644 $(MAN7_GZ) $(DESTDIR)/$(mandir)/man7
46         cd $(DESTDIR)/$(mandir)/man1 && ln -sf notmuch.1.gz notmuch-setup.1.gz
47
48 update-man-versions: $(MAN_SOURCE)
49         for file in $(MAN_SOURCE); do \
50             cp $$file $$file.bak ; \
51             sed "s/^.TH NOTMUCH\([^[:blank:]]*\) \([1-9]\) .*$$/.TH NOTMUCH\1 \2 ${DATE} \"Notmuch ${VERSION}\"/" \
52                 < $$file.bak > $$file; \
53         done
54
55 CLEAN := $(CLEAN) $(COMPRESSED_MAN) $(MAN_BACKUP)