Update to the versionning system
[radcan.git] / GNUmakefile
blobbabec284cb0f64ec8f18e14b05de17820ba6ea5e
1 # Just a quick makefile to help keeping the whole thing coherent and
2 # up to date (documentation, internal versionning).
4 # It needs:
6 # - GNU Make (obviously!)
7 # - GNU sed
8 # - Git and Cogito for tagging
9 # - POSIX compliant date util (tested on GNU coreutils)
10 # - help2man, to regenerate the man page
11 # - asciidoc and htmltidy, to refresh the html doc
12 # - links, to generate the text-only README
14 DOC=radcan.1 README index.html
15 DATE=$(shell env LC_ALL=fr_FR date +'%A, le %d %B %Y')
16 VER=$(shell cg tag-ls | sed '$$!d;s/\([0-9\.]*\).*/\1/')
17 OLD=$(shell cat .version 2> /dev/null)
19 all: tag $(DOC)
21 radcan.1: radcan radcan.py radcan.inc
22 help2man --include radcan.inc --no-info ./$< > $@
24 README: index.html
25 links -html-numbered-links 1 -dump $< > $@
27 index.html: readme.txt
28 asciidoc -a revision="$(VER)" -a localdate="$(DATE)" \
29 -f asciidoc.conf -o $@ $<
30 tidy --input-encoding utf8 --output-encoding ascii \
31 -m -i $@
33 .PHONY: clean tag
35 clean:
36 -rm -f *.pyc *~
37 -rm -f $(DOC)
39 # Versionning support: call with `make VER=xxx' to force upgrade.
41 .version:
42 @touch .version
44 setup.py radcan.py index.html: .version
46 tag: .version
47 ifneq ($(VER),$(OLD))
48 sed -i "s/^\(__version__ = \).*/\1 '$(VER)'/" radcan.py
49 sed -i "s/\(version=\).*/\1'$(VER)',/" setup.py
50 @echo $(VER) > .version
51 endif