18,6 → 18,13 |
MANROOT=$(INSTALLROOT)/share/man |
# Where to install additional packages |
PYTHONROOT=$(DESTDIR)$(shell python -c "import sys;from distutils import sysconfig; print sysconfig.get_python_lib(0,0,prefix='$(prefix)')") |
DUSETUP=python setup.py # Distutils' setup |
# Debian derived systems need special treatment for clean uninstalls |
# since it uses different than standard directories |
INSTALL_LAYOUT= |
ifeq ($(findstring dist-packages,$(PYTHONROOT)),dist-packages) |
INSTALL_LAYOUT=--install-layout=deb |
endif |
|
all: $(PKG).1 |
|
33,31 → 40,33 |
@echo INSTALLROOT=$(INSTALLROOT) |
@echo MANROOT=$(MANROOT) |
@echo PYTHONROOT=$(PYTHONROOT) |
@echo INSTALL_LAYOUT=$(INSTALL_LAYOUT) |
|
setup.py: devtools/setup.py.in |
sed 's/@VERSION@/$(VERSION)/g' < $< > $@ |
|
clean: |
-$(RM) *.pyc *.pyo manpage.html manpage.pdf $(PKG).spec |
-$(RM) *.pyc *.pyo manpage.html manpage.pdf $(PKG).spec setup.py |
|
distclean: clean |
-$(RM) $(PKGVER).tar.gz $(PKGVER).zip |
-$(RM) -r dist build $(PKGVER)/ |
|
install: |
install -D -m755 src/$(PKG).py $(INSTALLROOT)/bin/$(PKG) |
install -D -m644 $(PKG).1 $(MANROOT)/man1/$(PKG).1 |
install -d $(PYTHONROOT)/$(PKG) |
install -D -m644 src/$(PKG)/*.py $(PYTHONROOT)/$(PKG)/ |
# Extra tools |
install -d $(INSTALLROOT)/share/doc/$(PKG)/extra |
install -D -m755 src/gui.py devtools/*.py $(INSTALLROOT)/share/doc/$(PKG)/extra/ |
install: setup.py |
$(DUSETUP) install --prefix=$(DESTDIR)$(prefix) $(INSTALL_LAYOUT) |
|
# There's no distutils uninstall |
uninstall: |
-$(RM) $(INSTALLROOT)/bin/$(PKG) $(INSTALLROOT)/share/man/man1/$(PKG).1 |
-for tool in gui.py devtools/*.py; do \ |
$(RM) $(INSTALLROOT)/share/doc/$(PKG)/extra/`basename $$tool` ; \ |
done |
-$(RM) $(PYTHONROOT)/$(PKG)/* |
-$(RM) $(PYTHONROOT)/$(PKGVER).egg-info |
-rmdir --parents $(INSTALLROOT)/share/doc/$(PKG)/extra/ \ |
$(MANROOT)/man1/ \ |
$(INSTALLROOT)/bin/ |
$(INSTALLROOT)/bin/ \ |
$(PYTHONROOT)/$(PKG)/ |
|
$(PKG).1: manpage_source.sgml |
docbook-to-man $< > $@ |
80,15 → 89,19 |
dist: $(PKGVER).tar.gz $(PKGVER).zip |
-$(RM) -r $(PKGVER) |
|
$(PKGVER).tar.gz: is_release distclean $(PKG).spec package_copy |
tar cv $(PKGVER) | gzip -c9 > $(PKGVER).tar.gz |
tarball: $(PKGVER).tar.gz |
|
$(PKGVER).tar.gz: is_release distclean $(PKG).spec setup.py |
$(DUSETUP) sdist -u root -g root --formats=gztar && mv dist/$@ . |
|
zip: $(PKGVER).zip |
|
$(PKGVER).zip: is_release distclean manpage.pdf manpage.html $(PKG).spec package_copy |
cp manpage.pdf manpage.html $(PKGVER) |
zip -9 -r $(PKGVER).zip $(PKGVER) |
-$(RM) $(PKGVER)/manpage.pdf $(PKGVER)/manpage.html |
$(PKGVER).zip: is_release distclean manpage.pdf manpage.html $(PKG).spec setup.py |
@# Specifial manifest with additional files |
cp MANIFEST.in MANIFEST.in.tmp |
echo include manpage.pdf manpage.html >> MANIFEST.in.tmp |
$(DUSETUP) sdist --formats=zip --template MANIFEST.in.tmp && mv dist/$@ . |
-$(RM) MANIFEST.in.tmp MANIFEST |
|
$(PKG).spec: $(PKG).spec.in |
test -n "$(VERSION)" # Version (=$(VERSION)) must be defined |