-
Notifications
You must be signed in to change notification settings - Fork 26
/
Makefile
111 lines (99 loc) · 9.54 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
SHELL=/bin/bash
version = 0.1
bindir = /usr/bin
datadir = /usr/share
sysconfdir = /etc
txttargets = $(shell echo examples/*.txt)
fodttargets = $(patsubst %.txt, %.fodt, $(txttargets))
.PHONY: all examples install
all:
@echo "Nothing to do."
link:
@echo "= Linking odp backend"
-[[ -d $(DESTDIR)$(sysconfdir)/asciidoc/backends/odp ]] && \
rm -ir $(DESTDIR)$(sysconfdir)/asciidoc/backends/odp && \
ln -sf $(shell pwd)/backends/odp/ $(DESTDIR)$(sysconfdir)/asciidoc/backends/odp
@echo "= Linking odt backend"
-[[ -d $(DESTDIR)$(sysconfdir)/asciidoc/backends/odt ]] && \
rm -ir $(DESTDIR)$(sysconfdir)/asciidoc/backends/odt && \
ln -sf $(shell pwd)/backends/odt/ $(DESTDIR)$(sysconfdir)/asciidoc/backends/odt
@echo "= Linking cv theme"
-[[ -d $(DESTDIR)$(sysconfdir)/asciidoc/themes/cv ]] && \
rm -ir $(DESTDIR)$(sysconfdir)/asciidoc/themes/cv && \
ln -sf $(shell pwd)/themes/cv/ $(DESTDIR)$(sysconfdir)/asciidoc/themes/cv
@echo "= Installing hp theme"
-[[ -d $(DESTDIR)$(sysconfdir)/asciidoc/themes/hp ]] && \
rm -ir $(DESTDIR)$(sysconfdir)/asciidoc/themes/hp && \
ln -sf $(shell pwd)/themes/hp/ $(DESTDIR)$(sysconfdir)/asciidoc/themes/hp
@echo "= Installing bnpp theme"
-[[ -d $(DESTDIR)$(sysconfdir)/asciidoc/themes/bnpp ]] && \
rm -ir $(DESTDIR)$(sysconfdir)/asciidoc/themes/bnpp && \
ln -sf $(shell pwd)/themes/bnpp/ $(DESTDIR)$(sysconfdir)/asciidoc/themes/bnpp
@echo "= Installing code filter"
-[[ -d $(DESTDIR)$(sysconfdir)/asciidoc/filters/code ]] && \
rm -ir $(DESTDIR)$(sysconfdir)/asciidoc/filters/code && \
ln -sf $(shell pwd)/filters/code/ $(DESTDIR)$(sysconfdir)/asciidoc/filters/code
install: templates
@echo "= Installing odp backend"
install -Dp -m0644 backends/odp/odp.conf $(DESTDIR)$(sysconfdir)/asciidoc/backends/odp/odp.conf
install -Dp -m0644 backends/odp/asciidoc.odp.styles $(DESTDIR)$(sysconfdir)/asciidoc/backends/odp/asciidoc.odp.styles
install -Dp -m0644 backends/odp/asciidoc.otp $(DESTDIR)$(sysconfdir)/asciidoc/backends/odp/asciidoc.otp
install -Dp -m0644 backends/odp/a2x-backend.py $(DESTDIR)$(sysconfdir)/asciidoc/backends/odp/a2x-backend.py
@echo "= Installing odt backend"
install -Dp -m0644 backends/odt/odt.conf $(DESTDIR)$(sysconfdir)/asciidoc/backends/odt/odt.conf
install -Dp -m0644 backends/odt/asciidoc.odt.styles $(DESTDIR)$(sysconfdir)/asciidoc/backends/odt/asciidoc.odt.styles
install -Dp -m0644 backends/odt/asciidoc.ott $(DESTDIR)$(sysconfdir)/asciidoc/backends/odt/asciidoc.ott
install -Dp -m0644 backends/odt/a2x-backend.py $(DESTDIR)$(sysconfdir)/asciidoc/backends/odt/a2x-backend.py
@echo "= Installing cv theme"
install -Dp -m0644 themes/cv/cv.odt.styles $(DESTDIR)$(sysconfdir)/asciidoc/themes/cv/cv.odt.styles
@echo "= Installing hp theme"
install -Dp -m0644 themes/hp/hp.odt.styles $(DESTDIR)$(sysconfdir)/asciidoc/themes/hp/hp.odt.styles
@echo "=Installing bnpp filter"
install -Dp -m0644 themes/bnpp/bnp.odt.styles $(DESTDIR)$(sysconfdir)/asciidoc/themes/bnpp/bnpp.odt.styles
@echo "=Installing code filter"
install -Dp -m0755 filters/code/code-filter.py $(DESTDIR)$(sysconfdir)/asciidoc/filters/code/code-filter.py
### Old cruft
# install -Dp -m0755 filters/line_break.py $(DESTDIR)$(sysconfdir)/asciidoc/filters/line_break.py
# install -Dp -m0644 filters/source/source-highlight-filter.conf $(DESTDIR)/asciidoc/filters/source/source-highlight-filter.conf
# echo "Please add \"odf = odf.outlang\" to $(datadir)/source-highlight/outlang.map"
# install -Dp -m0644 filters/source/odf.outlang $(DESTDIR)$(datadir)/source-highlight/odf.outlang
# install -Dp -m0755 packaged/a2x.py $(DESTDIR)$(bindir)/a2x.py
examples: $(fodttargets) backends/odt/odt.conf
asciidoc -b odt -a newline=\\n -a iconsdir=$(datadir)/asciidoc/images/icons -o examples/README.fodt README.asciidoc
-xmllint --noout --relaxng relaxng/OpenDocument-v1.2-os-schema.rng examples/README.fodt
# -jing -i relaxng/OpenDocument-v1.2-os-schema.rng examples/README.fodt
asciidoc -b odt -a theme=cv -a newline=\\n examples/curriculum-vitae-dag-wieers.asciidoc
-xmllint --noout --relaxng relaxng/OpenDocument-v1.2-os-schema.rng examples/curriculum-vitae-dag-wieers.fodt
# -jing -i relaxng/OpenDocument-v1.2-os-schema.rng examples/curriculum-vitae-dag-wieers.fodt
asciidoc -b odp examples/rear-presentation.asciidoc
-xmllint --noout --relaxng relaxng/OpenDocument-v1.2-os-schema.rng examples/rear-presentation.fodp
# -jing -i relaxng/OpenDocument-v1.2-os-schema.rng examples/curriculum-vitae-dag-wieers.fodt
%.fodt: %.asciidoc
asciidoc -b xhtml11 -a iconsdir=$(datadir)/asciidoc/images/icons -o $(patsubst %.fodt, %.html, $@) $<
asciidoc -b odt -a newline=\\n -a iconsdir=$(datadir)/asciidoc/images/icons -o $@ $<
-xmllint --noout --relaxng relaxng/OpenDocument-v1.2-os-schema.rng $@
# -jing -i relaxng/OpenDocument-v1.2-os-schema.rng $@
test: examples
templates:
@echo "= Write minimal ODT"
cd minimal-odf; \
echo -n 'application/vnd.oasis.opendocument.text' >mimetype; \
echo '<office:document-styles office:version="1.2" xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:math="http://www.w3.org/1998/Math/MathML" xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" xmlns:ooo="http://openoffice.org/2004/office" xmlns:ooow="http://openoffice.org/2004/writer" xmlns:oooc="http://openoffice.org/2004/calc" xmlns:dom="http://www.w3.org/2001/xml-events" xmlns:xforms="http://www.w3.org/2002/xforms" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:rpt="http://openoffice.org/2005/report" xmlns:of="urn:oasis:names:tc:opendocument:xmlns:of:1.2" xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:grddl="http://www.w3.org/2003/g/data-view#" xmlns:tableooo="http://openoffice.org/2009/table" xmlns:field="urn:openoffice:names:experimental:ooo-ms-interop:xmlns:field:1.0" xmlns:formx="urn:openoffice:names:experimental:ooxml-odf-interop:xmlns:form:1.0" xmlns:css3t="http://www.w3.org/TR/css3-text/">' >styles.xml; \
cat ../backends/odt/asciidoc.odt.styles >>styles.xml; \
echo '</office:document-styles>' >>styles.xml; \
rm -rf ../backends/odt/asciidoc.ott; \
zip -X -r ../backends/odt/asciidoc.ott mimetype *
@echo "= Write minimal ODP"
cd minimal-odf; \
echo -n 'application/vnd.oasis.opendocument.presentation' >mimetype; \
echo '<office:document-styles office:version="1.2" xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:math="http://www.w3.org/1998/Math/MathML" xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" xmlns:ooo="http://openoffice.org/2004/office" xmlns:ooow="http://openoffice.org/2004/writer" xmlns:oooc="http://openoffice.org/2004/calc" xmlns:dom="http://www.w3.org/2001/xml-events" xmlns:xforms="http://www.w3.org/2002/xforms" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:rpt="http://openoffice.org/2005/report" xmlns:of="urn:oasis:names:tc:opendocument:xmlns:of:1.2" xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:grddl="http://www.w3.org/2003/g/data-view#" xmlns:tableooo="http://openoffice.org/2009/table" xmlns:field="urn:openoffice:names:experimental:ooo-ms-interop:xmlns:field:1.0" xmlns:formx="urn:openoffice:names:experimental:ooxml-odf-interop:xmlns:form:1.0" xmlns:css3t="http://www.w3.org/TR/css3-text/">' >>styles.xml; \
cat ../backends/odp/asciidoc.odp.styles >>styles.xml; \
echo '</office:document-styles>' >>styles.xml; \
rm -rf ../backends/odp/asciidoc.otp; \
zip -X -r ../backends/odp/asciidoc.otp mimetype *
zip: templates
cd backends; for backend in *; do pushd $$backend >/dev/null; rm ../../$$backend-backend-$(version).zip; zip ../../$$backend-backend-$(version).zip *; popd >/dev/null; done
cd themes; for theme in *; do pushd $$theme >/dev/null; rm ../../$$theme-theme-$(version).zip; zip ../../$$theme-theme-$(version).zip *; popd >/dev/null; done
cd filters; for filter in *; do pushd $$filter >/dev/null; rm ../../$$filter-filter-$(version).zip; zip ../../$$filter-filter-$(version).zip *; popd >/dev/null; done
clean:
rm -f examples/*.fodt examples/*.html