version from git filters
[dbuscron] / Makefile
index 2421ef3..9e3cdc4 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -2,22 +2,27 @@
 DESTDIR ?= 
 PYMODULES ?= $(DESTDIR)/usr/lib/pymodules/python2.5
 PREFIX ?= $(DESTDIR)/usr/bin
-PYSUFFIX = `test -e ./dbuscron/__init__.pyo && echo pyo || echo pyc`
 PYVERSION ?= 2.5
 
-all:
-       @echo "No compilation needed."
+BINFILES = dbuscron.py dbuscrontab.py migrate-dbus-scripts.py
 
-install:
-       install -o root -g root -m 0755 ./dbuscron.py $(PREFIX)/dbuscron
-       install -o root -g root -m 0755 ./dbuscrontab.py $(PREFIX)/dbuscrontab
+.SUFFIXES: .py .pyo
+
+compile: .py.pyo
+
+.py.pyo:
+       python$(PYVERSION) -O -m compileall ./dbuscron
+
+install: compile
+       for f in $(BINFILES); do \
+               install -o root -g root -m 0755 ./$$f $(PREFIX)/`basename $$f .py`; done
        install -o root -g root -m 0755 -d $(PYMODULES)/dbuscron/shell
-       python$(PYVERSION) -O -c 'import dbuscron, dbuscron.shell.main, dbuscron.shell.edit'
-       install -o root -g root -m 0644 ./dbuscron/*.$(PYSUFFIX) $(PYMODULES)/dbuscron
-       install -o root -g root -m 0644 ./dbuscron/shell/*.$(PYSUFFIX) $(PYMODULES)/dbuscron/shell
+       for f in `find ./dbuscron -name "*.pyo"`; do \
+               install -o root -g root -m 0644 $$f $(PYMODULES)/$$f; done
        install -o root -g root -m 0644 ./event.d/dbuscron $(DESTDIR)/etc/event.d/dbuscron
-       -test ! -f $(DESTDIR)/etc/dbuscrontab && \
+       test -f $(DESTDIR)/etc/dbuscrontab || \
                install -o root -g root -m 0644 ./doc/dbuscrontab $(DESTDIR)/etc/dbuscrontab
+       @echo ""
        @echo "Installation complete. Run \`dbuscrontab -e' to edit config file,"
        @echo "then run \`initctl start dbuscron' to start dbuscron daemon."
 
@@ -30,5 +35,23 @@ uninstall:
 clean:
        find ./dbuscron -name "*.py[co]" | xargs rm -f 
 
-.PHONY: all install uninstall clean
+debclean:
+       debclean
+       rm -rf ./debian/patches ./debian/dbuscron
+       rm -rf ./.pc
+
+deb: debclean
+       debuild binary-indep
+
+build: debclean
+       ./genchangelog $(B)
+       git commit -m "changelog updated" ./debian/changelog
+       git tag -f v$(B)
+       git push -f origin v$(B)
+       $(MAKE) deb
+
+tarball:
+       git archive --format=tar v$(B) | gzip -9 > ../dbuscron_$(B:.0=).orig.tar.gz
+
+.PHONY: install uninstall clean debclean deb build compile