Makefile
branchv_0
changeset 81 47717a4ed4bb
parent 77 07cd1e608525
child 82 a11239f9f9e7
--- a/Makefile	Thu May 09 23:35:47 2024 +0200
+++ b/Makefile	Thu May 09 23:47:53 2024 +0200
@@ -15,16 +15,34 @@
 
 VERSION_PARAMS := $(shell hg log -r '.' --template '--stringparam versionTag {latesttag} --stringparam versionDistance {latesttagdistance} --stringparam versionHash {node|short}') "--stringparam" "versionChangedFiles" $(shell hg status | wc -l) 
 
-all: validate xhtml txt pdf logo-png statistics
+all: validate xhtml txt pdf build/ssm.en.epub logo-png statistics
 
 validate:
 	xmllint --noout --schema schema/ssm.xsd text/ssm.en.xml
 
-xhtml: templates/cmunrm.woff templates/cmunbx.woff
+xhtml: text/ssm.en.xml templates/cmunrm.woff templates/cmunbx.woff
 	mkdir -p build
 	xsltproc $(VERSION_PARAMS) --output build/index.xhtml --nonet templates/ssm.xhtml.xsl text/ssm.en.xml
-	cp templates/*.css build
-	cp templates/*.woff build
+	cp --reflink=auto templates/*.css build
+	cp --reflink=auto templates/*.woff build
+
+build/ssm.en.epub: text/ssm.en.xml templates/ssm.xhtml.xsl templates/cmunrm.woff templates/cmunbx.woff
+	mkdir -p "build/epub/META-INF"
+	mkdir -p "build/epub/OEBPS"
+	echo -n "application/epub+zip" > "build/epub/mimetype"
+	xsltproc \
+		--nonet \
+		--xinclude \
+		$(VERSION_PARAMS) \
+		--output "build/epub/" \
+		"templates/ssm.epub.xsl" \
+		$(<)
+	cp --reflink=auto templates/*.css "build/epub/OEBPS/"
+	cp --reflink=auto templates/*.woff "build/epub/OEBPS/"
+	cd "build/epub/"; zip -r ../../$(@) \
+		-X \
+		--suffixes mimetype:jpg:jpeg:png:gif \
+		mimetype "META-INF/" "OEBPS/"
 
 templates/cmunrm.ttf:
 	cd templates/; ln -s /usr/share/fonts/truetype/cmu/cmunrm.ttf
@@ -57,8 +75,8 @@
 	rm -rf build
 
 publish:
-	scp build/*     globalcode.info:/var/www/sane-software.globalcode.info/v_0/
-	scp license/*   globalcode.info:/var/www/sane-software.globalcode.info/license/
+	scp build/*.*     globalcode.info:/var/www/sane-software.globalcode.info/v_0/
+	scp license/*.*   globalcode.info:/var/www/sane-software.globalcode.info/license/
 
 
 # Described at: https://relational-pipes.globalcode.info/v_0/examples-in-xmltable-ssm-gui.xhtml