/[volute]/trunk/projects/ivoapub/ivoatex/Makefile
ViewVC logotype

Contents of /trunk/projects/ivoapub/ivoatex/Makefile

Parent Directory Parent Directory | Revision Log Revision Log


Revision 5934 - (show annotations)
Tue Feb 23 11:38:05 2021 UTC (2 months, 2 weeks ago) by msdemlei
File size: 9524 byte(s)
ivoatx: maintenance commit: Undoing html debug, whitespace in XSLT.

1 # ivoatex control makefile
2 #
3 # This is for inclusion into a main Makefile from one level up.
4 # This main Makefile must define DOCNAME, DOCVERSION, DOCDATE, DOCTYPE
5 # SOURCES; also, FIGURES as needed.
6 #
7 # See http://ivoa.net/documents/Notes/IVOATex/index.html
8 # for the targets in here useful to the user.
9 #
10 # You should *not* need to change anything here while authoring documents.
11 # All customisation should happen in the user Makefile
12
13 IVOATEX_VERSION = 1.1
14
15 .DELETE_ON_ERROR:
16
17 CSS_HREF = https://www.ivoa.net/misc/ivoa_doc.css
18 TTH = ivoatex/tth_C/tth
19 ARCHIVE_FILES = $(DOCNAME).tex $(DOCNAME).pdf $(DOCNAME).html $(FIGURES)
20 PYTHON?=python3
21
22 # Requirements:
23 # XSLT processor
24 # C compiler
25 # GNU make (or another sufficiently powerful make)
26 # texlive
27 # ghostscript (if you plan on postscript/pdf figures)
28 # zip
29 # inkscape if you need an architecture diagram
30 # pdftk if you want to build draft pdfs with a watermark
31 # optionally, latexmk.
32 # Since inkscape is a rather exotic dependency, please commit both
33 # role_diagram.svg and role_diagram.pdf into your VCS for now.
34
35 XSLTPROC = xsltproc
36 XMLLINT = xmllint -noout
37 LATEXMK_BANNER := $(shell latexmk --version 2> /dev/null)
38 ifdef LATEXMK_BANNER
39 PDFLATEX = latexmk -pdf
40 else
41 PDFLATEX = pdflatex
42 endif
43 CONVERT = convert
44 ZIP = zip
45
46 export TEXINPUTS=.:ivoatex:
47
48
49 # standard file name according to S&D standards
50 versionedName:=$(DOCTYPE)-$(DOCNAME)-$(DOCVERSION)
51 ifneq "$(DOCTYPE)" "REC"
52 versionedName:=$(versionedName)-$(subst -,,$(DOCDATE))
53 endif
54
55 GENERATED_PNGS = $(VECTORFIGURES:pdf=png)
56
57 .SUFFIXES: .pdf .gif .tex .png
58 .PHONY: biblio docrepo.bib
59
60 %.png: %.pdf
61 # simple ImageMagic -antialias didn't work too well
62 $(CONVERT) -density 300 -scale 25% $< $@
63
64
65 $(DOCNAME).pdf: ivoatexmeta.tex $(SOURCES) $(FIGURES) $(VECTORFIGURES)
66 $(PDFLATEX) $(DOCNAME)
67
68 forcetex:
69 make -W $(DOCNAME).tex $(DOCNAME).pdf
70
71 $(DOCNAME)-draft.pdf: $(DOCNAME).pdf draft-background.pdf
72 pdftk $< background draft-background.pdf output $@
73
74 draft-background.pdf: ivoatex/draft-background.tex
75 pdflatex $<
76
77 arxiv-upload: $(SOURCES) biblio $(FIGURES) $(VECTORFIGURES) ivoatexmeta.tex
78 mkdir -p stuff-for-arxiv/ivoatex
79 cp ivoatex/ivoa.cls ivoatex/tthdefs.tex stuff-for-arxiv
80 cp ivoatex/IVOA.jpg stuff-for-arxiv/ivoatex
81 # HACK: 2015-10-05 MD: arXiv produces an hyperref option clash without
82 # this
83 echo nohypertex >> stuff-for-arxiv/00README.XXX
84 cp $(SOURCES) $(DOCNAME).bbl $(FIGURES) $(VECTORFIGURES) \
85 ivoatexmeta.tex stuff-for-arxiv
86 tar -cvzf arxiv-upload.tar.gz -C stuff-for-arxiv .
87 rm -r stuff-for-arxiv
88
89 clean:
90 rm -f $(DOCNAME).pdf $(DOCNAME).aux $(DOCNAME).log $(DOCNAME).toc texput.log ivoatexmeta.tex
91 rm -f $(DOCNAME).html $(DOCNAME).xhtml
92 rm -f *.bbl *.blg *.out debug.html
93 rm -f arxiv-upload.tar.gz
94 rm -f $(GENERATED_PNGS)
95
96 .FORCE:
97
98 gitmeta.tex: .FORCE
99 /bin/echo -n '\vcsrevision{' > $@
100 /bin/echo -n "$(shell git log -1 --date=short --pretty=%h 2> /dev/null)" >> $@
101 if [ ! -z "$(shell git status --porcelain -uno 2> /dev/null)" ]; then /bin/echo -n -dirty >> $@; fi
102 /bin/echo } >> $@
103 /bin/echo '\vcsdate{' $(shell git log -1 --date=short --pretty=%ai 2> /dev/null) '}' >>$@
104
105
106 ivoatexmeta.tex: Makefile
107 rm -f $@
108 touch $@
109 echo '% GENERATED FILE -- edit this in the Makefile' >>$@
110 /bin/echo '\newcommand{\ivoaDocversion}{$(DOCVERSION)}' >>$@
111 /bin/echo '\newcommand{\ivoaDocdate}{$(DOCDATE)}' >>$@
112 /bin/echo '\newcommand{\ivoaDocdatecode}{$(DOCDATE)}' | sed -e 's/-//g' >>$@
113 /bin/echo '\newcommand{\ivoaDoctype}{$(DOCTYPE)}' >>$@
114 /bin/echo '\newcommand{\ivoaDocname}{$(DOCNAME)}' >>$@
115
116 $(DOCNAME).html: $(DOCNAME).pdf ivoatex/tth-ivoa.xslt $(TTH) \
117 $(GENERATED_PNGS)
118 $(TTH) -w2 -e2 -u2 -pivoatex -L$(DOCNAME) <$(DOCNAME).tex \
119 | $(XSLTPROC) --html \
120 --stringparam CSS_HREF $(CSS_HREF) \
121 ivoatex/tth-ivoa.xslt - \
122 >$(DOCNAME).html
123
124 # | tee debug.html \
125
126 $(DOCNAME).bbl: $(DOCNAME).tex ivoatex/ivoabib.bib ivoatexmeta.tex
127 ifdef LATEXMK_BANNER
128 $(PDFLATEX) -bibtex $(DOCNAME).tex
129 else
130 -$(PDFLATEX) -interaction batchmode $(DOCNAME).tex
131 bibtex $(DOCNAME).aux
132 -$(PDFLATEX) -interaction batchmode $(DOCNAME).tex 2>&1 >/dev/null
133 $(PDFLATEX) -interaction scrollmode $(DOCNAME).tex
134 endif
135
136 # We don't let the pdf depend on .bbl, as we don't want to run BibTeX
137 # every time the TeX input is changed. The idea is that when people do
138 # bibliography-relevant changes, they run make biblio manually.
139 biblio: $(DOCNAME).bbl
140
141 # The architecture diagram is generated from a spec in the document
142 # directory and a stylesheet.
143 role_diagram.svg: role_diagram.xml
144 $(XSLTPROC) -o $@ ivoatex/make-archdiag.xslt role_diagram.xml
145
146 # Regrettably, pdflatex can't use svg, so we need to convert it.
147 # We're using inkscape here rather than convert because convert
148 # rasterises the svg.
149 %.pdf: %.svg
150 inkscape --export-pdf=$@ $< || cp ivoatex/svg-fallback.pdf $@
151
152 # generate may modify DOCNAME.tex controlled by arbitrary external binaries.
153 # It is impossible to model these dependencies (here), and anyway
154 # I feel something like that shouldn't run automatically.
155 # Also, it needs python installed, which may not be available on all
156 # installations.
157 generate:
158 $(PYTHON) ivoatex/update_generated.py $(DOCNAME).tex
159
160 package: $(DOCNAME).tex $(DOCNAME).html $(DOCNAME).pdf \
161 $(GENERATED_PNGS) $(FIGURES) $(AUX_FILES)
162 rm -rf -- $(versionedName)
163 mkdir $(versionedName)
164 cp $(DOCNAME).tex $(versionedName)/$(versionedName).tex
165 cp $(DOCNAME).html $(versionedName)/$(versionedName).html
166 cp $(DOCNAME).pdf $(versionedName)/$(versionedName).pdf
167
168 ifneq ($(strip $(FIGURES)),)
169 cp $(FIGURES) $(versionedName)
170 endif
171 ifneq ($(strip $(GENERATED_PNGS)),)
172 cp $(GENERATED_PNGS) $(versionedName)
173 endif
174 ifneq ($(strip $(AUX_FILES)),)
175 cp -r $(AUX_FILES) $(versionedName)
176 endif
177 # # make sure files will be readable by the web server later on
178 chmod -R go+w $(versionedName)
179 zip -r $(versionedName).zip $(versionedName)
180 rm -rf -- $(versionedName)
181
182
183 upload: package
184 $(PYTHON) ivoatex/submission.py $(versionedName).zip
185
186
187 # Build TtH from source. See http://hutchinson.belmont.ma.us/tth/.
188 # TtH source seems to be highly portable, so compilation should be easy
189 # as long as you have a C compiler.
190 $(TTH): ivoatex/tth_C/tth.c
191 $(CC) -o $(TTH) ivoatex/tth_C/tth.c
192
193 ############# architecture diagram stuff (to be executed in this directory)
194
195 archdiag-l2.svg: archdiag-full.xml make-archdiag.xslt
196 $(XSLTPROC) -o $@ make-archdiag.xslt archdiag-full.xml
197
198 archdiag-l1.svg: make-archdiag.xslt
199 echo '<archdiag xmlns="http://ivoa.net/archdiag"/>' | \
200 $(XSLTPROC) -o $@ make-archdiag.xslt -
201
202 archdiag-l0.svg: make-archdiag.xslt
203 echo '<archdiag0 xmlns="http://ivoa.net/archdiag"/>' | \
204 $(XSLTPROC) -o $@ make-archdiag.xslt -
205
206
207 ############# below here: building an ivoatex distribution
208
209 IVOATEX_FILES = fromivoadoc.xslt Makefile COPYING \
210 ivoabib.bib Makefile.template tthdefs.tex document.template \
211 ivoa.cls README tth-ivoa.xslt IVOA.jpg docrepo.bib\
212 svn-ignore.txt tthntbib.sty update_generated.py schemadoc.xslt \
213 ivoa.bst CHANGES archdiag-full.xml make-archdiag.xslt stdrec-template.xml \
214 submission.py svg-fallback.pdf
215 TTH_FILES= tth_C/CHANGES tth_C/latex2gif tth_C/ps2gif tth_C/tth.c \
216 tth_C/tth_manual.html tth_C/INSTALL tth_C/license.txt tth_C/ps2png \
217 tth_C/tth.1 tth_C/tth.gif
218
219 IVOATEX_ARCHIVE = ivoatex-$(IVOATEX_VERSION).tar.gz
220
221 .PHONY: ivoatex-install
222
223 $(IVOATEX_ARCHIVE): $(IVOATEX_FILES)
224 @echo "This target must be run inside *ivoatex*"
225 -mkdir ivoatex
226 cp $(IVOATEX_FILES) ivoatex
227 -mkdir ivoatex/tth_C
228 cp $(TTH_FILES) ivoatex/tth_C
229 tar -czf ivoatex-$(IVOATEX_VERSION).tar.gz ivoatex
230 rm -rf ivoatex
231
232
233 ivoatex-installdist: $(IVOATEX_ARCHIVE)
234 @echo "This target will only work for Markus"
235 scp $(IVOATEX_ARCHIVE) alnilam:/var/www/soft/ivoatex/
236 ssh alnilam "cd /var/www/soft/ivoatex/; ln -sf $(IVOATEX_ARCHIVE) ivoatex-latest.tar.gz"
237
238 # re-gets the ivoa records from ADS
239 docrepo.bib:
240 python3 fetch_from_ads.py
241
242 ############# GitHub workflows configuration
243
244 .PHONY: github-preview
245
246 GITHUB_WORKFLOWS = .github/workflows
247 GITHUB_BUILD = $(GITHUB_WORKFLOWS)/build.yml
248 GITHUB_PREVIEW = $(GITHUB_WORKFLOWS)/preview.yml
249 GITHUB_BUILD_TEMPLATE = ivoatex/github_workflow_build.yml.template
250 GITHUB_PREVIEW_TEMPLATE = ivoatex/github_workflow_preview.yml.template
251
252 $(GITHUB_WORKFLOWS):
253 @mkdir -p $@
254
255 $(GITHUB_BUILD): $(GITHUB_WORKFLOWS) $(GITHUB_BUILD_TEMPLATE)
256 @sed "s!^\(\s*doc_name:\)!\1 $(DOCNAME)!g" $(GITHUB_BUILD_TEMPLATE) > $@
257 @git add "$@"
258 @echo -e "* GitHub Workflow for PDF preview in PullRequest configured:\n $@"
259 @echo ' => Run "git commit && git push" to enable GitHub PDF preview.'
260
261 $(GITHUB_PREVIEW): $(GITHUB_WORKFLOWS) $(GITHUB_PREVIEW_TEMPLATE)
262 @sed "s!^\(\s*doc_name:\)!\1 $(DOCNAME)!g" $(GITHUB_PREVIEW_TEMPLATE) > $@
263 @git add "$@"
264 @echo -e "* GitHub Workflow for PDF preview at pushed commit configured:\n\
265 $@\n\
266 -----------------------------------------------------------------------\n\
267 Clickable badge toward the generated PDF preview:\n\n\
268 [![PDF-Preview](https://img.shields.io/badge/Preview-PDF-blue)]\
269 (../../releases/download/auto-pdf-preview/$(DOCNAME)-draft.pdf)\n\n\
270 You can add it into your README.md to give an easy way to access\n\
271 the PDF preview to your users.\n\
272 -----------------------------------------------------------------------"
273 @echo ' => Run "git commit && git push" to enable GitHub PDF preview.'
274
275 github-preview: $(GITHUB_BUILD) $(GITHUB_PREVIEW)
276

msdemlei@ari.uni-heidelberg.de
ViewVC Help
Powered by ViewVC 1.1.26