# Makefile for building SAMP document. # Main useful targets are # # build: builds PDF and HTML documents, as well as SAMP.zip file # suitable for submission to IVOA doc coordinator # (default target) # clean: deletes all files not under version control DOC = samp # DOCVERSION = 1.3 DOCVERSION = ?? # DOCDATE = 2012-04-11 DOCDATE = ?? # DOCSTATUS = REC DOCSTATUS = ?? # DOCTYPE = Recommendation DOCTYPE = ?? UPLOAD = $(DOCSTATUS)-SAMP-$(DOCVERSION)-`echo $(DOCDATE) | sed 's/-//g'` ARCHIVE = sampdoc CSS_HREF = http://www.ivoa.net/misc/ivoa_doc.css TTH = tth_C/tth FIGURES = ivoa-archi samp-archi \ samp-notification samp-asynchronous samp-synchronous ARCHIVE_FILES = $(DOC).tex $(DOC).pdf $(DOC).html $(FIGURES:=.gif) # Requirements: # XML validator and XSLT processor # pdflatex # PDF->GIF converter (ImageMagick) # jar (JDK) # All most likely present on, e.g., a linux disribution. # Could use substitites for some of these if they are not available. XSLTPROC = xsltproc XMLLINT = xmllint -noout PDFLATEX = pdflatex PDF2GIF = convert -density 54x54 JAR = jar .SUFFIXES: .pdf .gif .tex build: $(DOC).pdf $(DOC).html $(UPLOAD).zip $(ARCHIVE).zip clean: rm -f $(DOC).pdf $(DOC).aux $(DOC).log $(DOC).toc texput.log rm -f $(DOC).html $(DOC).xhtml $(UPLOAD).zip $(ARCHIVE).zip rm -f $(FIGURES:=.gif) sampversion.tex rm -f $(TTH) sampversion.tex: makefile rm -f $@ touch $@ echo '\newcommand{\sampversion}{$(DOCVERSION)}' >>$@ echo '\newcommand{\sampdate}{$(DOCDATE)}' >>$@ echo '\newcommand{\samptype}{$(DOCTYPE)}' >>$@ $(DOC).pdf: $(DOC).tex $(FIGURES:=.pdf) sampversion.tex $(PDFLATEX) $(DOC) && $(PDFLATEX) $(DOC) && $(PDFLATEX) $(DOC) # The sed conversion of char A0->nbsp and a few other known non-ASCII # characters is required because the XSLT # transformation dereferences all the character entities - I don't know # how to stop it doing this. We don't know what HTTP header the document # will be served with, so ISO-8859-1 encoding isn't sufficient. # The meta declaration of the charset doesn't seem to do the trick # (for my browser anyway). So use this crude method until someone has # a better idea. Note that other non-ASCII characters may still suffer. $(DOC).html: $(DOC).tex $(DOC).pdf $(FIGURES:=.gif) sampversion.tex \ tth-ivoa.xslt $(TTH) $(TTH) -w2 -e2 -L$(DOC) <$(DOC).tex \ | $(XSLTPROC) --html \ --stringparam CSS_HREF $(CSS_HREF) \ tth-ivoa.xslt - \ | sed 's/\xA0/\ /g' \ | sed 's/\xE9/\é/g' \ | sed 's/\xE7/\ç/g' \ >$(DOC).html $(UPLOAD).zip: $(DOC).pdf $(DOC).html $(FIGURES:=.gif) rm -rf tmp/ mkdir tmp cp $(DOC).pdf tmp/$(UPLOAD).pdf cp $(DOC).html tmp/$(UPLOAD).html cp $(FIGURES:=.gif) tmp/ cd tmp; $(JAR) cfM ../$(UPLOAD).zip \ $(UPLOAD).pdf $(UPLOAD).html $(FIGURES:=.gif) rm -rf tmp/ $(ARCHIVE).zip: $(ARCHIVE_FILES) rm -rf tmp/ mkdir tmp cp $(ARCHIVE_FILES) tmp/ cd tmp; $(JAR) cfM ../$(ARCHIVE).zip $(ARCHIVE_FILES) rm -rf tmp/ # Build TtH from source. See http://hutchinson.belmont.ma.us/tth/. # TtH source seems to be highly portable, so compilation should be easy # as long as you have a C compiler. $(TTH): tth_C/tth.c $(CC) -o $(TTH) tth_C/tth.c ivoa-archi.gif: ivoa-archi.pdf convert -density 80x80 $*.pdf $@ .pdf.gif: $(PDF2GIF) $*.pdf $@