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