Makefile
author František Kučera <franta-hg@frantovo.cz>
Tue, 01 Oct 2019 23:23:32 +0200
branchv_0
changeset 40 bc2043705ec5
parent 36 9e5c3383ba50
child 47 7e665331bc32
permissions -rw-r--r--
small fixes, typos

# Sane Software Manifesto helper tools
# Copyright © 2019 František Kučera (Frantovo.cz, GlobalCode.info)
#
# This program 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, version 3.
#
# This program 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 this program.  If not, see <https://www.gnu.org/licenses/>.

all: validate xhtml txt pdf logo-png statistics

validate:
	xmllint --noout --schema schema/ssm.xsd text/ssm.en.xml

xhtml:
	mkdir -p build
	xsltproc --output build/index.xhtml --nonet templates/ssm.xhtml.xsl text/ssm.en.xml
	cp templates/*.css build
	cp templates/*.woff build

pdf:
	mkdir -p build
	xsltproc --output build/ssm.en.fodt --nonet templates/ssm.odt.xsl text/ssm.en.xml
	libreoffice --convert-to pdf --outdir build build/ssm.en.fodt

# TODO: better line wrapping
txt:
	mkdir -p build
	xsltproc --nonet templates/ssm.txt.xsl text/ssm.en.xml | fmt -w 74 -s | sed -E 's/(  +)([^- ])/\1  \2/g' > build/ssm.en.txt

logo-png:
	mkdir -p build
	inkscape -z -e build/sane-software-logo-circle.png logo/sane-software-logo-circle.svg
	inkscape -z -e build/sane-software-logo-rectangle.png logo/sane-software-logo-rectangle.svg

clean:
	rm -rf build

publish:
	scp build/* globalcode.info:/var/www/sane-software.globalcode.info/v_0/


# Prints a table with number of items in particular chapters:
statistics:
	cat text/ssm.en.xml \
	    | relpipe-in-xmltable \
		--namespace "m" "tag:globalcode.info,2019:sane-software/manifesto" \
		--relation "chapter" \
		    --records "//m:chapter" \
		    --attribute "name" string "m:name" \
		    --attribute "item_count" integer "count(descendant::m:item)" \
	    | relpipe-out-tabular
# try also relpipe-out-gui to get the chart