Clarify the "make clean" caution'ing
[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@
0a2eecf8
BI
27SHELL = @SHELL@
28MKDIR_P = @MKDIR_P@
29INSTALL = @INSTALL@
30INSTALL_PROGRAM = @INSTALL_PROGRAM@
31INSTALL_DATA = @INSTALL_DATA@
32INSTALL_SCRIPT = @INSTALL_SCRIPT@
33docdir = @docdir@
34dvidir = @dvidir@
35exec_prefix = @exec_prefix@
36htmldir = @htmldir@
37includedir = @includedir@
38infodir = @infodir@
39prefix = @prefix@
40srcdir = @srcdir@
e56b493a 41abs_srcdir = @abs_srcdir@
0a2eecf8
BI
42datadir = @datadir@
43datarootdir = @datarootdir@
0a2eecf8
BI
44pkgdatadir = $(datadir)/@PACKAGE_NAME@
45pkgincludedir = $(includedir)/@PACKAGE_NAME@
0a2eecf8 46PYTHONPATH = $(pythondir)$(PATH_SEPARATOR)$(DESTDIR)$(pythondir)
65686465 47USE_PYTHON3 = @USE_PYTHON3@
0a2eecf8 48
d466977d
CAW
49EXTLIB_INSTALLS = extlib/jquery extlib/video.js extlib/leaflet extlib/tinymce
50
96f9c530
CAW
51# pkgpythondir = @pkgpythondir@
52# pkgpyexecdir = @pkgpyexecdir@
53# pythondir = @pythondir@
54# pyexecdir = @pyexecdir@
55# SPHINXBUILD = @SPHINXBUILD@
56# POSTGRES = @POSTGRES@
57
58
07778a69
CAW
59# Maybe add a virtualenv prefix to a command
60ifneq ($(VIRTUALENV),no)
61# virtualenv specified to be included by config (default)
62# ... we only use virtualenv for local development, we don't
63# auto-deploy to it.
0a2eecf8 64
07778a69
CAW
65maybe_venved = ./bin/
66maybe_venved_python = ./bin/python
67# Yes, build the virtualenv as a dependency!
d466977d 68maybe_venv_dep = virtualenv
1da574c6
CAW
69# And to clean up!
70maybe_venv_clean = clean-virtualenv
0a2eecf8 71
0a2eecf8 72else
07778a69
CAW
73# --without-virtualenv must have been passed in... don't build
74# a local virtualenv or use such commands
75maybe_venved =
76maybe_venved_python = $(PYTHON)
77# No need for commands to build virtualenv as a dependency!
78maybe_venv_dep =
1da574c6
CAW
79# Nor to clean up!
80maybe_venv_clean =
0a2eecf8 81endif
07778a69 82
07778a69
CAW
83.PHONY: all install uninstall distclean info install-html html \
84install-pdf pdf install-dvi dvi install-ps ps clean dist check \
572106e2 85installdirs i18n virtualenv docs extlib
2f841a6c 86
07778a69
CAW
87# update postgresql
88
89all: develop
90
2f841a6c 91docs:
d466977d 92ifneq ($(VIRTUALENV),no)
2f841a6c
CAW
93 source bin/activate && cd docs && make html
94else
95 cd docs && make html
96endif
97
572106e2
CAW
98# In the future we may provide more options than just npm/bower here
99# eg, we may support guix updating.
100extlib:
101 ./devtools/update_extlib.sh
102
2b475821 103develop: $(maybe_venv_dep) i18n mediagoblin.ini
adecace3 104
86f89fd0 105# NEVER clobber a user's mediagoblin.ini once they've defined it
b2624eb0
CAW
106mediagoblin.ini:
107 cp --no-clobber mediagoblin.example.ini mediagoblin.ini
108
96f9c530
CAW
109# base-configs: paste.ini mediagoblin.example.ini
110
07778a69
CAW
111install: installdirs
112 $(maybe_venved_python) $(srcdir)/setup.py install --prefix=$(DESTDIR)$(prefix)
113
114
4aaa7fac 115# In the future, maybe we can compile the individual .po files here?
07778a69 116i18n: $(maybe_venv_dep)
4aaa7fac 117 ./devtools/compile_translations.sh
07778a69
CAW
118
119
0a2eecf8 120ifneq ($(VIRTUALENV),no)
07778a69
CAW
121./bin/python:
122 rm -f ./bin/python
1da574c6 123 virtualenv --system-site-packages --python=$(PYTHON) .
07778a69 124 ./bin/python setup.py develop --upgrade
0a2eecf8 125
572106e2 126virtualenv: bin/python extlib
96f9c530
CAW
127
128clean-virtualenv:
129 rm -rf ./bin/
130 rm -rf ./lib/
90c2989b 131 rm -rf ./include/
07778a69 132endif
0a2eecf8
BI
133
134# setup.py doesn't (yet) support an uninstall command, so until it does, you
135# must manually remove everything that was installed here. The following example
136# should remove a basic package installed via setup.py, but please double- and
137# triple-check it so that you don't remove something you shouldn't!
138# Be sure to remove any extra files you install, such as binaries or documentation!
a9dc855a 139#
297a262c 140# uninstall:
a9dc855a
CAW
141# rm -rvf $(pkgpythondir)
142# rm -v $(pythondir)/$(PACKAGE_DISTNAME)-*.egg-info
143#
0a2eecf8 144
86f89fd0 145
0a2eecf8 146clean:
86f89fd0 147 @echo "No rule to clean house, yet."
9cc496f4 148 @echo "distclean works but might do more than you want. :)"
86f89fd0
CAW
149
150
151# We don't know what this does yet.
152# Originally:
153## Just use the usual setup.py clean command
154#clean:
155# $(maybe_venved_python) setup.py clean
156
0a2eecf8 157
d466977d
CAW
158# It's not obvious to me whether the virtualenv/bower/npm things should be
159# auto-cleaned as part of distclean. I'm leaning towards "yes" for now but
160# I'm not really happy about that.
0a2eecf8
BI
161
162# Clean up the output of configure
1da574c6
CAW
163distclean: $(maybe_venv_clean)
164 rm -vf $(srcdir)/config.log
165 rm -vf $(srcdir)/config.status
0a2eecf8 166 rm -rvf $(srcdir)/autom4te.cache
1da574c6 167 rm -vf $(srcdir)/aclocal.m4
d466977d
CAW
168 rm -rf $(EXTLIB_INSTALLS)
169 rm -rf node_modules
1da574c6 170 rm -vf $(srcdir)/Makefile
96f9c530 171
0a2eecf8 172
2b475821
CAW
173###########################################################################
174# These things aren't really tested / supported yet.
175###########################################################################
176
177
178
0a2eecf8 179# You can either use the setup.py sdist command or you can roll your own here
572106e2 180dist: extlib
07778a69 181# $(maybe_venved_python) setup.py sdist
0a2eecf8
BI
182 mkdir $(PACKAGE_DISTNAME)
183 cp -r $(DISTFILES) $(PACKAGE_DISTNAME)
184 tar -czf $(PACKAGE_DISTNAME).tar.gz $(PACKAGE_DISTNAME)
185 rm -rf $(PACKAGE_DISTNAME)
186
187# Use the setup.py check command
188check:
07778a69 189 $(maybe_venved_python) setup.py check
0a2eecf8
BI
190
191# setup.py might complain if a directory doesn't exist so just in case, make the directory
192# here
193installdirs:
d45673c0 194 $(MKDIR_P) $(DESTDIR)$(prefix)
0a2eecf8 195
07778a69
CAW
196# # Set up PostgreSQL
197# postgresql:
198# sudo -u $(POSTGRES) createuser mediagoblin
199# sudo -u $(POSTGRES) createdb -E UNICODE -O mediagoblin mediagoblin
0a2eecf8 200
07778a69
CAW
201# update:
202# ifneq ($(VIRTUALENV),no)
203# $(prefix)/bin/python $(srcdir)/setup.py develop --prefix=$(prefix) --upgrade
204# else
205# $(PYTHON) $(srcdir)/setup.py develop --prefix=$(prefix) --upgrade
206# endif
207# $(prefix)/bin/gmg dbupdate
0a2eecf8 208
2b475821
CAW
209######################
210# Needs to be updated?
211######################
212
0a2eecf8
BI
213# The following show how to install documentation. In this example,
214# docs are built from a separate Makefile contained in the docs
215# directory which uses the SPHINXBUILD variable to store the location
216# of the sphinx-build (Python doc tool) binary to use.
217
218$(DESTDIR)$(infodir)/mediagoblin.info: docs/build/texinfo/mediagoblin.info
219 $(POST_INSTALL)
220 $(INSTALL_DATA) @< $(DESTDIR)$@
221 if $(SHELL) -c 'install-info --version' >/dev/null 2>&1; then
222 install-info --dir-file=$(DESTDIR)$(infodir)/dir \
223 $(DESTDIR)$(infodir)/foo.info;
224 else true; fi
225
226info: docs/build/texinfo/mediagoblin.info
227
228docs/build/texinfo/mediagoblin.info: $(wildcard docs/source/*)
229ifneq ($(SPHINXBUILD),no)
230 $(MAKE) -C docs info SPHINXBUILD=$(SPHINXBUILD)
231endif
232
233
234install-html: html installdirs
235 $(INSTALL_DATA) docs/build/html/* $(DESTDIR)$(htmldir)
236
237html: docs/build/html/index.html
238
239docs/build/html/index.html: $(wildcard $(srcdir)/docs/source/*)
240ifneq ($(SPHINXBUILD),no)
241 $(MAKE) -C docs html SPHINXBUILD=$(SPHINXBUILD)
242endif
243
244
245install-pdf: pdf installdirs
246 $(INSTALL_DATA) docs/build/latex/mediagoblin.pdf $(DESTDIR)$(pdfdir)
247
248pdf: docs/build/latex/mediagoblin.pdf
249
250docs/build/latex/mediagoblin.pdf: $(wildcard $(srcdir)/docs/source/*)
251ifneq ($(SPHINXBUILD),no)
252 $(MAKE) -C docs latexpdf SPHINXBUILD=$(SPHINXBUILD)
253endif
254
255
07778a69
CAW
256# Targets that don't seem supported?
257
0a2eecf8
BI
258install-dvi:
259
260dvi:
261
262install-ps:
263
264ps:
265
266