test/test-lib.sh: use vt100 as dtach terminal if TERM dumb or unset/empty
[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-config.1 \
12         $(dir)/man1/notmuch-count.1 \
13         $(dir)/man1/notmuch-dump.1 \
14         $(dir)/man1/notmuch-restore.1 \
15         $(dir)/man1/notmuch-new.1 \
16         $(dir)/man1/notmuch-reply.1 \
17         $(dir)/man1/notmuch-search.1 \
18         $(dir)/man1/notmuch-show.1 \
19         $(dir)/man1/notmuch-tag.1
20
21 MAN5 := $(dir)/man5/notmuch-hooks.5
22 MAN7 := $(dir)/man7/notmuch-search-terms.7
23
24 MAN1_GZ := $(addsuffix .gz,$(MAN1))
25 MAN5_GZ := $(addsuffix .gz,$(MAN5))
26 MAN7_GZ := $(addsuffix .gz,$(MAN7))
27
28 MAN_SOURCE := $(MAN1) $(MAN5) $(MAN7)
29 MAN_BACKUP := $(addsuffix .bak,$(MAN_SOURCE))
30 COMPRESSED_MAN := $(MAN1_GZ) $(MAN5_GZ) $(MAN7_GZ)
31
32 %.gz: %
33         gzip --stdout $^ > $@
34
35 .PHONY: install-man update-man-versions
36
37 install-man: $(COMPRESSED_MAN)
38         mkdir -p "$(DESTDIR)$(mandir)/man1"
39         mkdir -p "$(DESTDIR)$(mandir)/man5"
40         mkdir -p "$(DESTDIR)$(mandir)/man7"
41         install -m0644 $(MAN1_GZ) $(DESTDIR)/$(mandir)/man1
42         install -m0644 $(MAN5_GZ) $(DESTDIR)/$(mandir)/man5
43         install -m0644 $(MAN7_GZ) $(DESTDIR)/$(mandir)/man7
44         cd $(DESTDIR)/$(mandir)/man1 && ln -sf notmuch.1.gz notmuch-setup.1.gz
45
46 update-man-versions: $(MAN_SOURCE)
47         for file in $(MAN_SOURCE); do \
48             cp $$file $$file.bak ; \
49             sed "s/^.TH NOTMUCH\([^[:blank:]]*\) \([1-9]\) .*$$/.TH NOTMUCH\1 \2 ${DATE} \"Notmuch ${VERSION}\"/" \
50                 < $$file.bak > $$file; \
51         done
52
53 CLEAN := $(CLEAN) $(COMPRESSED_MAN) $(MAN_BACKUP)