GitBucket
4.21.2
Toggle navigation
Snippets
Sign in
Files
Branches
1
Releases
Issues
1
Pull requests
Labels
Priorities
Milestones
Wiki
Forks
nigel.stanger
/
Handbook
Browse code
- Extended targets of various rules.
- Added pdfcrop to SVG processing chain (experimental).
master
1 parent
7d1bbde
commit
a9b46643893a810988baf93f7e94ddfe006dfe31
nstanger
authored
on 22 Jan 2009
Patch
Showing
1 changed file
make-includes/standard_rules.make
Ignore Space
Show notes
View
make-includes/standard_rules.make
################################################################################ # # File: $Id$ # # Standard rules for a variety of situations. Includes standard suffixes and # paths. # # ################################################################################ ################################################################################ # # Required make variables. These should be defined by the calling makefile. # # SUBJECT_CODE # The paper number for the current paper, e.g., 212. # PAPER_NUMBER?=$(error The required make variable PAPER_NUMBER has not been defined. Please set it to the correct value) # # IMGDIR # The path to the directory that contains images, e.g., images. # IMGDIR?=$(error The required make variable IMGDIR has not been defined. Please set it to the directory in which images are located) ################################################################################ # # Default rules. # # # PDF from LaTeX via DVI, typically for images drawn using PSTricks). # %.pdf %-print.pdf: $(IMGDIR)/%.tex latex --jobname=$(IMGDIR)/$* $< dvips -q -f $(IMGDIR)/$* | ps2eps -q -l | epstopdf -f -o=$(IMGDIR)/$@ # # PDF from LaTeX. # %.pdf: %.tex pdflatex $< pdflatex $< # # 2-up PDF from 1-up PDF. # %-2up.pdf: %.pdf pdfnup $< --nup 2x1 --outfile $@ # # Derived XML with inclusions from source XML without inclusions. # %-derived.xml: %.xml xmllint --xinclude $< > $@ # # LaTeX from derived XML. # %.tex: %-derived.xml $(call xslt,$<,xml2latex.xsl,$(call xslt_parameter,paper,$(PAPER_NUMBER))) > $@ # # HTML from derived XML. # %.html: %-derived.xml $(call xslt,$<,xml2html.xsl,$(call xslt_parameter,paper,$(PAPER_NUMBER))) > $@ # # PDF and PNG from OmniGraffle. (We can't automate this.) # %.pdf %-print.pdf %.png %-web.png: %.graffle @echo "$(notdir $<): regenerate $(notdir $@)" @exit 1 # # Various bitmap types embedded in OmniGraffle. (We can't automate this.) # %.graffle: %.png @echo "$(notdir $@): reinsert $(notdir $<)" @exit 1 %.graffle: %.jpg @echo "$(notdir $@): reinsert $(notdir $<)" @exit 1 # # PNG from TIFF. # %.png %-print.png %-web.png: %.tif convert "$<" $(IMGDIR)/$@ # # PNG from PICT. # %.png %-print.png %-web.png: %.pict convert "$<" $(IMGDIR)/$@ # # PDF from Ploticus. # %.pdf %-print.pdf: %.plo ploticus -eps -tightcrop -o stdout $< | shiftbbox | epstopdf --filter --outfile=$(IMGDIR)/$@ # # PDF from PS # %.pdf %-print.pdf: %.ps ps2eps --ignoreBB --nohires --loose < $< | ps2pdf -dEPSCrop - $(IMGDIR)/$@ # # PDF from EPS # %.pdf %-print.pdf: %.eps ps2eps --ignoreBB --nohires --loose < $< | ps2pdf -dEPSCrop - $(IMGDIR)/$@ # # PDF from SVG (via Inkscape) # We remove the intermediate file manually rather than through the tidy/clean # mechanism. # %.pdf %-print.pdf: %.svg inkscape --file=$< --export-text-to-path --without-gui --export-pdf=$*-tmp.pdf pdfcrop $*-tmp.pdf $@ -rm -f $*-tmp.pdf # # PNG from SVG (via Inkscape) # %.png %-print.png %-web.png: %.svg inkscape --file=$< --without-gui --export-area-drawing --export-background-opacity=1.0 --export-dpi=96 --export-png=$@
################################################################################ # # File: $Id$ # # Standard rules for a variety of situations. Includes standard suffixes and # paths. # # ################################################################################ ################################################################################ # # Required make variables. These should be defined by the calling makefile. # # SUBJECT_CODE # The paper number for the current paper, e.g., 212. # PAPER_NUMBER?=$(error The required make variable PAPER_NUMBER has not been defined. Please set it to the correct value) # # IMGDIR # The path to the directory that contains images, e.g., images. # IMGDIR?=$(error The required make variable IMGDIR has not been defined. Please set it to the directory in which images are located) ################################################################################ # # Default rules. # # # PDF from LaTeX via DVI, typically for images drawn using PSTricks). # %-print.pdf: $(IMGDIR)/%.tex latex --jobname=$(IMGDIR)/$* $< dvips -q -f $(IMGDIR)/$* | ps2eps -q -l | epstopdf -f -o=$(IMGDIR)/$@ # # PDF from LaTeX. # %.pdf: %.tex pdflatex $< pdflatex $< # # 2-up PDF from 1-up PDF. # %-2up.pdf: %.pdf pdfnup $< --nup 2x1 --outfile $@ # # Derived XML with inclusions from source XML without inclusions. # %-derived.xml: %.xml xmllint --xinclude $< > $@ # # LaTeX from derived XML. # %.tex: %-derived.xml $(call xslt,$<,xml2latex.xsl,$(call xslt_parameter,paper,$(PAPER_NUMBER))) > $@ # # HTML from derived XML. # %.html: %-derived.xml $(call xslt,$<,xml2html.xsl,$(call xslt_parameter,paper,$(PAPER_NUMBER))) > $@ # # PDF and PNG from OmniGraffle. (We can't automate this.) # %-print.pdf %-web.png: %.graffle @echo "$(notdir $<): regenerate $(notdir $@)" @exit 1 # # Various bitmap types embedded in OmniGraffle. (We can't automate this.) # %.graffle: %.png @echo "$(notdir $@): reinsert $(notdir $<)" @exit 1 %.graffle: %.jpg @echo "$(notdir $@): reinsert $(notdir $<)" @exit 1 # # PNG from TIFF. # %-print.png %-web.png: %.tif convert "$<" $(IMGDIR)/$@ # # PNG from PICT. # %-print.png %-web.png: %.pict convert "$<" $(IMGDIR)/$@ # # PDF from Ploticus. # %-print.pdf: %.plo ploticus -eps -tightcrop -o stdout $< | shiftbbox | epstopdf --filter --outfile=$(IMGDIR)/$@ # # PDF from PS # %-print.pdf: %.ps ps2eps --ignoreBB --nohires --loose < $< | ps2pdf -dEPSCrop - $(IMGDIR)/$@ # # PDF from EPS # %-print.pdf: %.eps ps2eps --ignoreBB --nohires --loose < $< | ps2pdf -dEPSCrop - $(IMGDIR)/$@ # # PDF from SVG (via Inkscape) # We remove the intermediate file manually rather than through the tidy/clean # mechanism, because we might have EPS files that aren't generated by # something else. See build_content_rules.make for explanation of ps2eps # options. # # BIZARRENESS: While Inkscape produces correctly cropped EPSs in the first # place, if we don't run them through ps2eps first, ps2pdf has a tendency to # rotate the PDFs 90 degrees clockwise for no obvious reason and without any # apparent pattern. # %-print.pdf: %.svg inkscape --file=$< --export-text-to-path --without-gui --export-eps=$(IMGDIR)/$*.eps ps2eps --ignoreBB --nohires --loose --gsbbox < $(IMGDIR)/$*.eps | ps2pdf -dEPSCrop - $(IMGDIR)/$@ rm -f $(IMGDIR)/$*.eps # # PNG from SVG (via Inkscape) # %-web.png: %.svg inkscape --file=$< --export-text-to-path --without-gui --export-eps=$(IMGDIR)/$*.eps ps2eps --ignoreBB --nohires --loose --gsbbox < $(IMGDIR)/$*.eps | \ gs -q -dNOPAUSE -dBATCH -dSAFER -dEPSCrop -sDEVICE=png16m -r96 \ -dTextAlphaBits=4 -dGraphicsAlphaBits=4 -sOutputFile=$(IMGDIR)/$@ - rm -f $(IMGDIR)/$*.eps
Show line notes below