cdist-backup/Makefile

247 lines
6.3 KiB
Makefile
Raw Normal View History

#
# 2013 Nico Schottelius (nico-cdist at schottelius.org)
#
# This file is part of cdist.
#
# cdist is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# cdist is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with cdist. If not, see <http://www.gnu.org/licenses/>.
#
#
helper=./bin/build-helper
MANDIR=docs/man
SPEECHDIR=docs/speeches
TYPEDIR=cdist/conf/type
WEBSRCDIR=docs/web
WEBDIR=$$HOME/vcs/www.nico.schottelius.org
WEBBLOG=$(WEBDIR)/blog
WEBBASE=$(WEBDIR)/software/cdist
WEBPAGE=$(WEBBASE).mdwn
CHANGELOG_VERSION=$(shell $(helper) changelog-version)
CHANGELOG_FILE=docs/changelog
PYTHON_VERSION=cdist/version.py
2016-05-20 06:50:56 +00:00
SPHINXM=make -C $(MANDIR) man
SPHINXH=make -C $(MANDIR) html
################################################################################
# Manpages
#
MAN1DSTDIR=$(MANDIR)/man1
MAN7DSTDIR=$(MANDIR)/man7
# Manpages #1: Types
2016-05-20 06:50:56 +00:00
# Use shell / ls to get complete list - $(TYPEDIR)/*/man.rst does not work
MANTYPESRC=$(shell ls $(TYPEDIR)/*/man.rst)
MANTYPEPREFIX=$(subst $(TYPEDIR)/,$(MAN7DSTDIR)/cdist-type,$(MANTYPESRC))
2016-05-20 06:50:56 +00:00
MANTYPES=$(subst /man.rst,.rst,$(MANTYPEPREFIX))
2016-05-20 06:50:56 +00:00
# Link manpage: do not create man.html but correct named file
$(MAN7DSTDIR)/cdist-type%.rst: $(TYPEDIR)/%/man.rst
ln -sf "../../../$^" $@
# Manpages #2: reference
2016-05-20 06:50:56 +00:00
MANREF=$(MAN7DSTDIR)/cdist-reference.rst
MANREFSH=$(MANDIR)/cdist-reference.rst.sh
$(MANREF): $(MANREFSH)
$(MANREFSH)
2016-05-20 06:50:56 +00:00
# Manpages #3: generic part
mansphinxman: $(MANTYPES) $(MANREF)
$(SPHINXM)
2016-05-20 06:50:56 +00:00
mansphinxhtml: $(MANTYPES) $(MANREF)
$(SPHINXH)
2016-05-20 06:50:56 +00:00
man: mansphinxman mansphinxhtml
# Manpages #5: release part
MANWEBDIR=$(WEBBASE)/man/$(CHANGELOG_VERSION)
2016-05-20 06:50:56 +00:00
MANBUILDDIR=$(MANDIR)/_build/html
2016-05-20 06:50:56 +00:00
man-dist: man
rm -rf "${MANWEBDIR}"
2016-05-20 06:50:56 +00:00
mkdir -p "${MANWEBDIR}"
# mkdir -p "${MANWEBDIR}/man1" "${MANWEBDIR}/man7"
# cp ${MAN1DSTDIR}/*.html ${MAN1DSTDIR}/*.css ${MANWEBDIR}/man1
# cp ${MAN7DSTDIR}/*.html ${MAN7DSTDIR}/*.css ${MANWEBDIR}/man7
cp -R ${MANBUILDDIR}/* ${MANWEBDIR}
cd ${MANWEBDIR} && git add . && git commit -m "cdist manpages update: $(CHANGELOG_VERSION)" || true
man-latest-link: web-pub
# Fix ikiwiki, which does not like symlinks for pseudo security
ssh staticweb.ungleich.ch \
"cd /home/services/www/nico/nico.schottelius.org/www/software/cdist/man/ && rm -f latest && ln -sf "$(CHANGELOG_VERSION)" latest"
# Manpages: .cdist Types
DOT_CDIST_PATH=${HOME}/.cdist
DOTMAN7DSTDIR=$(MAN7DSTDIR)
DOTTYPEDIR=$(DOT_CDIST_PATH)/type
$(info $(DOTTYPEDIR))
DOTMANTYPESRC=$(shell ls $(DOTTYPEDIR)/*/man.rst)
$(info $(DOTMANTYPESRC))
DOTMANTYPEPREFIX=$(subst $(DOTTYPEDIR)/,$(DOTMAN7DSTDIR)/cdist-type,$(DOTMANTYPESRC))
$(info $(DOTMANTYPEPREFIX))
DOTMANTYPES=$(subst /man.rst,.rst,$(DOTMANTYPEPREFIX))
$(info $(DOTMANTYPES))
# Link manpage: do not create man.html but correct named file
$(DOTMAN7DSTDIR)/cdist-type%.rst: $(DOTTYPEDIR)/%/man.rst
ln -sf "$^" $@
# Manpages #3: generic part
dotmansphinxman: $(DOTMANTYPES)
$(SPHINXM)
dotman: dotmansphinxman
################################################################################
# Speeches
#
SPEECHESOURCES=$(SPEECHDIR)/*.tex
SPEECHES=$(SPEECHESOURCES:.tex=.pdf)
SPEECHESWEBDIR=$(WEBBASE)/speeches
# Create speeches and ensure Toc is up-to-date
$(SPEECHDIR)/%.pdf: $(SPEECHDIR)/%.tex
pdflatex -output-directory $(SPEECHDIR) $^
pdflatex -output-directory $(SPEECHDIR) $^
pdflatex -output-directory $(SPEECHDIR) $^
speeches: $(SPEECHES)
speeches-dist: speeches
rm -rf "${SPEECHESWEBDIR}"
mkdir -p "${SPEECHESWEBDIR}"
cp ${SPEECHES} "${SPEECHESWEBDIR}"
cd ${SPEECHESWEBDIR} && git add . && git commit -m "cdist speeches updated" || true
################################################################################
# Website
#
BLOGFILE=$(WEBBLOG)/cdist-$(CHANGELOG_VERSION)-released.mdwn
$(BLOGFILE): $(CHANGELOG_FILE)
$(helper) blog $(CHANGELOG_VERSION) $(BLOGFILE)
web-blog: $(BLOGFILE)
web-doc:
# Go to top level, because of cdist.mdwn
rsync -av "$(WEBSRCDIR)/" "${WEBBASE}/.."
cd "${WEBBASE}/.." && git add cdist* && git commit -m "cdist doc update" cdist* || true
web-dist: web-blog web-doc
web-pub: web-dist man-dist speeches-dist
cd "${WEBDIR}" && make pub
web-release-all: man-latest-link
web-release-all-no-latest: web-pub
################################################################################
# Release: Mailinglist
#
ML_FILE=.lock-ml
# Only send mail once - lock until new changelog things happened
$(ML_FILE): $(CHANGELOG_FILE)
$(helper) ml-release $(CHANGELOG_VERSION)
touch $@
ml-release: $(ML_FILE)
################################################################################
# pypi
#
PYPI_FILE=.pypi-release
$(PYPI_FILE): man $(PYTHON_VERSION)
python3 setup.py sdist upload
touch $@
pypi-release: $(PYPI_FILE)
################################################################################
# archlinux
#
ARCHLINUX_FILE=.lock-archlinux
ARCHLINUXTAR=cdist-$(CHANGELOG_VERSION)-1.src.tar.gz
$(ARCHLINUXTAR): PKGBUILD
umask 022; mkaurball
PKGBUILD: PKGBUILD.in $(PYTHON_VERSION)
./PKGBUILD.in $(CHANGELOG_VERSION)
$(ARCHLINUX_FILE): $(ARCHLINUXTAR) $(PYTHON_VERSION)
burp -c system $(ARCHLINUXTAR)
touch $@
archlinux-release: $(ARCHLINUX_FILE)
################################################################################
# Release
#
$(PYTHON_VERSION): .git/refs/heads/master
$(helper) version
# Code that is better handled in a shell script
check-%:
$(helper) $@
release:
$(helper) $@
################################################################################
# Cleanup
#
clean:
2016-05-20 06:50:56 +00:00
rm -f $(MAN7DSTDIR)/cdist-reference.rst
find "$(MANDIR)" -mindepth 2 -type l \
| xargs rm -f
2016-05-20 06:50:56 +00:00
make -C $(MANDIR) clean
find * -name __pycache__ | xargs rm -rf
# Archlinux
rm -f cdist-*.pkg.tar.xz cdist-*.tar.gz
rm -rf pkg/ src/
rm -f MANIFEST PKGBUILD
rm -rf dist/
distclean: clean
rm -f cdist/version.py
################################################################################
# Misc
#
# The pub is Nico's "push to all git remotes" way ("make pub")
pub:
git push --mirror
test:
$(helper) $@