+# Makefile.in
+#
+# Copyright © 2012, 2013 Brandon Invergo <brandon@invergo.net>
+# Copyright © 2014, 2015 Christopher Allan Webber <cwebber@dustycloud.org>
+#
+# 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.
+
+# List whatever files you want to include in your source distribution here.
+# You can include whole directories but note that *everything* under that
+# directory will be included
+DISTFILES = PKG-INFO Makefile.in configure setup.py install-sh
+
+DESTDIR =
VPATH = @srcdir@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_DISTNAME = ${PACKAGE_NAME}-${PACKAGE_VERSION}
PACKAGE_URL = @PACKAGE_URL@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
PYTHON = @PYTHON@
VIRTUALENV = @VIRTUALENV@
-SPHINXBUILD = @SPHINXBUILD@
SHELL = @SHELL@
MKDIR_P = @MKDIR_P@
INSTALL = @INSTALL@
infodir = @infodir@
prefix = @prefix@
srcdir = @srcdir@
+abs_srcdir = @abs_srcdir@
datadir = @datadir@
datarootdir = @datarootdir@
-pythondir = @pythondir@
-pyexecdir = @pyexecdir@
pkgdatadir = $(datadir)/@PACKAGE_NAME@
pkgincludedir = $(includedir)/@PACKAGE_NAME@
-pkgpythondir = @pkgpythondir@
-pkgpyexecdir = @pkgpyexecdir@
PYTHONPATH = $(pythondir)$(PATH_SEPARATOR)$(DESTDIR)$(pythondir)
+USE_PYTHON3 = @USE_PYTHON3@
-INSTALL_TARGET = develop
+EXTLIB_INSTALLS = extlib/jquery extlib/video.js extlib/leaflet extlib/tinymce
-all: install
+# pkgpythondir = @pkgpythondir@
+# pkgpyexecdir = @pkgpyexecdir@
+# pythondir = @pythondir@
+# pyexecdir = @pyexecdir@
+# SPHINXBUILD = @SPHINXBUILD@
+# POSTGRES = @POSTGRES@
-.PHONY: all install uninstall distclean info install-html html install-pdf pdf install-dvi dvi install-ps ps clean dist check installdirs
+# Maybe add a virtualenv prefix to a command
+ifneq ($(VIRTUALENV),no)
+# virtualenv specified to be included by config (default)
+# ... we only use virtualenv for local development, we don't
+# auto-deploy to it.
+maybe_venved = ./bin/
+maybe_venved_python = ./bin/python
+# Yes, build the virtualenv as a dependency!
+maybe_venv_dep = virtualenv
+# And to clean up!
+maybe_venv_clean = clean-virtualenv
-install: installdirs
- $(NORMAL_INSTALL)
+else
+# --without-virtualenv must have been passed in... don't build
+# a local virtualenv or use such commands
+maybe_venved =
+maybe_venved_python = $(PYTHON)
+# No need for commands to build virtualenv as a dependency!
+maybe_venv_dep =
+# Nor to clean up!
+maybe_venv_clean =
+endif
+
+.PHONY: all install uninstall distclean info install-html html \
+install-pdf pdf install-dvi dvi install-ps ps clean dist check \
+installdirs i18n virtualenv docs extlib
+
+# update postgresql
+
+all: develop
+
+docs:
ifneq ($(VIRTUALENV),no)
- $(VIRTUALENV) $(VIRTUALENV_FLAGS) $(DESTDIR)$(prefix) || $(VIRTUALENV) $(DESTDIR)$(prefix)
- $(DESTDIR)$(prefix)/bin/python $(srcdir)/setup.py $(INSTALL_TARGET) --prefix=$(DESTDIR)$(prefix)
+ source bin/activate && cd docs && make html
else
- $(PYTHON) $(srcdir)/setup.py $(INSTALL_TARGET) --prefix=$(DESTDIR)$(prefix)
+ cd docs && make html
endif
- $(INSTALL_SCRIPT) $(srcdir)/lazyserver.sh $(DESTDIR)$(pkgdatadir)
- $(INSTALL_SCRIPT) $(srcdir)/lazycelery.sh $(DESTDIR)$(pkgdatadir)
- $(INSTALL_SCRIPT) $(srcdir)/lazystarter.sh $(DESTDIR)$(pkgdatadir)
- $(INSTALL_DATA) $(srcdir)/mediagoblin.ini $(DESTDIR)$(pkgdatadir)
- $(INSTALL_DATA) $(srcdir)/paste.ini $(DESTDIR)$(pkgdatadir)
+# In the future we may provide more options than just npm/bower here
+# eg, we may support guix updating.
+extlib:
+ ./devtools/update_extlib.sh
-uninstall: $(wildcard $(srcdir)/docs/source/*)
- rm -rf $(DESTDIR)$(pkgdatadir)
- rm -rf $(DESTDIR)$(htmldir)
- rm -rf $(DESTDIR)$(pdfdir)
+develop: $(maybe_venv_dep) i18n mediagoblin.ini
+# NEVER clobber a user's mediagoblin.ini once they've defined it
+mediagoblin.ini:
+ cp -n mediagoblin.example.ini mediagoblin.ini
-clean:
- $(PYTHON) setup.py clean
+# base-configs: paste.ini mediagoblin.example.ini
+install: installdirs
+ $(maybe_venved_python) $(srcdir)/setup.py install --prefix=$(DESTDIR)$(prefix)
-distclean: $(wildcard $(srcdir)/docs/source/*)
- rm $(srcdir)/config.log
- rm $(srcdir)/config.status
+# In the future, maybe we can compile the individual .po files here?
+i18n: $(maybe_venv_dep)
+ ./devtools/compile_translations.sh
-$(DESTDIR)$(infodir)/gnumediagoblin.info: docs/build/texinfo/gnumediagoblin.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/gnumediagoblin.info
+ifneq ($(VIRTUALENV),no)
+./bin/python:
+ rm -f ./bin/python
+ ${VIRTUALENV} --system-site-packages --python=$(PYTHON) .
+ ./bin/python setup.py develop --upgrade
+
+virtualenv: bin/python extlib
-docs/build/texinfo/gnumediagoblin.info: $(wildcard docs/source/*)
-ifneq ($(SPHINX_BUILD),no)
- $(MAKE) -C docs info SPHINXBUILD=$(SPHINXBUILD)
+clean-virtualenv:
+ rm -rf ./bin/
+ rm -rf ./lib/
+ rm -rf ./include/
endif
+# setup.py doesn't (yet) support an uninstall command, so until it does, you
+# must manually remove everything that was installed here. The following example
+# should remove a basic package installed via setup.py, but please double- and
+# triple-check it so that you don't remove something you shouldn't!
+# Be sure to remove any extra files you install, such as binaries or documentation!
+#
+# uninstall:
+# rm -rvf $(pkgpythondir)
+# rm -v $(pythondir)/$(PACKAGE_DISTNAME)-*.egg-info
+#
+
+# We don't know what this does yet.
+# Originally:
+## Just use the usual setup.py clean command
+#clean:
+# $(maybe_venved_python) setup.py clean
+clean:
+ @echo "No rule to clean house, yet."
+ @echo "distclean works but might do more than you want. :)"
-install-html: html installdirs
- $(INSTALL_DATA) docs/build/html/* $(DESTDIR)$(htmldir)
-html: docs/build/html/index.html
+# It's not obvious to me whether the virtualenv/bower/npm things should be
+# auto-cleaned as part of distclean. I'm leaning towards "yes" for now but
+# I'm not really happy about that.
-docs/build/html/index.html: $(wildcard $(srcdir)/docs/source/*)
-ifneq ($(SPHINX_BUILD),no)
- $(MAKE) -C docs html SPHINXBUILD=$(SPHINXBUILD)
-endif
+# Clean up the output of configure
+distclean: $(maybe_venv_clean)
+ rm -vf $(srcdir)/config.log
+ rm -vf $(srcdir)/config.status
+ rm -rvf $(srcdir)/autom4te.cache
+ rm -vf $(srcdir)/aclocal.m4
+ rm -rf $(EXTLIB_INSTALLS)
+ rm -rf node_modules
+ rm -vf $(srcdir)/Makefile
+check:
+ ./runtests.sh
-install-pdf: pdf installdirs
- $(INSTALL_DATA) docs/build/latex/GNUMediaGoblin.pdf $(DESTDIR)$(pdfdir)
+###########################################################################
+# These things aren't really tested / supported yet.
+###########################################################################
-pdf: docs/build/latex/GNUMediaGoblin.pdf
-docs/build/latex/GNUMediaGoblin.pdf: $(wildcard $(srcdir)/docs/source/*)
-ifneq ($(SPHINX_BUILD),no)
- $(MAKE) -C docs latexpdf SPHINXBUILD=$(SPHINXBUILD)
-endif
+## NOTE: We don't use this yet, we use ./devtools/maketarball.sh
+## We can't switch out ./devtools/maketarball.sh in here because
+## it requires a git revision as a first argument, which
+## doesn't always work here
+dist: $(maybe_venv_dep)
+ $(maybe_venved_python) setup.py sdist
-install-dvi:
+# setup.py might complain if a directory doesn't exist so just in case, make the directory
+# here
+installdirs:
+ $(MKDIR_P) $(DESTDIR)$(prefix)
-dvi:
+######################
+# Needs to be updated?
+######################
-install-ps:
+# The following show how to install documentation. In this example,
+# 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)/mediagoblin.info: docs/build/texinfo/mediagoblin.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)/foo.info;
+ else true; fi
-ps:
+info: docs/build/texinfo/mediagoblin.info
+docs/build/texinfo/mediagoblin.info: $(wildcard docs/source/*)
+ifneq ($(VIRTUALENV),no)
+ source bin/activate && cd docs && make info
+else
+ cd docs && make info
+endif
-dist:
- $(PYTHON) setup.py sdist
-check:
- $(PYTHON) setup.py check
+install-html: html installdirs
+ $(INSTALL_DATA) docs/build/html/* $(DESTDIR)$(htmldir)
-installdirs:
- $(MKDIR_P) \
- $(DESTDIR)$(pkgpythondir) \
- $(DESTDIR)$(pkgdatadir) \
- $(DESTDIR)$(htmldir) \
- $(DESTDIR)$(pdfdir)
+html: docs