forked from TEIC/Stylesheets
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
217 lines (183 loc) · 8.49 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
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
SFUSER=rahtz
JING=jing
SAXON=java -jar lib/saxon9he.jar
DOTDOTSAXON=java -jar ../../lib/saxon9he.jar
DOTSAXON=java -jar ../lib/saxon9he.jar
SAXON_ARGS=-ext:on
DIRS=bibtex cocoa common csv docx dtd docbook epub epub3 fo html wordpress markdown html5 json latex latex nlm odd odds odt p4 pdf profiles/default rdf relaxng rnc schematron simple slides tbx tcp tite tools txt html xsd xlsx pdf verbatimxml
SCRIPTS=bin/*to*
PREFIX=/usr
OXY=/usr/share/oxygen
DOCTARGETS= \
latex/latex.xsl \
html/html.xsl \
fo/fo.xsl \
tcp/tcp2tei.xsl \
odds/odd2odd.xsl \
odds/odd2relax.xsl \
odds/odd2dtd.xsl \
slides/teihtml-slides.xsl \
slides/teilatex-slides.xsl \
profiles/default/csv/from.xsl \
profiles/default/csv/to.xsl \
profiles/default/docbook/from.xsl \
profiles/default/docx/from.xsl \
profiles/default/docx/to.xsl \
profiles/default/dtd/to.xsl \
profiles/default/epub/to.xsl \
profiles/default/fo/to.xsl \
profiles/default/html/to.xsl \
profiles/default/latex/to.xsl \
profiles/default/lite/to.xsl \
profiles/default/odt/from.xsl \
profiles/default/odt/to.xsl \
profiles/default/p4/from.xsl \
profiles/default/relaxng/to.xsl
PROFILEDOCTARGETS=\
profiles/enrich/docx/from.xsl \
profiles/enrich/docx/to.xsl \
profiles/enrich/fo/to.xsl \
profiles/enrich/html/to.xsl \
profiles/enrich/latex/to.xsl
.PHONY: doc release common profiles $(PROFILEDOCTARGETS) $(DOCTARGETS)
default: check test release
check:
@echo Checking you have running XML tools and Perl before trying to run transform...
@echo -n Perl:
@which perl || exit 1
@echo -n xmllint:
@which xmllint || exit 1
@echo -n jing:
@which ${JING} || exit 1
v:
perl -p -i -e "s+AppVersion.*/AppVersion+AppVersion>`cat VERSION`</AppVersion+" docx/to/application.xsl
build:
@echo BUILD Copy main XSL files
test -d release/xsl/xml/tei/stylesheet || mkdir -p release/xsl/xml/tei/stylesheet/
for i in ${DIRS} ; do \
tar cf - $$i | (cd release/xsl/xml/tei/stylesheet; tar xf - ); \
done
common: names
@echo BUILD Copy common files and documentation
test -d release/xslcommon/xml/tei/stylesheet || mkdir -p release/xslcommon/xml/tei/stylesheet
cp names.xml catalog.xml VERSION css/*.css i18n.xml release/xslcommon/xml/tei/stylesheet
names:
$(SAXON) -it:main tools/getnames.xsl > names.xml
profiles:
@echo BUILD Copy profiles
test -d release/xslprofiles/xml/tei/stylesheet || mkdir -p release/xslprofiles/xml/tei/stylesheet
tar cf - profiles | (cd release/xslprofiles/xml/tei/stylesheet; tar xf - )
doc: oxygendoc linkcss
@echo BUILD Compile documentation
test -d release/xslcommon/doc/tei-xsl || mkdir -p release/xslcommon/doc/tei-xsl
$(SAXON) -o:Documentation/index.xml Documentation/teixsl.xml Documentation/param.xsl
$(SAXON) -o:Documentation/style.xml Documentation/teixsl.xml Documentation/paramform.xsl
$(SAXON) -o:release/xslcommon/doc/tei-xsl/index.html Documentation/index.xml profiles/tei/html5/to.xsl cssFile=tei.css
$(SAXON) -o:release/xslcommon/doc/tei-xsl/style.html Documentation/style.xml profiles/default/html/to.xsl
cp Documentation/*.png Documentation/teixsl.xml Documentation/style.xml release/xslcommon/doc/tei-xsl
cp VERSION tei.css ChangeLog LICENCE release/xslcommon/doc/tei-xsl
oxygendoc:
# when building Debian packages, the script runs under
# fakeroot, and the oxygen script then tries to look in /root/.com.oxygenxml, and fails.
# The answer is to tweak the stylesheetDocumentation.sh script
@echo text for existence of file $(OXY)/stylesheetDocumentation.sh and make stylesheet documentation if it exists
if test -f $(OXY)/stylesheetDocumentation.sh; then perl -pe "s+-Djava.awt+-Duser.home=/tmp/ -Djava.awt+; s+OXYGEN_HOME=.*+OXYGEN_HOME=/usr/share/oxygen+" < $(OXY)/stylesheetDocumentation.sh > ./runDoc.sh; chmod 755 runDoc.sh; cp -f $(OXY)/licensekey.txt .; $(MAKE) ${DOCTARGETS} ${PROFILEDOCTARGETS}; rm -f licensekey.txt runDoc.sh; fi
teioo.jar:
(cd odt; mkdir TEIP5; $(DOTSAXON) -o:TEIP5/teitoodt.xsl -s:teitoodt.xsl expandxsl.xsl ; cp odttotei.xsl TEIP5.ott teilite.dtd TEIP5; jar cf ../teioo.jar TEIP5 TypeDetection.xcu ; rm -rf TEIP5)
test: clean build common names debversion
@echo BUILD Run tests
(cd Test; make)
dist: clean release
-rm -f tei-xsl-`cat VERSION`.zip
(cd release/xslcommon; zip -r -q ../../tei-xsl-`cat ../../VERSION`.zip .)
(cd release/xsl; zip -r -q ../../tei-xsl-`cat ../../VERSION`.zip .)
(cd release/xslprofiles; zip -r -q ../../tei-xsl-`cat ../../VERSION`.zip .)
-rm -rf dist
mkdir dist
(cd release/xsl; tar cf - .) | (cd dist; tar xf -)
(cd release/xslprofiles; tar cf - .) | (cd dist; tar xf -)
(cd release/xslcommon/; tar cf - .) | (cd dist; tar xf -)
release: common doc oxygendoc build profiles
installxsl: build teioo.jar
mkdir -p ${PREFIX}/share/xml/tei/stylesheet
(tar cf - lib teioo.jar) | (cd ${PREFIX}/share/xml/tei/stylesheet; tar xf - )
(cd release/xsl; tar cf - .) | (cd ${PREFIX}/share; tar xf -)
mkdir -p ${PREFIX}/bin
cp bin/transformtei ${PREFIX}/bin
perl -p -i -e 's+^APPHOME=.*+APPHOME=/usr/share/xml/tei/stylesheet+' ${PREFIX}/bin/transformtei
chmod 755 ${PREFIX}/bin/transformtei
for i in $(SCRIPTS); do (cd ${PREFIX}/bin; rm -f `basename $$i`; ln -s transformtei `basename $$i`); done
installprofiles: install-profiles-files install-profiles-docs
install-profiles-docs:
mkdir -p release/xslprofiles/doc
@echo text for existence of file $(OXY)/stylesheetDocumentation.sh
if test -f $(OXY)/stylesheetDocumentation.sh; then perl -pe "s+-Djava.awt+-Djava.awt -Duser.home=/tmp/+; s+OXYGEN_HOME=.*+OXYGEN_HOME=/usr/share/oxygen+" < $(OXY)/stylesheetDocumentation.sh > ./runDoc.sh; chmod 755 runDoc.sh; cp -f $(OXY)/licensekey.txt .; $(MAKE) ${PROFILEDOCTARGETS}; rm -f licensekey.txt runDoc.sh; fi
(cd release/xslprofiles/doc; tar cf - .) | (cd ${PREFIX}/share/doc; tar xf -)
install-profiles-files:
test -d release/xslprofiles/xml/tei/stylesheet || mkdir -p release/xslprofiles/xml/tei/stylesheet/
mkdir -p ${PREFIX}/share/xml/
mkdir -p ${PREFIX}/share/doc/
tar cf - --exclude default profiles | (cd release/xslprofiles/xml/tei/stylesheet; tar xf - )
(cd release/xslprofiles; tar cf - .) | (cd ${PREFIX}/share; tar xf -)
${PROFILEDOCTARGETS}:
echo process doc for $@
ODIR=release/xslprofiles/doc/tei-xsl/`dirname $@` ./runDoc.sh $@ -cfg:Documentation/oxydoc.cfg
(cd `dirname $@`; tar cf - release) | tar xf -
rm -rf `dirname $@`/release
${DOCTARGETS}:
echo process doc for $@
ODIR=release/xsl/doc/tei-xsl/`dirname $@` ./runDoc.sh $@ -cfg:Documentation/oxydoc.cfg
(cd `dirname $@`; tar cf - release) | tar xf -
rm -rf `dirname $@`/release
installcommon: doc common
mkdir -p ${PREFIX}/lib/cgi-bin
cp Documentation/stylebear ${PREFIX}/lib/cgi-bin/stylebear
chmod 755 ${PREFIX}/lib/cgi-bin/stylebear
mkdir -p ${PREFIX}/share/doc/
mkdir -p ${PREFIX}/share/xml/
(cd release/xslcommon/doc; tar cf - .) | (cd ${PREFIX}/share/doc; tar xf -)
(cd release/xslcommon/xml; tar cf - .) | (cd ${PREFIX}/share/xml; tar xf -)
install: linkcss doc installxsl installprofiles installcommon
rm -rf Documentation/index.xml Documentation/style.xml Documentation/stylebear teioo.jar
linkcss:
(for i in css/*; do test -f `basename $$i` || ln -s $$i `basename $$i`;done)
debversion:
sh ./tools/mydch debian-tei-xsl/debian/changelog
deb: debversion
@echo BUILD Make Debian packages
rm -f tei*xsl*_*deb
rm -f tei*xsl*_*changes
rm -f tei*xsl*_*build
(cd debian-tei-xsl; debclean;debuild --no-lintian -nc -b -uc -us)
tag:
git tag -a v`cat VERSION` -m 'release version `cat VERSION`'
git push --follow-tags
sfupload:
rsync -e ssh tei-xsl-`cat VERSION`.zip ${SFUSER},[email protected]:/home/frs/project/t/te/tei/Stylesheets
log:
(LastDate=`head -1 ChangeLog | awk '{print $$1}'`; \
echo changes since $$LastDate; \
./tools/git-to-changelog --since=$$LastDate > newchanges)
mv ChangeLog oldchanges
cat newchanges oldchanges > ChangeLog
rm newchanges oldchanges
clean:
(for i in css/*; do rm -f `basename $$i`;done)
echo "" > test~
rm -f profile1.html profile2.html profile.xml
find . -name "*~" | xargs rm
rm -f tei-xsl-*.zip
rm -rf tei-xsl_*
rm -f Documentation/stylebear Documentation/style.xml Documentation/customize.xml Documentation/teixsl.html Documentation/index.xml
rm -rf release dist
(cd Test; make clean)
rm -rf tei-p5-xsl_*
rm -rf tei-p5-xsl2_*
-(cd debian-tei-xsl/debian; rm -rf tei-xsl)
rm -f teioo.jar
rm -rf docx/ImageInfo/bin
rm -f names.xml licensekey.txt runDoc.sh
(for i in sciencejournal/*.html; do rm -f sciencejournal/`basename $$i`;done)
(for i in sciencejournal/*.xml; do rm -f sciencejournal/`basename $$i`;done)
tags:
etags `find . -name "*.xsl"`