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