]> pere.pagekite.me Git - text-madewithcc.git/blobdiff - Makefile
Merge remote-tracking branch 'origin/master'
[text-madewithcc.git] / Makefile
index 5c71457f87bf91360a90a8d2f58291a78f22a4e9..d0aef0bb0de7cf2909d07e401737144aee6bbd35 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -10,20 +10,35 @@ SOURCE=MadewithCreativeCommonsmostup-to-dateversion
 # increase every time the generated Markdown is modified.
 VERSION=20170609-2
 
-PANDOC_OPTS = --top-level-division=part -t docbook -f markdown+inline_notes --variable 'author:Paul Stacey' --variable 'author:Sarah Hinchliff Pearson'  --variable 'title:Hecho con Creative Commons'
+TITLE="Hecho con Creative Commons"
+TEXLANG=spanish
+TEXLANGCODE=es
+
+#TITLE="Laget med Creative Commons"
+#TEXLANG=norsk
+#TEXLANGCODE=nb
+
+PANDOC_OPTS = --top-level-division=part -t docbook -f markdown+inline_notes+ascii_identifiers \
+  --variable 'author:Paul Stacey' --variable 'author:Sarah Hinchliff Pearson' \
+  --variable 'title:$(TITLE)'
 # --top-level-diversion is not available in pandoc in Jessie
 # PANDOC_OPTS = -t docbook -f markdown+inline_notes
 
-LANGS = es nl nb
+LANGS = de es nb nl pl
 
-all: pdf
+all: pdf epub
 
 distclean: clean
        rm -f $(SOURCE).md
-clean:
-       rm -f $(SOURCE).pdf $(SOURCE).xml
        for LANG in $(LANGS); do \
-           rm -f $(SOURCE).$$LANG.pdf $(SOURCE).$$LANG.xml $(SOURCE).$$LANG.md ;\
+           rm -f $(SOURCE).$$LANG.md ;\
+       done
+clean:
+       for EXT in aux cb cb2 glo idx lof log tex toc xml pdf; do \
+           rm -f $(SOURCE).$$EXT ;\
+           for LANG in $(LANGS); do \
+               rm -f $(SOURCE).$$LANG.$$EXT ;\
+           done; \
         done
 
 $(SOURCE).md: $(SOURCE).odt fixup.rb
@@ -63,13 +78,17 @@ pdf: $(SOURCE).pdf
        pdflatex $^
        pdflatex $^
 
+epub: $(SOURCE).epub
+%.epub: %.xml
+       dbtoepub $^
+
 %.tex: %.xml
        dblatex -t tex -b xetex $^
-       perl -p -i -e 's/\[latin1\]\{inputenc\}/[utf8]{inputenc}\n\\usepackage[spanish]{babel}/; \
+       perl -p -i -e 's/\[latin1\]\{inputenc\}/[utf8]{inputenc}\n\\usepackage[$(TEXLANG)]{babel}/; \
                s/\\setcounter\{tocdepth\}.*/\\setcounter{tocdepth}{1}/; \
                s/\\setcounter\{secnumdepth\}.*/\\setcounter{secnumdepth}{-1}/; \
                s/\\caption\\end/\\caption{} \\end/; \
-               s!\\maketitle!\\input{extra/es/cover.tex}!; \
+               s!\\maketitle!\\input{extra/$(TEXLANGCODE)/cover.tex}!; \
                s/\\author\{and\}/\\author{Paul Stacey \\and Sarah Hinchliff Pearson}/; \
                s/\\DBKinditem\{\\writtenby\}\{and\}/\\DBKinditem{\writtenby}{Paul Stacey and Sarah Hinchliff Pearson}/; \
                s/\\listoffigures//; \
@@ -85,5 +104,9 @@ pdf: $(SOURCE).pdf
 XMLLINTOPTS = --nonet --noout  --xinclude --postvalid
 lint: $(SOURCE).xml
        xmllint $(XMLLINTOPTS) $^
+lint-es: $(SOURCE).nb.xml
+       xmllint $(XMLLINTOPTS) $^
+lint-nb: $(SOURCE).nb.xml
+       xmllint $(XMLLINTOPTS) $^
 
 .SUFFIXES: .xml .md