Makefile
author František Kučera <franta-hg@frantovo.cz>
Tue, 14 Jul 2020 16:42:08 +0200
branchv_0
changeset 68 5dbeb3e9037d
parent 67 78eca0b3ab5f
child 71 cfd08606258a
permissions -rw-r--r--
Added tag v0.9 for changeset 78eca0b3ab5f
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
67
78eca0b3ab5f style: change font to more classic Computer Modern (CMU) + change the anchor symbol
František Kučera <franta-hg@frantovo.cz>
parents: 54
diff changeset
    23
xhtml: templates/cmunrm.woff templates/cmunbx.woff
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
67
78eca0b3ab5f style: change font to more classic Computer Modern (CMU) + change the anchor symbol
František Kučera <franta-hg@frantovo.cz>
parents: 54
diff changeset
    29
templates/cmunrm.ttf:
78eca0b3ab5f style: change font to more classic Computer Modern (CMU) + change the anchor symbol
František Kučera <franta-hg@frantovo.cz>
parents: 54
diff changeset
    30
	cd templates/; ln -s /usr/share/fonts/truetype/cmu/cmunrm.ttf
78eca0b3ab5f style: change font to more classic Computer Modern (CMU) + change the anchor symbol
František Kučera <franta-hg@frantovo.cz>
parents: 54
diff changeset
    31
78eca0b3ab5f style: change font to more classic Computer Modern (CMU) + change the anchor symbol
František Kučera <franta-hg@frantovo.cz>
parents: 54
diff changeset
    32
templates/cmunbx.ttf:
78eca0b3ab5f style: change font to more classic Computer Modern (CMU) + change the anchor symbol
František Kučera <franta-hg@frantovo.cz>
parents: 54
diff changeset
    33
	cd templates/; ln -s /usr/share/fonts/truetype/cmu/cmunbx.ttf
78eca0b3ab5f style: change font to more classic Computer Modern (CMU) + change the anchor symbol
František Kučera <franta-hg@frantovo.cz>
parents: 54
diff changeset
    34
78eca0b3ab5f style: change font to more classic Computer Modern (CMU) + change the anchor symbol
František Kučera <franta-hg@frantovo.cz>
parents: 54
diff changeset
    35
templates/cmunrm.woff: templates/cmunrm.ttf
78eca0b3ab5f style: change font to more classic Computer Modern (CMU) + change the anchor symbol
František Kučera <franta-hg@frantovo.cz>
parents: 54
diff changeset
    36
	cd templates/; sfnt2woff cmunrm.ttf
78eca0b3ab5f style: change font to more classic Computer Modern (CMU) + change the anchor symbol
František Kučera <franta-hg@frantovo.cz>
parents: 54
diff changeset
    37
78eca0b3ab5f style: change font to more classic Computer Modern (CMU) + change the anchor symbol
František Kučera <franta-hg@frantovo.cz>
parents: 54
diff changeset
    38
templates/cmunbx.woff: templates/cmunbx.ttf
78eca0b3ab5f style: change font to more classic Computer Modern (CMU) + change the anchor symbol
František Kučera <franta-hg@frantovo.cz>
parents: 54
diff changeset
    39
	cd templates/; sfnt2woff cmunbx.ttf
78eca0b3ab5f style: change font to more classic Computer Modern (CMU) + change the anchor symbol
František Kučera <franta-hg@frantovo.cz>
parents: 54
diff changeset
    40
36
9e5c3383ba50 add PDF output (using LibreOffice)
František Kučera <franta-hg@frantovo.cz>
parents: 33
diff changeset
    41
pdf:
9e5c3383ba50 add PDF output (using LibreOffice)
František Kučera <franta-hg@frantovo.cz>
parents: 33
diff changeset
    42
	mkdir -p build
49
1dc027689f93 print version from Mercurial
František Kučera <franta-hg@frantovo.cz>
parents: 47
diff changeset
    43
	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
    44
	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
    45
25
8da11cce2c98 add TXT output + change directory structure
František Kučera <franta-hg@frantovo.cz>
parents: 20
diff changeset
    46
# TODO: better line wrapping
8da11cce2c98 add TXT output + change directory structure
František Kučera <franta-hg@frantovo.cz>
parents: 20
diff changeset
    47
txt:
8da11cce2c98 add TXT output + change directory structure
František Kučera <franta-hg@frantovo.cz>
parents: 20
diff changeset
    48
	mkdir -p build
49
1dc027689f93 print version from Mercurial
František Kučera <franta-hg@frantovo.cz>
parents: 47
diff changeset
    49
	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
    50
33
d6cb9fe26aed logo: the first draft
František Kučera <franta-hg@frantovo.cz>
parents: 30
diff changeset
    51
logo-png:
d6cb9fe26aed logo: the first draft
František Kučera <franta-hg@frantovo.cz>
parents: 30
diff changeset
    52
	mkdir -p build
d6cb9fe26aed logo: the first draft
František Kučera <franta-hg@frantovo.cz>
parents: 30
diff changeset
    53
	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
    54
	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
    55
15
96fc2f42b1e1 conversion to XML format, XSD, XSLT
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    56
clean:
25
8da11cce2c98 add TXT output + change directory structure
František Kučera <franta-hg@frantovo.cz>
parents: 20
diff changeset
    57
	rm -rf build
18
f315b3d27a9d make: publish
František Kučera <franta-hg@frantovo.cz>
parents: 15
diff changeset
    58
f315b3d27a9d make: publish
František Kučera <franta-hg@frantovo.cz>
parents: 15
diff changeset
    59
publish:
51
21dfb69028a0 name: Sane software manifesto (lower case)
František Kučera <franta-hg@frantovo.cz>
parents: 49
diff changeset
    60
	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
    61
	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
    62
fb939d9baaf4 make: statistics (just for fun)
František Kučera <franta-hg@frantovo.cz>
parents: 18
diff changeset
    63
54
9f5de01bfd30 fix indentation in Makefile
František Kučera <franta-hg@frantovo.cz>
parents: 51
diff changeset
    64
# 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
    65
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
    66
	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
    67
	cat text/ssm.en.xml \
54
9f5de01bfd30 fix indentation in Makefile
František Kučera <franta-hg@frantovo.cz>
parents: 51
diff changeset
    68
		| relpipe-in-xmltable \
9f5de01bfd30 fix indentation in Makefile
František Kučera <franta-hg@frantovo.cz>
parents: 51
diff changeset
    69
			--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
    70
			--relation "chapter" \
9f5de01bfd30 fix indentation in Makefile
František Kučera <franta-hg@frantovo.cz>
parents: 51
diff changeset
    71
				--records "//m:chapter" \
9f5de01bfd30 fix indentation in Makefile
František Kučera <franta-hg@frantovo.cz>
parents: 51
diff changeset
    72
				--attribute "name" string "m:name" \
9f5de01bfd30 fix indentation in Makefile
František Kučera <franta-hg@frantovo.cz>
parents: 51
diff changeset
    73
				--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
    74
				--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
    75
				--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
    76
				--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
    77
		> build/statistics.rp
47
7e665331bc32 item classification: requirement, recommendation, information
František Kučera <franta-hg@frantovo.cz>
parents: 36
diff changeset
    78
7e665331bc32 item classification: requirement, recommendation, information
František Kučera <franta-hg@frantovo.cz>
parents: 36
diff changeset
    79
# 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
    80
statistics: build/statistics.rp
7e665331bc32 item classification: requirement, recommendation, information
František Kučera <franta-hg@frantovo.cz>
parents: 36
diff changeset
    81
	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
    82
	
7e665331bc32 item classification: requirement, recommendation, information
František Kučera <franta-hg@frantovo.cz>
parents: 36
diff changeset
    83
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
    84
	cat build/statistics.rp | relpipe-tr-cut ".*" "(name|.*s)" | relpipe-out-gui -title "Sane software manifesto – chart of rule types"