Makefile
author František Kučera <franta-hg@frantovo.cz>
Sun, 06 Oct 2019 22:12:47 +0200
branchv_0
changeset 55 fe39d6940821
parent 54 9f5de01bfd30
child 67 78eca0b3ab5f
permissions -rw-r--r--
clean-up and update of chapters: Testable Safe code and sustainability Small code footprint Sane dependencies Easily auditable Reproducible builds Trustworthy packages and sources
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
51
21dfb69028a0 name: Sane software manifesto (lower case)
František Kučera <franta-hg@frantovo.cz>
parents: 49
diff changeset
     1
# Sane software manifesto helper tools
15
96fc2f42b1e1 conversion to XML format, XSD, XSLT
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     2
# Copyright © 2019 František Kučera (Frantovo.cz, GlobalCode.info)
96fc2f42b1e1 conversion to XML format, XSD, XSLT
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     3
#
96fc2f42b1e1 conversion to XML format, XSD, XSLT
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     4
# This program is free software: you can redistribute it and/or modify
96fc2f42b1e1 conversion to XML format, XSD, XSLT
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     5
# it under the terms of the GNU General Public License as published by
96fc2f42b1e1 conversion to XML format, XSD, XSLT
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     6
# the Free Software Foundation, version 3.
96fc2f42b1e1 conversion to XML format, XSD, XSLT
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     7
#
96fc2f42b1e1 conversion to XML format, XSD, XSLT
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     8
# This program is distributed in the hope that it will be useful,
96fc2f42b1e1 conversion to XML format, XSD, XSLT
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     9
# but WITHOUT ANY WARRANTY; without even the implied warranty of
96fc2f42b1e1 conversion to XML format, XSD, XSLT
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    10
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
96fc2f42b1e1 conversion to XML format, XSD, XSLT
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    11
# GNU General Public License for more details.
96fc2f42b1e1 conversion to XML format, XSD, XSLT
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    12
#
96fc2f42b1e1 conversion to XML format, XSD, XSLT
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    13
# You should have received a copy of the GNU General Public License
96fc2f42b1e1 conversion to XML format, XSD, XSLT
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    14
# along with this program.  If not, see <https://www.gnu.org/licenses/>.
96fc2f42b1e1 conversion to XML format, XSD, XSLT
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    15
51
21dfb69028a0 name: Sane software manifesto (lower case)
František Kučera <franta-hg@frantovo.cz>
parents: 49
diff changeset
    16
VERSION_PARAMS := $(shell hg log -r '.' --template '--stringparam versionTag {latesttag} --stringparam versionDistance {latesttagdistance} --stringparam versionHash {node|short}') "--stringparam" "versionChangedFiles" $(shell hg status | wc -l) 
49
1dc027689f93 print version from Mercurial
František Kučera <franta-hg@frantovo.cz>
parents: 47
diff changeset
    17
36
9e5c3383ba50 add PDF output (using LibreOffice)
František Kučera <franta-hg@frantovo.cz>
parents: 33
diff changeset
    18
all: validate xhtml txt pdf logo-png statistics
25
8da11cce2c98 add TXT output + change directory structure
František Kučera <franta-hg@frantovo.cz>
parents: 20
diff changeset
    19
15
96fc2f42b1e1 conversion to XML format, XSD, XSLT
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    20
validate:
25
8da11cce2c98 add TXT output + change directory structure
František Kučera <franta-hg@frantovo.cz>
parents: 20
diff changeset
    21
	xmllint --noout --schema schema/ssm.xsd text/ssm.en.xml
8da11cce2c98 add TXT output + change directory structure
František Kučera <franta-hg@frantovo.cz>
parents: 20
diff changeset
    22
15
96fc2f42b1e1 conversion to XML format, XSD, XSLT
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    23
xhtml:
25
8da11cce2c98 add TXT output + change directory structure
František Kučera <franta-hg@frantovo.cz>
parents: 20
diff changeset
    24
	mkdir -p build
49
1dc027689f93 print version from Mercurial
František Kučera <franta-hg@frantovo.cz>
parents: 47
diff changeset
    25
	xsltproc $(VERSION_PARAMS) --output build/index.xhtml --nonet templates/ssm.xhtml.xsl text/ssm.en.xml
25
8da11cce2c98 add TXT output + change directory structure
František Kučera <franta-hg@frantovo.cz>
parents: 20
diff changeset
    26
	cp templates/*.css build
30
841bec790da8 add Sawasdee.woff web font
František Kučera <franta-hg@frantovo.cz>
parents: 27
diff changeset
    27
	cp templates/*.woff build
25
8da11cce2c98 add TXT output + change directory structure
František Kučera <franta-hg@frantovo.cz>
parents: 20
diff changeset
    28
36
9e5c3383ba50 add PDF output (using LibreOffice)
František Kučera <franta-hg@frantovo.cz>
parents: 33
diff changeset
    29
pdf:
9e5c3383ba50 add PDF output (using LibreOffice)
František Kučera <franta-hg@frantovo.cz>
parents: 33
diff changeset
    30
	mkdir -p build
49
1dc027689f93 print version from Mercurial
František Kučera <franta-hg@frantovo.cz>
parents: 47
diff changeset
    31
	xsltproc $(VERSION_PARAMS) --output build/ssm.en.fodt --nonet templates/ssm.odt.xsl text/ssm.en.xml
36
9e5c3383ba50 add PDF output (using LibreOffice)
František Kučera <franta-hg@frantovo.cz>
parents: 33
diff changeset
    32
	libreoffice --convert-to pdf --outdir build build/ssm.en.fodt
9e5c3383ba50 add PDF output (using LibreOffice)
František Kučera <franta-hg@frantovo.cz>
parents: 33
diff changeset
    33
25
8da11cce2c98 add TXT output + change directory structure
František Kučera <franta-hg@frantovo.cz>
parents: 20
diff changeset
    34
# TODO: better line wrapping
8da11cce2c98 add TXT output + change directory structure
František Kučera <franta-hg@frantovo.cz>
parents: 20
diff changeset
    35
txt:
8da11cce2c98 add TXT output + change directory structure
František Kučera <franta-hg@frantovo.cz>
parents: 20
diff changeset
    36
	mkdir -p build
49
1dc027689f93 print version from Mercurial
František Kučera <franta-hg@frantovo.cz>
parents: 47
diff changeset
    37
	xsltproc $(VERSION_PARAMS) --nonet templates/ssm.txt.xsl text/ssm.en.xml | fmt -w 74 -s | sed -E 's/(  +)([^- ])/\1  \2/g' > build/ssm.en.txt
15
96fc2f42b1e1 conversion to XML format, XSD, XSLT
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    38
33
d6cb9fe26aed logo: the first draft
František Kučera <franta-hg@frantovo.cz>
parents: 30
diff changeset
    39
logo-png:
d6cb9fe26aed logo: the first draft
František Kučera <franta-hg@frantovo.cz>
parents: 30
diff changeset
    40
	mkdir -p build
d6cb9fe26aed logo: the first draft
František Kučera <franta-hg@frantovo.cz>
parents: 30
diff changeset
    41
	inkscape -z -e build/sane-software-logo-circle.png logo/sane-software-logo-circle.svg
d6cb9fe26aed logo: the first draft
František Kučera <franta-hg@frantovo.cz>
parents: 30
diff changeset
    42
	inkscape -z -e build/sane-software-logo-rectangle.png logo/sane-software-logo-rectangle.svg
d6cb9fe26aed logo: the first draft
František Kučera <franta-hg@frantovo.cz>
parents: 30
diff changeset
    43
15
96fc2f42b1e1 conversion to XML format, XSD, XSLT
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    44
clean:
25
8da11cce2c98 add TXT output + change directory structure
František Kučera <franta-hg@frantovo.cz>
parents: 20
diff changeset
    45
	rm -rf build
18
f315b3d27a9d make: publish
František Kučera <franta-hg@frantovo.cz>
parents: 15
diff changeset
    46
f315b3d27a9d make: publish
František Kučera <franta-hg@frantovo.cz>
parents: 15
diff changeset
    47
publish:
51
21dfb69028a0 name: Sane software manifesto (lower case)
František Kučera <franta-hg@frantovo.cz>
parents: 49
diff changeset
    48
	scp build/*     globalcode.info:/var/www/sane-software.globalcode.info/v_0/
21dfb69028a0 name: Sane software manifesto (lower case)
František Kučera <franta-hg@frantovo.cz>
parents: 49
diff changeset
    49
	scp license/*   globalcode.info:/var/www/sane-software.globalcode.info/license/
20
fb939d9baaf4 make: statistics (just for fun)
František Kučera <franta-hg@frantovo.cz>
parents: 18
diff changeset
    50
fb939d9baaf4 make: statistics (just for fun)
František Kučera <franta-hg@frantovo.cz>
parents: 18
diff changeset
    51
54
9f5de01bfd30 fix indentation in Makefile
František Kučera <franta-hg@frantovo.cz>
parents: 51
diff changeset
    52
# Described at: https://relational-pipes.globalcode.info/v_0/examples-in-xmltable-ssm-gui.xhtml
47
7e665331bc32 item classification: requirement, recommendation, information
František Kučera <franta-hg@frantovo.cz>
parents: 36
diff changeset
    53
build/statistics.rp: text/ssm.en.xml
7e665331bc32 item classification: requirement, recommendation, information
František Kučera <franta-hg@frantovo.cz>
parents: 36
diff changeset
    54
	mkdir -p build
27
413a00a9cde7 merge two sections into Semantic versioning and upgrades
František Kučera <franta-hg@frantovo.cz>
parents: 25
diff changeset
    55
	cat text/ssm.en.xml \
54
9f5de01bfd30 fix indentation in Makefile
František Kučera <franta-hg@frantovo.cz>
parents: 51
diff changeset
    56
		| relpipe-in-xmltable \
9f5de01bfd30 fix indentation in Makefile
František Kučera <franta-hg@frantovo.cz>
parents: 51
diff changeset
    57
			--namespace "m" "tag:globalcode.info,2019:sane-software/manifesto" \
9f5de01bfd30 fix indentation in Makefile
František Kučera <franta-hg@frantovo.cz>
parents: 51
diff changeset
    58
			--relation "chapter" \
9f5de01bfd30 fix indentation in Makefile
František Kučera <franta-hg@frantovo.cz>
parents: 51
diff changeset
    59
				--records "//m:chapter" \
9f5de01bfd30 fix indentation in Makefile
František Kučera <franta-hg@frantovo.cz>
parents: 51
diff changeset
    60
				--attribute "name" string "m:name" \
9f5de01bfd30 fix indentation in Makefile
František Kučera <franta-hg@frantovo.cz>
parents: 51
diff changeset
    61
				--attribute "requirements" integer "count(descendant::m:item[m:type='requirement'])" \
9f5de01bfd30 fix indentation in Makefile
František Kučera <franta-hg@frantovo.cz>
parents: 51
diff changeset
    62
				--attribute "recommendations" integer "count(descendant::m:item[m:type='recommendation'])" \
9f5de01bfd30 fix indentation in Makefile
František Kučera <franta-hg@frantovo.cz>
parents: 51
diff changeset
    63
				--attribute "informations" integer "count(descendant::m:item[m:type='information'])" \
9f5de01bfd30 fix indentation in Makefile
František Kučera <franta-hg@frantovo.cz>
parents: 51
diff changeset
    64
				--attribute "items_total" integer "count(descendant::m:item)" \
9f5de01bfd30 fix indentation in Makefile
František Kučera <franta-hg@frantovo.cz>
parents: 51
diff changeset
    65
		> build/statistics.rp
47
7e665331bc32 item classification: requirement, recommendation, information
František Kučera <franta-hg@frantovo.cz>
parents: 36
diff changeset
    66
7e665331bc32 item classification: requirement, recommendation, information
František Kučera <franta-hg@frantovo.cz>
parents: 36
diff changeset
    67
# Prints a table with number of items in particular chapters:
7e665331bc32 item classification: requirement, recommendation, information
František Kučera <franta-hg@frantovo.cz>
parents: 36
diff changeset
    68
statistics: build/statistics.rp
7e665331bc32 item classification: requirement, recommendation, information
František Kučera <franta-hg@frantovo.cz>
parents: 36
diff changeset
    69
	cat build/statistics.rp | relpipe-out-tabular
7e665331bc32 item classification: requirement, recommendation, information
František Kučera <franta-hg@frantovo.cz>
parents: 36
diff changeset
    70
	
7e665331bc32 item classification: requirement, recommendation, information
František Kučera <franta-hg@frantovo.cz>
parents: 36
diff changeset
    71
statistics-chart: build/statistics.rp
51
21dfb69028a0 name: Sane software manifesto (lower case)
František Kučera <franta-hg@frantovo.cz>
parents: 49
diff changeset
    72
	cat build/statistics.rp | relpipe-tr-cut ".*" "(name|.*s)" | relpipe-out-gui -title "Sane software manifesto – chart of rule types"