rewrite man page for mic
[tools/mic.git] / Makefile
1 PYTHON ?= python
2 VERSION = $(shell cat VERSION)
3 TAGVER = $(shell cat VERSION | sed -e "s/\([0-9\.]*\).*/\1/")
4
5 PKGNAME = mic
6
7 ifeq ($(VERSION), $(TAGVER))
8         TAG = $(TAGVER)
9 else
10         TAG = "HEAD"
11 endif
12
13 ifndef PREFIX
14     PREFIX = "/usr"
15 endif
16
17 all: build
18
19 build:
20         $(PYTHON) setup.py build
21
22 dist-common: man
23         git archive --format=tar --prefix=$(PKGNAME)-$(TAGVER)/ $(TAG) | tar xpf -
24         git show $(TAG) --oneline | head -1 > $(PKGNAME)-$(TAGVER)/commit-id
25         mkdir $(PKGNAME)-$(TAGVER)/doc; mv mic.1 $(PKGNAME)-$(TAGVER)/doc
26
27 dist-bz2: dist-common
28         tar jcpf $(PKGNAME)-$(TAGVER).tar.bz2 $(PKGNAME)-$(TAGVER)
29         rm -rf $(PKGNAME)-$(TAGVER)
30
31 dist-gz: dist-common
32         tar zcpf $(PKGNAME)-$(TAGVER).tar.gz $(PKGNAME)-$(TAGVER)
33         rm -rf $(PKGNAME)-$(TAGVER)
34
35 man: USAGE.rst
36         rst2man $< >mic.1
37
38 install: build
39         $(PYTHON) setup.py install  --prefix=$(DESTDIR)/$(PREFIX)
40
41 develop: build
42         $(PYTHON) setup.py develop
43
44 test:
45         cd tests/unittest/ && $(PYTHON) suite.py 
46
47 clean:
48         rm -f *.tar.gz
49         rm -f *.tar.bz2
50         rm -f mic/__version__.*
51         rm -f tools/*.py[co]
52         rm -f mic.1
53         rm -rf *.egg-info
54         rm -rf build/
55         rm -rf dist/