]> arthur.barton.de Git - bup.git/blob - Documentation/Makefile
cmd/version, etc: fix version number detection stuff.
[bup.git] / Documentation / Makefile
1 PANDOC:=$(shell \
2         if pandoc </dev/null 2>/dev/null; then \
3                 echo pandoc; \
4         else \
5                 echo "Warning: pandoc not installed; can't generate manpages." >&2; \
6                 echo '@echo Skipping: pandoc'; \
7         fi)
8 BUP_VERSION:=$(shell ../bup version --tag)
9 BUP_DATE:=$(shell ../bup version --date)
10
11 default: all
12
13 all: man html
14
15 man: $(patsubst %.md,%,$(wildcard *.md))
16
17 html: $(patsubst %.1.md,%.html,$(wildcard *.md))
18
19 %: %.md.tmp Makefile
20         $(PANDOC) -s -r markdown -w man -o $@ $<
21         
22 %.html: %.1.md.tmp Makefile
23         $(PANDOC) -s -r markdown -w html -o $@ $<
24         
25 .PRECIOUS: %.md.tmp
26 %.md.tmp: %.md Makefile
27         rm -f $@ $@.new
28         sed -e 's,%BUP_VERSION%,${BUP_VERSION},g' \
29             -e 's,%BUP_DATE%,${BUP_DATE},g' <$< >$@.new
30         mv $@.new $@
31
32 clean:
33         rm -f *~ .*~ *.[0-9] *.new *.tmp *.html