pyconfigure

(Brandon Invergo)
2012-11-11: add support for datarootdir

add support for datarootdir

diff --git a/src/Makefile b/src/Makefile
--- a/src/Makefile
+++ b/src/Makefile
@@ -1,31 +1,145 @@
-#Copyright 2012 Brandon Invergo <brandon@invergo.net>
+# Makefile.in
 #
-#Copying and distribution of this software, with or without modification,
-#are permitted in any medium without royalty provided the copyright
-#notice and this notice are preserved.  This file is offered as-is,
-#without any warranty.
+# Copyright © 2012 Brandon Invergo <brandon@invergo.net>
+#
+# Copying and distribution of this file, with or without modification,
+# are permitted in any medium without royalty provided the copyright
+# notice and this notice are preserved.  This file is offered as-is,
+# without any warranty.
 
-prefix = /usr
-bindir = ${prefix}/bin
-MAKEINFO = ${bindir}/makeinfo
-TEXI2HTML = $(MAKEINFO) --html --no-split
-TEXI2PDF = ${bindir}/texi2pdf
 
-all: info html pdf
 
-.PHONY: all info html pdf
+PACKAGE_BUGREPORT = project_name-bug@gnu.org
+PACKAGE_NAME = project_name
+PACKAGE_STRING = project_name project_version
+PACKAGE_TARNAME = project_name
+PACKAGE_URL = 
+PACKAGE_VERSION = project_version
+PATH_SEPARATOR = :
+PYTHON = /home/brandon/bin/python
+VIRTUALENV = no
+SPHINXBUILD = @SPHINXBUILD@
+SHELL = /bin/sh
+MKDIR_P = /usr/bin/mkdir -p
+INSTALL = /usr/bin/install -c
+INSTALL_PROGRAM = ${INSTALL}
+INSTALL_DATA = ${INSTALL} -m 644
+INSTALL_SCRIPT = ${INSTALL}
+docdir = ${datarootdir}/doc/${PACKAGE_TARNAME}
+dvidir = ${docdir}
+exec_prefix = ${prefix}
+htmldir = ${docdir}
+includedir = ${prefix}/include
+infodir = ${datarootdir}/info
+prefix = /usr/local
+srcdir = .
+datadir = ${datarootdir}
+datarootdir = ${prefix}/share
+pythondir = ${prefix}/lib/python2.7/site-packages
+pyexecdir = ${exec_prefix}/
+pkgdatadir = $(datadir)/project_name
+pkgincludedir = $(includedir)/project_name
+pkgpythondir = ${pythondir}/
+pkgpyexecdir = ${pyexecdir}/
+PYTHONPATH = $(pythondir)$(PATH_SEPARATOR)$(DESTDIR)$(pythondir)
 
-info: python-configure.info
+all: install
 
-html: python-configure.html
+.PHONY: all install uninstall distclean info install-html html install-pdf pdf install-dvi dvi install-ps ps clean dist check installdirs
 
-pdf: python-configure.pdf
 
-python-configure.info: python-configure.texi
-	$(MAKEINFO) $<
 
-python-configure.html: python-configure.texi
-	$(TEXI2HTML) $<
+# Since installing to a virtualenv is all the rage these days, support it here. If the VIRTUALENV
+# variable is set to anything other than "no", set up a new virtualenv and install there, otherwise
+# install as usual from setup.py
+install: installdirs
+	$(NORMAL_INSTALL)
+ifneq ($(VIRTUALENV),no)
+	$(VIRTUALENV) $(VIRTUALENV_FLAGS) $(DESTDIR)$(prefix) || $(VIRTUALENV) $(DESTDIR)$(prefix)
+	$(DESTDIR)$(prefix)/bin/python $(srcdir)/setup.py install --prefix=$(DESTDIR)$(prefix)
+else
+	$(PYTHON) $(srcdir)/setup.py install --prefix=$(DESTDIR)$(prefix)
+endif
 
-python-configure.pdf: python-configure.texi
-	$(TEXI2PDF) $<
+
+# setup.py doesn't (yet) support an uninstall command, so until it does, you must manually remove
+# everything that was installed here
+uninstall: $(wildcard $(srcdir)/docs/source/*)
+	rm -rf $(pkgpythondir)
+
+
+# Just use the usual setup.py clean command
+clean:
+	$(PYTHON) setup.py clean
+
+
+# Clean up the output of configure
+distclean: $(wildcard $(srcdir)/docs/source/*)
+	rm $(srcdir)/config.log
+	rm $(srcdir)/config.status
+
+
+# The following show how to install documentation, following the example of GNU MediaGoblin
+# In that case, docs are built from a separate Makefile contained in the docs directory which
+# uses the SPHINXBUILD variable to store the location of the sphinx-build (Python doc tool) 
+# binary to use.
+
+# $(DESTDIR)$(infodir)/foo.info: docs/build/texinfo/foo.info
+# 	$(POST_INSTALL)
+# 	$(INSTALL_DATA) @< $(DESTDIR)$@
+# 	if $(SHELL) -c 'install-info --version' >/dev/null 2>&1; then
+# 		install-info --dir-file=$(DESTDIR)$(infodir)/dir \
+# 				$(DESTDIR)$(infodir)/gnumediagoblin.info;
+# 	else true; fi
+
+# info: docs/build/texinfo/foo.info
+
+# docs/build/texinfo/foo.info: $(wildcard docs/source/*)
+# ifneq ($(SPHINXBUILD),no)
+# 	$(MAKE) -C docs info SPHINXBUILD=$(SPHINXBUILD)
+# endif
+
+
+# install-html: html installdirs
+# 	$(INSTALL_DATA) docs/build/html/* $(DESTDIR)$(htmldir)
+
+# html: docs/build/html/index.html
+
+# docs/build/html/index.html: $(wildcard $(srcdir)/docs/source/*)
+# ifneq ($(SPHINXBUILD),no)
+# 	$(MAKE) -C docs html SPHINXBUILD=$(SPHINXBUILD)
+# endif
+
+
+# install-pdf: pdf installdirs
+# 	$(INSTALL_DATA) docs/build/latex/foo.pdf $(DESTDIR)$(pdfdir)
+
+# pdf: docs/build/latex/Foo.pdf
+
+# docs/build/latex/foo.pdf: $(wildcard $(srcdir)/docs/source/*)
+# ifneq ($(SPHINXBUILD),no)
+# 	$(MAKE) -C docs latexpdf SPHINXBUILD=$(SPHINXBUILD)
+# endif
+
+
+# install-dvi:
+
+# dvi:
+
+# install-ps:
+
+# ps:
+
+
+# Just use the setup.py sdist (source distribution) command
+dist:
+	$(PYTHON) setup.py sdist
+
+# Use the setup.py check command
+check:
+	$(PYTHON) setup.py check
+
+# setup.py might complain if a directory doesn't exist so just in case, make the directory
+# here
+installdirs:
+	$(MKDIR_P) $(DESTDIR)$(pkgpythondir)
diff --git a/src/Makefile.in b/src/Makefile.in
--- a/src/Makefile.in
+++ b/src/Makefile.in
@@ -34,6 +34,7 @@ infodir = @infodir@
 prefix = @prefix@
 srcdir = @srcdir@
 datadir = @datadir@
+datarootdir = @datarootdir@
 pythondir = @pythondir@
 pyexecdir = @pyexecdir@
 pkgdatadir = $(datadir)/@PACKAGE_NAME@