Makefile: tarball target to build source tarball
[dbuscron] / Makefile
1
2 DESTDIR ?= 
3 PYMODULES ?= $(DESTDIR)/usr/lib/pymodules/python2.5
4 PREFIX ?= $(DESTDIR)/usr/bin
5 PYVERSION ?= 2.5
6
7 BINFILES = dbuscron.py dbuscrontab.py migrate-dbus-scripts.py
8
9 .SUFFIXES: .py .pyo
10
11 compile: .py.pyo
12
13 .py.pyo:
14         sed -i.bak -e "s/%VERSION%/`git describe --tags`/" ./dbuscron/__init__.py
15         python$(PYVERSION) -O -m compileall ./dbuscron
16         mv -f ./dbuscron/__init__.py.bak ./dbuscron/__init__.py
17
18 install: compile
19         for f in $(BINFILES); do \
20                 install -o root -g root -m 0755 ./$$f $(PREFIX)/`basename $$f .py`; done
21         install -o root -g root -m 0755 -d $(PYMODULES)/dbuscron/shell
22         find ./dbuscron -name "*.pyo" | xargs -I {} install -o root -g root -m 0644 {} $(PYMODULES)/{}
23         install -o root -g root -m 0644 ./event.d/dbuscron $(DESTDIR)/etc/event.d/dbuscron
24         test -f $(DESTDIR)/etc/dbuscrontab || \
25                 install -o root -g root -m 0644 ./doc/dbuscrontab $(DESTDIR)/etc/dbuscrontab
26         @echo ""
27         @echo "Installation complete. Run \`dbuscrontab -e' to edit config file,"
28         @echo "then run \`initctl start dbuscron' to start dbuscron daemon."
29
30 uninstall:
31         -initctl stop dbuscron
32         rm -rf $(PYMODULES)/dbuscron
33         rm -f $(PREFIX)/dbuscron $(PREFIX)/dbuscrontab
34         rm -f $(DESTDIR)/etc/event.d/dbuscron
35
36 clean:
37         find ./dbuscron -name "*.py[co]" | xargs rm -f 
38
39 debclean:
40         debclean
41         rm -rf ./debian/patches ./debian/dbuscron
42         rm -rf ./.pc
43
44 deb: debclean
45         debuild binary-indep
46
47 build: debclean
48         ./genchangelog $(B)
49         git commit -m "changelog updated" ./debian/changelog
50         git tag -f v$(B)
51         git push -f origin v$(B)
52         $(MAKE) deb
53
54 tarball:
55         git archive --format=tar v$(B) | gzip -9 > ../dbuscron_$(B:.0=).orig.tar.gz
56
57 .PHONY: install uninstall clean debclean deb build compile
58