better handle installation to another directory
[mediagoblin.git] / Makefile.in
CommitLineData
0a2eecf8
BI
1# Makefile.in
2#
3# Copyright © 2012, 2013 Brandon Invergo <brandon@invergo.net>
4#
5# Copying and distribution of this file, with or without modification,
6# are permitted in any medium without royalty provided the copyright
7# notice and this notice are preserved. This file is offered as-is,
8# without any warranty.
9
10# List whatever files you want to include in your source distribution here.
11# You can include whole directories but note that *everything* under that
12# directory will be included
13DISTFILES = PKG-INFO Makefile.in configure setup.py install-sh
14
15DESTDIR =
16VPATH = @srcdir@
17PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
18PACKAGE_NAME = @PACKAGE_NAME@
19PACKAGE_STRING = @PACKAGE_STRING@
20PACKAGE_TARNAME = @PACKAGE_TARNAME@
21PACKAGE_DISTNAME = ${PACKAGE_NAME}-${PACKAGE_VERSION}
22PACKAGE_URL = @PACKAGE_URL@
23PACKAGE_VERSION = @PACKAGE_VERSION@
24PATH_SEPARATOR = @PATH_SEPARATOR@
25PYTHON = @PYTHON@
26VIRTUALENV = @VIRTUALENV@
27SPHINXBUILD = @SPHINXBUILD@
28SHELL = @SHELL@
29MKDIR_P = @MKDIR_P@
30INSTALL = @INSTALL@
31INSTALL_PROGRAM = @INSTALL_PROGRAM@
32INSTALL_DATA = @INSTALL_DATA@
33INSTALL_SCRIPT = @INSTALL_SCRIPT@
34docdir = @docdir@
35dvidir = @dvidir@
36exec_prefix = @exec_prefix@
37htmldir = @htmldir@
38includedir = @includedir@
39infodir = @infodir@
40prefix = @prefix@
41srcdir = @srcdir@
42datadir = @datadir@
43datarootdir = @datarootdir@
44pythondir = @pythondir@
45pyexecdir = @pyexecdir@
46pkgdatadir = $(datadir)/@PACKAGE_NAME@
47pkgincludedir = $(includedir)/@PACKAGE_NAME@
48pkgpythondir = @pkgpythondir@
49pkgpyexecdir = @pkgpyexecdir@
50PYTHONPATH = $(pythondir)$(PATH_SEPARATOR)$(DESTDIR)$(pythondir)
51
52all: install
53
54.PHONY: all install develop uninstall distclean info install-html html \
55install-pdf pdf install-dvi dvi install-ps ps clean dist check \
56installdirs postgresql update
57
297a262c
BI
58# Since installing to a virtualenv is all the rage these days, support
59# it here. If the VIRTUALENV variable is set to anything other than
60# "no", set up a new virtualenv and install there, otherwise install
61# as usual from setup.py
0a2eecf8
BI
62install: installdirs
63 $(NORMAL_INSTALL)
64ifneq ($(VIRTUALENV),no)
297a262c
BI
65 $(VIRTUALENV) $(VIRTUALENV_FLAGS) --python=$(PYTHON) \
66 --system-site-packages $(DESTDIR)$(prefix) || \
67 $(VIRTUALENV) $(DESTDIR)$(prefix)
68 $(DESTDIR)$(prefix)/bin/python $(srcdir)/setup.py install \
69 --prefix=$(DESTDIR)$(prefix)
0a2eecf8
BI
70else
71 $(PYTHON) $(srcdir)/setup.py install --prefix=$(DESTDIR)$(prefix)
72endif
a09f66ad
BI
73 if [[ $(DESTDIR)$(prefix) != $(srcdir) ]]; then
74 $(INSTALL_DATA) $(srcdir)/Makefile $(DESTDIR)$(prefix)/Makefile
75 $(INSTALL_DATA) $(srcdir)/lazycelery.sh $(DESTDIR)$(prefix)/lazycelery.sh
76 $(INSTALL_DATA) $(srcdir)/lazyserver.sh $(DESTDIR)$(prefix)/lazyserver.sh
77 fi
0a2eecf8
BI
78
79# The same as "install", except use the "develop" setup.py target
80develop: installdirs
81 $(NORMAL_INSTALL)
82ifneq ($(VIRTUALENV),no)
297a262c
BI
83 $(VIRTUALENV) $(VIRTUALENV_FLAGS) --python=$(PYTHON) \
84 --system-site-packages $(DESTDIR)$(prefix) || \
85 $(VIRTUALENV) $(DESTDIR)$(prefix)
86 $(DESTDIR)$(prefix)/bin/python $(srcdir)/setup.py develop \
87 --prefix=$(DESTDIR)$(prefix)
0a2eecf8
BI
88else
89 $(PYTHON) $(srcdir)/setup.py develop --prefix=$(DESTDIR)$(prefix)
90endif
a09f66ad
BI
91 if [[ $(DESTDIR)$(prefix) != $(srcdir) ]]; then
92 $(INSTALL_DATA) $(srcdir)/Makefile $(DESTDIR)$(prefix)/Makefile
93 $(INSTALL_DATA) $(srcdir)/lazycelery.sh $(DESTDIR)$(prefix)/lazycelery.sh
94 $(INSTALL_DATA) $(srcdir)/lazyserver.sh $(DESTDIR)$(prefix)/lazyserver.sh
95 fi
0a2eecf8
BI
96
97
98# setup.py doesn't (yet) support an uninstall command, so until it does, you
99# must manually remove everything that was installed here. The following example
100# should remove a basic package installed via setup.py, but please double- and
101# triple-check it so that you don't remove something you shouldn't!
102# Be sure to remove any extra files you install, such as binaries or documentation!
297a262c
BI
103# uninstall:
104# rm -rvf $(pkgpythondir)
105# rm -v $(pythondir)/$(PACKAGE_DISTNAME)-*.egg-info
0a2eecf8
BI
106
107
108# Just use the usual setup.py clean command
109clean:
110 $(PYTHON) setup.py clean
111
112
113# Clean up the output of configure
114distclean:
115 rm -v $(srcdir)/config.log
116 rm -v $(srcdir)/config.status
117 rm -rvf $(srcdir)/autom4te.cache
118 rm -v $(srcdir)/Makefile
119
120# You can either use the setup.py sdist command or you can roll your own here
121dist:
122# $(PYTHON) setup.py sdist
123 mkdir $(PACKAGE_DISTNAME)
124 cp -r $(DISTFILES) $(PACKAGE_DISTNAME)
125 tar -czf $(PACKAGE_DISTNAME).tar.gz $(PACKAGE_DISTNAME)
126 rm -rf $(PACKAGE_DISTNAME)
127
128# Use the setup.py check command
129check:
130 $(PYTHON) setup.py check
131
132# setup.py might complain if a directory doesn't exist so just in case, make the directory
133# here
134installdirs:
135 $(MKDIR_P) $(DESTDIR)$(pkgpythondir)
136
137# Set up PostgreSQL
138postgresql:
139 sudo -u postgres createuser mediagoblin
140 sudo -u postgres createdb -E UNICODE -O mediagoblin mediagoblin
141
142update:
143ifneq ($(VIRTUALENV),no)
297a262c 144 $(prefix)/bin/python $(srcdir)/setup.py develop --prefix=$(prefix) --upgrade
0a2eecf8 145else
297a262c 146 $(PYTHON) $(srcdir)/setup.py develop --prefix=$(prefix) --upgrade
0a2eecf8
BI
147endif
148 $(prefix)/bin/gmg dbupdate
149
150# The following show how to install documentation. In this example,
151# docs are built from a separate Makefile contained in the docs
152# directory which uses the SPHINXBUILD variable to store the location
153# of the sphinx-build (Python doc tool) binary to use.
154
155$(DESTDIR)$(infodir)/mediagoblin.info: docs/build/texinfo/mediagoblin.info
156 $(POST_INSTALL)
157 $(INSTALL_DATA) @< $(DESTDIR)$@
158 if $(SHELL) -c 'install-info --version' >/dev/null 2>&1; then
159 install-info --dir-file=$(DESTDIR)$(infodir)/dir \
160 $(DESTDIR)$(infodir)/foo.info;
161 else true; fi
162
163info: docs/build/texinfo/mediagoblin.info
164
165docs/build/texinfo/mediagoblin.info: $(wildcard docs/source/*)
166ifneq ($(SPHINXBUILD),no)
167 $(MAKE) -C docs info SPHINXBUILD=$(SPHINXBUILD)
168endif
169
170
171install-html: html installdirs
172 $(INSTALL_DATA) docs/build/html/* $(DESTDIR)$(htmldir)
173
174html: docs/build/html/index.html
175
176docs/build/html/index.html: $(wildcard $(srcdir)/docs/source/*)
177ifneq ($(SPHINXBUILD),no)
178 $(MAKE) -C docs html SPHINXBUILD=$(SPHINXBUILD)
179endif
180
181
182install-pdf: pdf installdirs
183 $(INSTALL_DATA) docs/build/latex/mediagoblin.pdf $(DESTDIR)$(pdfdir)
184
185pdf: docs/build/latex/mediagoblin.pdf
186
187docs/build/latex/mediagoblin.pdf: $(wildcard $(srcdir)/docs/source/*)
188ifneq ($(SPHINXBUILD),no)
189 $(MAKE) -C docs latexpdf SPHINXBUILD=$(SPHINXBUILD)
190endif
191
192
193install-dvi:
194
195dvi:
196
197install-ps:
198
199ps:
200
201