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
Merge branch 'master' of https://github.com/Otago-InfoSci-Database/Handbook
master
commit
13e17a9960a1ade5ae326f1398703c49b1552881
2 parents
9f59769
+
f0d9266
Nigel Stanger
authored
on 23 Sep 2019
Patch
Showing
2 changed files
make-includes/build_lecture_rules.make
make-includes/standard_rules.make
Ignore Space
Show notes
View
make-includes/build_lecture_rules.make
################################################################################ # # Standard variables and rules for building a set of lecture files. # Altering these definitions will affect ALL LECTURE MAKEFILES FOR ALL # PAPERS!! If you need to do something specific for a particular paper, # include a custom rule in its makefile. DON'T add it here! # ################################################################################ ################################################################################ # # Add standard file suffixes. # include $(GLOBAL_HANDBOOK_INCLUDE)/standard_suffixes.make ################################################################################ # # Standard directories. # IMGDIR?=images ################################################################################ # # Standard paths. # include $(GLOBAL_HANDBOOK_INCLUDE)/standard_paths.make ################################################################################ # # Files to be cleaned by the various "clean" targets. Note that we don't # "tidy" .aux files because they may be needed by the xr package for inter- # document cross references, but won't get regenerated if the final target # PDF files exist. They will be caught by by the "clean" target though. # TIDY_FILES+=*.tmp *.out *.log *.nav *.toc *.snm *.head *.dvi *.vrb _minted* \ slides-combined.pdf slides-notes.pdf CLEAN_FILES+=*.aux *.pdf ################################################################################ # # Various environment variables. # # Important: default font size for Beamer is 11pt. We need to define this before # loading the standard environment. However, allow the user to override it! ifndef FONT_SIZE FONT_SIZE=11pt endif include $(GLOBAL_HANDBOOK_INCLUDE)/standard_environment.make # # Base file names for the various input and output documents. # SLIDES_IN?=$(DOC_TYPE)_slides FIGURES_IN?=$(DOC_TYPE)_figures COMBINED_IN?=$(DOC_TYPE)_combined NOTES_IN?=$(DOC_TYPE)_notes SLIDES?=$(DOC_TYPE)_$(DOC_NUM)_slides FIGURES?=$(DOC_TYPE)_$(DOC_NUM)_figures COMBINED?=$(DOC_TYPE)_$(DOC_NUM)_combined NOTES?=$(DOC_TYPE)_$(DOC_NUM)_notes # # Standard files to be installed on the web server. # ifneq ($(strip $(SLIDES)),) INSTALL_FILES+=$(SLIDES).pdf endif ifneq ($(strip $(FIGURES)),) INSTALL_FILES+=$(FIGURES).pdf $(FIGURES)-reduced.pdf endif ifneq ($(strip $(COMBINED)),) INSTALL_FILES+=$(COMBINED).pdf endif INSTALL_FILES+=$(wildcard *.mp3) # # List of standard "phony" build targets. # TARGETS+=slides notes slides-combined slides-notes figures figures2up combined # .PHONY: $(TARGETS) ################################################################################ # # Display a message if someone tries to build a target that has been # disabled (by setting the appropriate variable to empty in the makefile). # disabled_message=@$(ECHO) The \"$(1)\" target has been disabled for this $(DOC_TYPE). ################################################################################ # # Default LaTeX command-line options. # * -shell-escape for use with minted (and other things) # * others to aid debugging # # LATEX_FLAGS+=-synctex=1 -shell-escape -interaction=nonstopmode -halt-on-error -file-line-error ################################################################################ # # Alternate LaTeXs for Unicode vs. non-Unicode processing. # ifdef UNICODE LATEXCMD:=$(XELATEX) $(LATEX_FLAGS) else LATEXCMD:=$(PDFLATEX) $(LATEX_FLAGS) endif ################################################################################ # # Build everything. # all: slides notes figures figures2up combined ################################################################################ # # Build presentation slides. If $(SLIDES) is empty, these rules are ignored. # ifneq ($(strip $(SLIDES)),) # # Set the prerequisites for the "slides" build target, depending on # whether the figures document exists. If $(FIGURES) is non-empty, we need # to include the figures .aux file for inter-document cross-references. # ifeq ($(strip $(FIGURES)),) SLIDES_PREREQS:=$(SLIDES).pdf else SLIDES_PREREQS:=figures $(SLIDES).pdf endif # # Build the slides for the presentation. # slides: $(SLIDES_PREREQS) $(SLIDES).pdf: $(SLIDES_IN).tex $(SLIDE_IMAGES) $(SLIDE_BACKGROUNDS) $(SLIDE_FILES) $(LATEXCMD) -jobname=$(SLIDES) '\documentclass[$(LATEX_OPTS)]{lectureslides}\input{$(SLIDES_IN)}' $(LATEXCMD) -jobname=$(SLIDES) '\documentclass[$(LATEX_OPTS)]{lectureslides}\input{$(SLIDES_IN)}' $(LN_S) -f $@ $(SLIDES_IN).pdf else slides: $(call disabled_message,$@) endif ################################################################################ # # Build the presentation notes. If $(NOTES) is empty, these rules are # ignored. # ifneq ($(strip $(NOTES)),) # # Set the prerequisites for the "slides-notes" build target, depending on # whether the figures document exists. If $(FIGURES) is non-empty, we need # to include the figures .aux file for inter-document cross-references. # ifeq ($(strip $(FIGURES)),) NOTES_PREREQS:=$(NOTES).pdf SLIDES_NOTES_PREREQS:=slides-notes.pdf else NOTES_PREREQS:=figures $(NOTES).pdf SLIDES_NOTES_PREREQS:=figures slides-notes.pdf endif # # Build the slides with notes. # slides-notes: $(SLIDES_NOTES_PREREQS) slides-notes.pdf: $(SLIDES_IN).tex $(SLIDE_IMAGES) $(SLIDE_BACKGROUNDS) $(SLIDE_FILES) $(LATEXCMD) -jobname=slides-notes '\documentclass[$(LATEX_OPTS),notes=onlyslideswithnotes]{lectureslides}\input{$(SLIDES_IN)}' $(LATEXCMD) -jobname=slides-notes '\documentclass[$(LATEX_OPTS),notes=onlyslideswithnotes]{lectureslides}\input{$(SLIDES_IN)}' # # Build the slides with notes, 6-up. # notes: $(NOTES_PREREQS) $(NOTES).pdf: $(NOTES_IN).tex slides-notes.pdf $(LATEXCMD) -jobname=$(NOTES) $< $(LATEXCMD) -jobname=$(NOTES) $< $(LN_S) -f $@ $(NOTES_IN).pdf else notes slides-notes: $(call disabled_message,$@) endif ################################################################################ # # Build the complete combined lecture document. If $(COMBINED) is empty, # these rules are ignored. # ifneq ($(strip $(COMBINED)),) # # Set the prerequisites for the "combined" build target, depending on # whether the figures document exists. If $(FIGURES) is empty, they are # omitted from the combined document. # ifeq ($(strip $(FIGURES)),) COMBINED_PREREQS:=$(COMBINED_IN).tex slides-combined.pdf else COMBINED_PREREQS:=$(COMBINED_IN).tex slides-combined.pdf $(FIGURES).pdf endif # # Build the slides for the combined document. # slides-combined: slides-combined.pdf slides-combined.pdf: $(SLIDES_IN).tex $(SLIDE_IMAGES) $(SLIDE_BACKGROUNDS) $(LATEXCMD) -jobname=slides-combined '\documentclass[$(LATEX_OPTS),handout]{lectureslides}\input{$(SLIDES_IN)}' $(LATEXCMD) -jobname=slides-combined '\documentclass[$(LATEX_OPTS),handout]{lectureslides}\input{$(SLIDES_IN)}' # # Build the complete combined document. # combined: $(COMBINED).pdf $(COMBINED).pdf: $(COMBINED_PREREQS) $(COMBI_IMAGES) $(COMBI_FILES) $(LATEXCMD) -jobname=$(COMBINED) $< $(LATEXCMD) -jobname=$(COMBINED) $< $(LN_S) -f $@ $(COMBINED_IN).pdf else combined slides-combined: $(call disabled_message,$@) endif ################################################################################ # # Build the figures and examples document. If $(FIGURES) is empty, these # rules are ignored. # ifneq ($(strip $(FIGURES)),) figures: $(FIGURES).pdf $(FIGURES).pdf: $(FIGURES_IN).tex $(FIG_IMAGES) $(FIG_FILES) $(LATEXCMD) -jobname=$(FIGURES) $< $(LATEXCMD) -jobname=$(FIGURES) $< $(LN_S) -f $@ $(FIGURES_IN).pdf figures2up: $(FIGURES)-reduced.pdf $(FIGURES)-reduced.pdf: $(FIGURES).pdf $(PDFNUP) $< --nup 2x1 --outfile $@ else figures figures2up: $(call disabled_message,$@) endif ################################################################################ # # Build the test document. # test: test.pdf test.pdf: test.tex ################################################################################ # # Deploy the appropriate files into a shared folder, which is then synchronised # with Blackbaord. This relies on the environment variable HANDBOOK_INSTALL_ROOT # being defined, and (assuming that this variable points to a directory on the # network) the appropriate share has been mounted. # # See build_document_rules.make for an explanation of why the install # uses a foreach. # # Note that this won't do anything clever if you give it files that are # in subdirectories of the current directory. Everything will be flattened # at the other end. That is, something like "images/foo.pdf" will go into # the installation directory as "foo.pdf", not "images/foo.pdf". # # If the variable NOSYNC is set (to anything), then files won't be synchronised # with Blackboard. # install: ifndef NOSYNC @$(LOCKFILE) -r0 $(HOME)/.sitecopy/Blackboard$(PAPER_NUMBER).lock && $(SITECOPY) --update --keep-going Blackboard$(PAPER_NUMBER) && $(RM) -f $(HOME)/.sitecopy/Blackboard$(PAPER_NUMBER).lock @$(LOCKFILE) -r0 $(HOME)/.sitecopy/Blackboard$(PAPER_NUMBER).lock && $(SITECOPY) --catchup Blackboard$(PAPER_NUMBER) && $(RM) -f $(HOME)/.sitecopy/Blackboard$(PAPER_NUMBER).lock endif @$(ANNOUNCE) "Deploying files into $(INSTALL_DIRECTORY)" @$(TEST) -d $(HANDBOOK_INSTALL_ROOT) @$(MKDIR_P) $(INSTALL_DIRECTORY) @$(RSYNC) -rltgoDv $(INSTALL_FILES) $(INSTALL_DIRECTORY) ifndef NOSYNC @$(ANNOUNCE) "Synchronising with Blackboard" @$(LOCKFILE) -r0 $(HOME)/.sitecopy/Blackboard$(PAPER_NUMBER).lock && $(SITECOPY) --update Blackboard$(PAPER_NUMBER) && $(RM) -f $(HOME)/.sitecopy/Blackboard$(PAPER_NUMBER).lock endif ################################################################################ # # Debugging: print the values of the standard variables. # debug: @$(ANNOUNCE) Externally defined variables @$(ECHO) "ALL_PAPERS_ROOT = [$(ALL_PAPERS_ROOT)]" @$(ECHO) "TEACHING_SHARED = [$(TEACHING_SHARED)]" @$(ECHO) "HANDBOOK_INSTALL_ROOT = [$(HANDBOOK_INSTALL_ROOT)]" @$(ANNOUNCE) Internally defined variables @$(ECHO) "GLOBAL_HANDBOOK_INCLUDE = [$(GLOBAL_HANDBOOK_INCLUDE)]" @$(ECHO) "INSTALL_DIRECTORY = [$(INSTALL_DIRECTORY)]" @$(ECHO) "BUILD_DIR = [$(BUILD_DIR)]" @$(ECHO) "IMGDIR = [$(IMGDIR)]" @$(ECHO) "PAPER_INCLUDE_PATH = [$(PAPER_INCLUDE_PATH)]" @$(ECHO) "LATEX_INIT_FILE = [$(LATEX_INIT_FILE)]" @$(ECHO) "SUBJECT_CODE = [$(SUBJECT_CODE)]" @$(ECHO) "PAPER_NUMBER = [$(PAPER_NUMBER)]" @$(ECHO) "DOC_TYPE = [$(DOC_TYPE)]" @$(ECHO) "DOC_NUM = [$(DOC_NUM)]" @$(ECHO) "INSTALL_FILES = [$(INSTALL_FILES)]" @$(ECHO) "SLIDE_IMAGES = [$(SLIDE_IMAGES)]" @$(ECHO) "SLIDE_BACKGROUNDS = [$(SLIDE_BACKGROUNDS)]" @$(ECHO) "SLIDE_FILES = [$(SLIDE_FILES)]" @$(ECHO) "FIG_IMAGES = [$(FIG_IMAGES)]" @$(ECHO) "FIG_FILES = [$(FIG_FILES)]" @$(ECHO) "FIG_IMAGES = [$(FIG_IMAGES)]" @$(ECHO) "COMBI_IMAGES = [$(COMBI_IMAGES)]" @$(ECHO) "COMBI_FILES = [$(COMBI_FILES)]" @$(ECHO) "TIDY_FILES = [$(TIDY_FILES)]" @$(ECHO) "CLEAN_FILES = [$(CLEAN_FILES)]" @$(ECHO) "LATEXCMD = [$(LATEXCMD)]" @$(ECHO) "DRAFT = [$(DRAFT)]" @$(ECHO) "LATEX_OPTS = [$(LATEX_OPTS)]" @$(ECHO) "SLIDES_IN = [$(SLIDES_IN)]" @$(ECHO) "SLIDES = [$(SLIDES)]" @$(ECHO) "SLIDES_PREREQS = [$(SLIDES_PREREQS)]" @$(ECHO) "SLIDES_NOTES_PREREQS = [$(NOTES_PREREQS)]" @$(ECHO) "FIGURES_IN = [$(FIGURES_IN)]" @$(ECHO) "FIGURES = [$(FIGURES)]" @$(ECHO) "COMBINED_IN = [$(COMBINED_IN)]" @$(ECHO) "COMBINED = [$(COMBINED)]" @$(ECHO) "NOTES_IN = [$(NOTES_IN)]" @$(ECHO) "NOTES = [$(NOTES)]" @$(ECHO) "NOTES_PREREQS = [$(NOTES_PREREQS)]" @$(ECHO) "COMBINED_PREREQS = [$(COMBINED_PREREQS)]" @$(ECHO) "TARGETS = [$(TARGETS)]" ifdef TEMPDIR @$(ECHO) "TEMPDIR = [$(TEMPDIR)]" endif ################################################################################ # # Clean up: get rid of all the temporary files. # tidy: $(RM) -rf $(TIDY_FILES) # # Clean up: get rid of everything except the original source. # clean: tidy $(RM) -rf $(CLEAN_FILES) ################################################################################ # # List all "phony" build targets. # targets: @$(ECHO) "targets: $(TARGETS)" ################################################################################ # # Standard default rules. # include $(GLOBAL_HANDBOOK_INCLUDE)/standard_rules.make
################################################################################ # # Standard variables and rules for building a set of lecture files. # Altering these definitions will affect ALL LECTURE MAKEFILES FOR ALL # PAPERS!! If you need to do something specific for a particular paper, # include a custom rule in its makefile. DON'T add it here! # ################################################################################ ################################################################################ # # Add standard file suffixes. # include $(GLOBAL_HANDBOOK_INCLUDE)/standard_suffixes.make ################################################################################ # # Standard directories. # IMGDIR?=images ################################################################################ # # Standard paths. # include $(GLOBAL_HANDBOOK_INCLUDE)/standard_paths.make ################################################################################ # # Files to be cleaned by the various "clean" targets. Note that we don't # "tidy" .aux files because they may be needed by the xr package for inter- # document cross references, but won't get regenerated if the final target # PDF files exist. They will be caught by by the "clean" target though. # TIDY_FILES+=*.tmp *.out *.log *.nav *.toc *.snm *.head *.dvi *.vrb _minted* \ slides-combined.pdf slides-notes.pdf CLEAN_FILES+=*.aux *.pdf ################################################################################ # # Various environment variables. # # Important: default font size for Beamer is 11pt. We need to define this before # loading the standard environment. However, allow the user to override it! ifndef FONT_SIZE FONT_SIZE=11pt endif include $(GLOBAL_HANDBOOK_INCLUDE)/standard_environment.make # # Base file names for the various input and output documents. # SLIDES_IN?=$(DOC_TYPE)_slides FIGURES_IN?=$(DOC_TYPE)_figures COMBINED_IN?=$(DOC_TYPE)_combined NOTES_IN?=$(DOC_TYPE)_notes SLIDES?=$(DOC_TYPE)_$(DOC_NUM)_slides FIGURES?=$(DOC_TYPE)_$(DOC_NUM)_figures COMBINED?=$(DOC_TYPE)_$(DOC_NUM)_combined NOTES?=$(DOC_TYPE)_$(DOC_NUM)_notes # # Standard files to be installed on the web server. # ifneq ($(strip $(SLIDES)),) INSTALL_FILES+=$(SLIDES).pdf endif ifneq ($(strip $(FIGURES)),) INSTALL_FILES+=$(FIGURES).pdf $(FIGURES)-reduced.pdf endif ifneq ($(strip $(COMBINED)),) INSTALL_FILES+=$(COMBINED).pdf endif INSTALL_FILES+=$(wildcard *.mp3) # # List of standard "phony" build targets. # TARGETS+=slides notes slides-combined slides-notes figures figures2up combined # .PHONY: $(TARGETS) ################################################################################ # # Display a message if someone tries to build a target that has been # disabled (by setting the appropriate variable to empty in the makefile). # disabled_message=@$(ECHO) The \"$(1)\" target has been disabled for this $(DOC_TYPE). ################################################################################ # # Default LaTeX command-line options. # * -shell-escape for use with minted (and other things) # * others to aid debugging # # LATEX_FLAGS+=-shell-escape -interaction=nonstopmode -halt-on-error -file-line-error ################################################################################ # # Alternate LaTeXs for Unicode vs. non-Unicode processing. # ifdef UNICODE LATEXCMD:=$(XELATEX) $(LATEX_FLAGS) else LATEXCMD:=$(PDFLATEX) $(LATEX_FLAGS) endif ################################################################################ # # Build everything. # all: slides notes figures figures2up combined ################################################################################ # # Build presentation slides. If $(SLIDES) is empty, these rules are ignored. # ifneq ($(strip $(SLIDES)),) # # Set the prerequisites for the "slides" build target, depending on # whether the figures document exists. If $(FIGURES) is non-empty, we need # to include the figures .aux file for inter-document cross-references. # ifeq ($(strip $(FIGURES)),) SLIDES_PREREQS:=$(SLIDES).pdf else SLIDES_PREREQS:=figures $(SLIDES).pdf endif # # Build the slides for the presentation. # slides: $(SLIDES_PREREQS) $(SLIDES).pdf: $(SLIDES_IN).tex $(SLIDE_IMAGES) $(SLIDE_BACKGROUNDS) $(SLIDE_FILES) $(LATEXCMD) -jobname=$(SLIDES) '\documentclass[$(LATEX_OPTS)]{lectureslides}\input{$(SLIDES_IN)}' $(LATEXCMD) -jobname=$(SLIDES) '\documentclass[$(LATEX_OPTS)]{lectureslides}\input{$(SLIDES_IN)}' else slides: $(call disabled_message,$@) endif ################################################################################ # # Build the presentation notes. If $(NOTES) is empty, these rules are # ignored. # ifneq ($(strip $(NOTES)),) # # Set the prerequisites for the "slides-notes" build target, depending on # whether the figures document exists. If $(FIGURES) is non-empty, we need # to include the figures .aux file for inter-document cross-references. # ifeq ($(strip $(FIGURES)),) NOTES_PREREQS:=$(NOTES).pdf SLIDES_NOTES_PREREQS:=slides-notes.pdf else NOTES_PREREQS:=figures $(NOTES).pdf SLIDES_NOTES_PREREQS:=figures slides-notes.pdf endif # # Build the slides with notes. # slides-notes: $(SLIDES_NOTES_PREREQS) slides-notes.pdf: $(SLIDES_IN).tex $(SLIDE_IMAGES) $(SLIDE_BACKGROUNDS) $(SLIDE_FILES) $(LATEXCMD) -jobname=slides-notes '\documentclass[$(LATEX_OPTS),notes=onlyslideswithnotes]{lectureslides}\input{$(SLIDES_IN)}' $(LATEXCMD) -jobname=slides-notes '\documentclass[$(LATEX_OPTS),notes=onlyslideswithnotes]{lectureslides}\input{$(SLIDES_IN)}' # # Build the slides with notes, 6-up. # notes: $(NOTES_PREREQS) $(NOTES).pdf: $(NOTES_IN).tex slides-notes.pdf $(LATEXCMD) -jobname=$(NOTES) $< $(LATEXCMD) -jobname=$(NOTES) $< else notes slides-notes: $(call disabled_message,$@) endif ################################################################################ # # Build the complete combined lecture document. If $(COMBINED) is empty, # these rules are ignored. # ifneq ($(strip $(COMBINED)),) # # Set the prerequisites for the "combined" build target, depending on # whether the figures document exists. If $(FIGURES) is empty, they are # omitted from the combined document. # ifeq ($(strip $(FIGURES)),) COMBINED_PREREQS:=$(COMBINED_IN).tex slides-combined.pdf else COMBINED_PREREQS:=$(COMBINED_IN).tex slides-combined.pdf $(FIGURES).pdf endif # # Build the slides for the combined document. # slides-combined: slides-combined.pdf slides-combined.pdf: $(SLIDES_IN).tex $(SLIDE_IMAGES) $(SLIDE_BACKGROUNDS) $(LATEXCMD) -jobname=slides-combined '\documentclass[$(LATEX_OPTS),handout]{lectureslides}\input{$(SLIDES_IN)}' $(LATEXCMD) -jobname=slides-combined '\documentclass[$(LATEX_OPTS),handout]{lectureslides}\input{$(SLIDES_IN)}' # # Build the complete combined document. # combined: $(COMBINED).pdf $(COMBINED).pdf: $(COMBINED_PREREQS) $(COMBI_IMAGES) $(COMBI_FILES) $(LATEXCMD) -jobname=$(COMBINED) $< $(LATEXCMD) -jobname=$(COMBINED) $< else combined slides-combined: $(call disabled_message,$@) endif ################################################################################ # # Build the figures and examples document. If $(FIGURES) is empty, these # rules are ignored. # ifneq ($(strip $(FIGURES)),) figures: $(FIGURES).pdf $(FIGURES).pdf: $(FIGURES_IN).tex $(FIG_IMAGES) $(FIG_FILES) $(LATEXCMD) -jobname=$(FIGURES) $< $(LATEXCMD) -jobname=$(FIGURES) $< figures2up: $(FIGURES)-reduced.pdf $(FIGURES)-reduced.pdf: $(FIGURES).pdf $(PDFNUP) $< --nup 2x1 --outfile $@ else figures figures2up: $(call disabled_message,$@) endif ################################################################################ # # Build the test document. # test: test.pdf test.pdf: test.tex ################################################################################ # # Deploy the appropriate files into a shared folder, which is then synchronised # with Blackbaord. This relies on the environment variable HANDBOOK_INSTALL_ROOT # being defined, and (assuming that this variable points to a directory on the # network) the appropriate share has been mounted. # # See build_document_rules.make for an explanation of why the install # uses a foreach. # # Note that this won't do anything clever if you give it files that are # in subdirectories of the current directory. Everything will be flattened # at the other end. That is, something like "images/foo.pdf" will go into # the installation directory as "foo.pdf", not "images/foo.pdf". # # If the variable NOSYNC is set (to anything), then files won't be synchronised # with Blackboard. # install: ifndef NOSYNC @$(LOCKFILE) -r0 $(HOME)/.sitecopy/Blackboard$(PAPER_NUMBER).lock && $(SITECOPY) --update --keep-going Blackboard$(PAPER_NUMBER) && $(RM) -f $(HOME)/.sitecopy/Blackboard$(PAPER_NUMBER).lock @$(LOCKFILE) -r0 $(HOME)/.sitecopy/Blackboard$(PAPER_NUMBER).lock && $(SITECOPY) --catchup Blackboard$(PAPER_NUMBER) && $(RM) -f $(HOME)/.sitecopy/Blackboard$(PAPER_NUMBER).lock endif @$(ANNOUNCE) "Deploying files into $(INSTALL_DIRECTORY)" @$(TEST) -d $(HANDBOOK_INSTALL_ROOT) @$(MKDIR_P) $(INSTALL_DIRECTORY) @$(RSYNC) -rltgoDv $(INSTALL_FILES) $(INSTALL_DIRECTORY) ifndef NOSYNC @$(ANNOUNCE) "Synchronising with Blackboard" @$(LOCKFILE) -r0 $(HOME)/.sitecopy/Blackboard$(PAPER_NUMBER).lock && $(SITECOPY) --update Blackboard$(PAPER_NUMBER) && $(RM) -f $(HOME)/.sitecopy/Blackboard$(PAPER_NUMBER).lock endif ################################################################################ # # Debugging: print the values of the standard variables. # debug: @$(ANNOUNCE) Externally defined variables @$(ECHO) "ALL_PAPERS_ROOT = [$(ALL_PAPERS_ROOT)]" @$(ECHO) "TEACHING_SHARED = [$(TEACHING_SHARED)]" @$(ECHO) "HANDBOOK_INSTALL_ROOT = [$(HANDBOOK_INSTALL_ROOT)]" @$(ANNOUNCE) Internally defined variables @$(ECHO) "GLOBAL_HANDBOOK_INCLUDE = [$(GLOBAL_HANDBOOK_INCLUDE)]" @$(ECHO) "INSTALL_DIRECTORY = [$(INSTALL_DIRECTORY)]" @$(ECHO) "BUILD_DIR = [$(BUILD_DIR)]" @$(ECHO) "IMGDIR = [$(IMGDIR)]" @$(ECHO) "PAPER_INCLUDE_PATH = [$(PAPER_INCLUDE_PATH)]" @$(ECHO) "LATEX_INIT_FILE = [$(LATEX_INIT_FILE)]" @$(ECHO) "SUBJECT_CODE = [$(SUBJECT_CODE)]" @$(ECHO) "PAPER_NUMBER = [$(PAPER_NUMBER)]" @$(ECHO) "DOC_TYPE = [$(DOC_TYPE)]" @$(ECHO) "DOC_NUM = [$(DOC_NUM)]" @$(ECHO) "INSTALL_FILES = [$(INSTALL_FILES)]" @$(ECHO) "SLIDE_IMAGES = [$(SLIDE_IMAGES)]" @$(ECHO) "SLIDE_BACKGROUNDS = [$(SLIDE_BACKGROUNDS)]" @$(ECHO) "SLIDE_FILES = [$(SLIDE_FILES)]" @$(ECHO) "FIG_IMAGES = [$(FIG_IMAGES)]" @$(ECHO) "FIG_FILES = [$(FIG_FILES)]" @$(ECHO) "FIG_IMAGES = [$(FIG_IMAGES)]" @$(ECHO) "COMBI_IMAGES = [$(COMBI_IMAGES)]" @$(ECHO) "COMBI_FILES = [$(COMBI_FILES)]" @$(ECHO) "TIDY_FILES = [$(TIDY_FILES)]" @$(ECHO) "CLEAN_FILES = [$(CLEAN_FILES)]" @$(ECHO) "LATEXCMD = [$(LATEXCMD)]" @$(ECHO) "DRAFT = [$(DRAFT)]" @$(ECHO) "LATEX_OPTS = [$(LATEX_OPTS)]" @$(ECHO) "SLIDES_IN = [$(SLIDES_IN)]" @$(ECHO) "SLIDES = [$(SLIDES)]" @$(ECHO) "SLIDES_PREREQS = [$(SLIDES_PREREQS)]" @$(ECHO) "SLIDES_NOTES_PREREQS = [$(NOTES_PREREQS)]" @$(ECHO) "FIGURES_IN = [$(FIGURES_IN)]" @$(ECHO) "FIGURES = [$(FIGURES)]" @$(ECHO) "COMBINED_IN = [$(COMBINED_IN)]" @$(ECHO) "COMBINED = [$(COMBINED)]" @$(ECHO) "NOTES_IN = [$(NOTES_IN)]" @$(ECHO) "NOTES = [$(NOTES)]" @$(ECHO) "NOTES_PREREQS = [$(NOTES_PREREQS)]" @$(ECHO) "COMBINED_PREREQS = [$(COMBINED_PREREQS)]" @$(ECHO) "TARGETS = [$(TARGETS)]" ifdef TEMPDIR @$(ECHO) "TEMPDIR = [$(TEMPDIR)]" endif ################################################################################ # # Clean up: get rid of all the temporary files. # tidy: $(RM) -rf $(TIDY_FILES) # # Clean up: get rid of everything except the original source. # clean: tidy $(RM) -rf $(CLEAN_FILES) ################################################################################ # # List all "phony" build targets. # targets: @$(ECHO) "targets: $(TARGETS)" ################################################################################ # # Standard default rules. # include $(GLOBAL_HANDBOOK_INCLUDE)/standard_rules.make
Ignore Space
Show notes
View
make-includes/standard_rules.make
################################################################################ # # Standard rules for a variety of situations. Includes standard suffixes and # paths. # # ################################################################################ ################################################################################ # # Required make variables. These should be defined by the calling makefile. # # PAPER_NUMBER # 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 LaTeX command-line options. # * -shell-escape for use with minted (and other things) # * others to aid debugging # # LATEX_FLAGS+=-synctex=1 -shell-escape -interaction=nonstopmode -halt-on-error -file-line-error ################################################################################ # # Default rules. # # # PDF from LaTeX, typically for images drawn using PSTricks or TikZ. # %.pdf %-print.pdf: $(IMGDIR)/%.tex ifdef UNICODE $(XELATEX) $(LATEX_FLAGS) -jobname=$(IMGDIR)/$* $< $(XELATEX) $(LATEX_FLAGS) -jobname=$(IMGDIR)/$* $< $(PDFCROP) $(IMGDIR)/$@ $(IMGDIR)/$*-crop.pdf -$(MV) $(IMGDIR)/$*-crop.pdf $(IMGDIR)/$@ else $(LATEX) $(LATEX_FLAGS) -jobname=$(IMGDIR)/$* $< $(LATEX) $(LATEX_FLAGS) -jobname=$(IMGDIR)/$* $< $(DVIPS) -q -f $(IMGDIR)/$* | $(PS2EPS) --quiet --loose | $(EPSTOPDF) --filter --outfile=$(IMGDIR)/$@ endif # # PDF from LaTeX. # %.pdf: %.tex ifdef UNICODE $(XELATEX) $(LATEX_FLAGS) $< $(XELATEX) $(LATEX_FLAGS) $< else $(PDFLATEX) $(LATEX_FLAGS) $< $(PDFLATEX) $(LATEX_FLAGS) $< endif # # 2-up PDF from 1-up PDF. # %-2up.pdf: %.pdf $(PDFNUP) $< --nup 2x1 --outfile $@ # # Derived XML with inclusions from source XML without inclusions. # # This is done by simply running the original source through xmllint # with the --xinclude option to process any xi:include elements. # The result of this could just be piped into the XSLT processor, # except that (a) not all of the processors support input from stdin, # and (b) combining both xmllint and XSLT processing into one command # means that make won't stop if there's any errors from xmllint. # # Sed is used to add a comment to the derived XML file, warning that this # is generated and shouldn't be edited. Sed was used because the <?xml?> # processing instruction MUST be on the first line. The implication here # is that all input source files have an <?xml?> processing instruction # (which they should anyway). # %-derived.xml: %.xml $(XMLLINT) --xinclude $< > $@ @$(SED) --in-place --expression='1a <!-- THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT! -->' $@ # # LaTeX from derived XML. # %.tex: %-derived.xml ifdef UNICODE $(call xslt,$<,xml2xelatex.xsl,$(call xslt_parameter,subject-code,'$(SUBJECT_CODE)') $(call xslt_parameter,paper-number,'$(PAPER_NUMBER)') $(call xslt_parameter,paper-year,'$(PAPER_YEAR)') $(call xslt_parameter,period-code,'$(PAPER_PERIOD)') $(call xslt_parameter,paper-include-path,'$(PAPER_INCLUDE_PATH)') $(call xslt_parameter,latex-initialisation-file,'$(LATEX_INIT_FILE)')) > $@ else $(call xslt,$<,xml2latex.xsl,$(call xslt_parameter,subject-code,'$(SUBJECT_CODE)') $(call xslt_parameter,paper-number,'$(PAPER_NUMBER)') $(call xslt_parameter,paper-year,'$(PAPER_YEAR)') $(call xslt_parameter,period-code,'$(PAPER_PERIOD)') $(call xslt_parameter,paper-include-path,'$(PAPER_INCLUDE_PATH)') $(call xslt_parameter,latex-initialisation-file,'$(LATEX_INIT_FILE)')) > $@ endif # # HTML from derived XML. # %.html: %-derived.xml ifdef UNICODE $(call xslt,$<,xml2xhtml.xsl,$(call xslt_parameter,subject-code,'$(SUBJECT_CODE)') $(call xslt_parameter,paper-number,'$(PAPER_NUMBER)') $(call xslt_parameter,paper-year,'$(PAPER_YEAR)') $(call xslt_parameter,period-code,'$(PAPER_PERIOD)')) > $@ else $(call xslt,$<,xml2html.xsl,$(call xslt_parameter,subject-code,'$(SUBJECT_CODE)') $(call xslt_parameter,paper-number,'$(PAPER_NUMBER)') $(call xslt_parameter,paper-year,'$(PAPER_YEAR)') $(call xslt_parameter,period-code,'$(PAPER_PERIOD)')) > $@ endif # # Image rules can be a bit messy, because the prerequisite might be in any one # of several different formats, but we want to apply the same commands anyway # (e.g., ImageMagick convert) to generate the target. It would be nice if we # could specify variable file types in a prerequisite of a pattern rule (e.g., # %-foo.png: %.png %.jpg %.tif), but unfortunately we can't :(. The solution is # to create a make function to refactor the commands, and then specify as many # rules as required depending on the number of file formats. We still end up # repeating the rule actions, but at least the guts of the action is coded only # once in the function. # # PNG from TIFF, JPEG, PICT (normal image) # Note: PNG prerequisites are dealt with further down. # convert_normal = $(CONVERT) "$(1)" "$(2)" %.png %-print.png %-web.png: %.tif $(call convert_normal,$<,$(IMGDIR)/$@) %.png %-print.png %-web.png: %.jpg $(call convert_normal,$<,$(IMGDIR)/$@) %.png %-print.png %-web.png: %.pict $(call convert_normal,$<,$(IMGDIR)/$@) # # PNG from PNG, TIFF, JPEG, PICT (slide background) # # We lighten these so that they don't overwhelm the text. Note that 15% is # too light for most data projectors, so let's try 33% and see what # happens... (this looks far too much on screen, but data projectors tend # to wash things out much, much more). # # Includes both blurred and unblurred versions, use as required. # # Unblurred: convert_bg = $(CONVERT) "$(1)" -fill white -colorize 67% "$(2)" %-BG.png: %.tif $(call convert_bg,$<,$(IMGDIR)/$@) %-BG.png: %.png $(call convert_bg,$<,$(IMGDIR)/$@) %-BG.png: %.jpg $(call convert_bg,$<,$(IMGDIR)/$@) %-BG.png: %.pict $(call convert_bg,$<,$(IMGDIR)/$@) # # Blurred: convert_bg_blur = $(CONVERT) -blur 0.5 -fill white -colorize 67% "$(1)" "$(2)" %-BG-blur.png: %.tif $(call convert_bg_blur,$<,$(IMGDIR)/$@) %-BG-blur.png: %.png $(call convert_bg_blur,$<,$(IMGDIR)/$@) %-BG-blur.png: %.jpg $(call convert_bg_blur,$<,$(IMGDIR)/$@) %-BG-blur.png: %.pict $(call convert_bg_blur,$<,$(IMGDIR)/$@) # # PNG from XCF. # %.png: %.xcf $(XCF2PNG) -o $(IMGDIR)/$@ $< # # PNG from EPS. # %.png %-print.png %-web.png: %.eps $(PS2EPS) --ignoreBB --nohires --loose --gsbbox < $< | \ $(GS) -q -dNOPAUSE -dBATCH -dSAFER -sDEVICE=png16m -dEPSCrop -r96 \ -dTextAlphaBits=4 -dGraphicsAlphaBits=4 -sOutputFile=$(IMGDIR)/$@ - %-web-zoom.png: %.eps $(PS2EPS) --ignoreBB --nohires --loose --gsbbox < $< | \ $(GS) -q -dNOPAUSE -dBATCH -dSAFER -sDEVICE=png16m -dEPSCrop -r144 \ -dTextAlphaBits=4 -dGraphicsAlphaBits=4 -sOutputFile=$(IMGDIR)/$@ - # # PNG from PS. # %-web.png: %.ps @$(PS2EPS) --ignoreBB --nohires --loose --gsbbox < $< | \ $(GS) -q -dNOPAUSE -dBATCH -dSAFER -sDEVICE=png16m -dEPSCrop -r96 \ -dTextAlphaBits=4 -dGraphicsAlphaBits=4 -sOutputFile=$(IMGDIR)/$@ - %-web-zoom.png: %.ps @$(PS2EPS) --ignoreBB --nohires --loose --gsbbox < $< | \ $(GS) -q -dNOPAUSE -dBATCH -dSAFER -sDEVICE=png16m -dEPSCrop -r144 \ -dTextAlphaBits=4 -dGraphicsAlphaBits=4 -sOutputFile=$(IMGDIR)/$@ - # # PNG from PDF. # %-web.png: %.pdf $(GS) -q -dNOPAUSE -dBATCH -dSAFER -sDEVICE=png16m -r96 \ -dTextAlphaBits=4 -dGraphicsAlphaBits=4 -sOutputFile=$(IMGDIR)/$@ $< %-web-zoom.png: %.pdf $(GS) -q -dNOPAUSE -dBATCH -dSAFER -sDEVICE=png16m -r144 \ -dTextAlphaBits=4 -dGraphicsAlphaBits=4 -sOutputFile=$(IMGDIR)/$@ $< # # PDF from Ploticus. # %.pdf %-print.pdf: %.plo $(PLOTICUS) -eps -tightcrop -o stdout $< | $(SHIFTBBOX) | $(EPSTOPDF) --filter --outfile=$(IMGDIR)/$@ # # PDF from R. # This assumes that the first argument to the R script is the output filename # for the resultant PDF. # %.pdf %-print.pdf: %.R $(R) --slave --file=$< --args "$(IMGDIR)/$@" $(PDFCROP) $(IMGDIR)/$@ $(IMGDIR)/$*-crop.pdf -$(MV) $(IMGDIR)/$*-crop.pdf $(IMGDIR)/$@ # # PDF from PS # %.pdf %-print.pdf: %.ps $(PS2EPS) --quiet --ignoreBB --nohires --loose < $< | $(EPSTOPDF) --filter --outfile=$(IMGDIR)/$@ # # PDF from EPS # %.pdf %-print.pdf: %.eps $(EPSTOPDF) --outfile=$(IMGDIR)/$@ $< # $(PS2EPS) --ignoreBB --nohires --loose < $< | $(PS2PDF) -dEPSCrop - $(IMGDIR)/$@ # # PDF from SVG (via Inkscape) # The --export-area-drawing option now appears to behave correctly with # PDFs (previously it over-cropped slightly). # %.pdf %-print.pdf: %.svg $(INKSCAPE) --file=$< --without-gui --export-area-drawing --export-text-to-path --export-pdf=$(IMGDIR)/$@ # # 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=$(IMGDIR)/$@ %-web-zoom.png: %.svg $(INKSCAPE) --file=$< --without-gui --export-area-drawing --export-background-opacity=1.0 --export-dpi=144 --export-png=$(IMGDIR)/$@ %-print-zoom.png: %.svg $(INKSCAPE) --file=$< --without-gui --export-area-drawing --export-background-opacity=1.0 --export-dpi=300 --export-png=$(IMGDIR)/$@ %-print-zoom-transparent.png: %.svg $(INKSCAPE) --file=$< --without-gui --export-area-drawing --export-background-opacity=0 --export-dpi=300 --export-png=$(IMGDIR)/$@ %-transparent.png: %.svg $(INKSCAPE) --file=$< --without-gui --export-area-drawing --export-background-opacity=0 --export-dpi=96 --export-png=$(IMGDIR)/$@ # # PNG from PNG (change the name). # These appear to need to be separate rules. If both variants need to be # created (i.e., both %-web.png and %-print.png), it only generates one of # them (most likely %-web.png as it's first in the rule) if the rules are # combined into one. This is Kind of Weird. # %-print.png: %.png $(CP) $< $(IMGDIR)/$@ %-web.png: %.png $(CP) $< $(IMGDIR)/$@ # # PDF from PDF (change the name). # Only need a print rule for this one, as the web version is handled by the # PDF to PNG rules above. # %-print.pdf: %.pdf $(CP) $< $(IMGDIR)/$@ # # CSS from Sass (both syntaxes). # %.css: %.sass $(SASS) $< $@ %.css: %.scss $(SASS) $< $@ # # SVG, PNG, TeX from PlantUML # %.svg: %.pu $(PLANTUML) -tsvg -pipe < $< > $(IMGDIR)/$@ %.png: %.pu $(PLANTUML) -tpng -pipe < $< > $(IMGDIR)/$@ %.tex: %.pu $(PLANTUML) -tlatex:nopreamble -pipe < $< > $(IMGDIR)/$@ # # PDF from PlantUML # Direct PDF from PlantUML is problematic, go via SVG instead. # %.pdf: %.pu $(PLANTUML) -tsvg -pipe < $< > $(TEMPDIR)/$*.svg $(INKSCAPE) --file=$(TEMPDIR)/$*.svg --without-gui --export-area-drawing --export-text-to-path --export-pdf=$(IMGDIR)/$@
################################################################################ # # Standard rules for a variety of situations. Includes standard suffixes and # paths. # # ################################################################################ ################################################################################ # # Required make variables. These should be defined by the calling makefile. # # PAPER_NUMBER # 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, typically for images drawn using PSTricks or TikZ. # %.pdf %-print.pdf: $(IMGDIR)/%.tex ifdef UNICODE $(XELATEX) -jobname=$(IMGDIR)/$* $< $(XELATEX) -jobname=$(IMGDIR)/$* $< $(PDFCROP) $(IMGDIR)/$@ $(IMGDIR)/$*-crop.pdf -$(MV) $(IMGDIR)/$*-crop.pdf $(IMGDIR)/$@ else $(LATEX) -jobname=$(IMGDIR)/$* $< $(LATEX) -jobname=$(IMGDIR)/$* $< $(DVIPS) -q -f $(IMGDIR)/$* | $(PS2EPS) --quiet --loose | $(EPSTOPDF) --filter --outfile=$(IMGDIR)/$@ endif # # PDF from LaTeX. # %.pdf: %.tex ifdef UNICODE $(XELATEX) $< $(XELATEX) $< else $(PDFLATEX) $< $(PDFLATEX) $< endif # # 2-up PDF from 1-up PDF. # %-2up.pdf: %.pdf $(PDFNUP) $< --nup 2x1 --outfile $@ # # Derived XML with inclusions from source XML without inclusions. # # This is done by simply running the original source through xmllint # with the --xinclude option to process any xi:include elements. # The result of this could just be piped into the XSLT processor, # except that (a) not all of the processors support input from stdin, # and (b) combining both xmllint and XSLT processing into one command # means that make won't stop if there's any errors from xmllint. # # Sed is used to add a comment to the derived XML file, warning that this # is generated and shouldn't be edited. Sed was used because the <?xml?> # processing instruction MUST be on the first line. The implication here # is that all input source files have an <?xml?> processing instruction # (which they should anyway). # %-derived.xml: %.xml $(XMLLINT) --xinclude $< > $@ @$(SED) --in-place --expression='1a <!-- THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT! -->' $@ # # LaTeX from derived XML. # %.tex: %-derived.xml ifdef UNICODE $(call xslt,$<,xml2xelatex.xsl,$(call xslt_parameter,subject-code,'$(SUBJECT_CODE)') $(call xslt_parameter,paper-number,'$(PAPER_NUMBER)') $(call xslt_parameter,paper-year,'$(PAPER_YEAR)') $(call xslt_parameter,period-code,'$(PAPER_PERIOD)') $(call xslt_parameter,paper-include-path,'$(PAPER_INCLUDE_PATH)') $(call xslt_parameter,latex-initialisation-file,'$(LATEX_INIT_FILE)')) > $@ else $(call xslt,$<,xml2latex.xsl,$(call xslt_parameter,subject-code,'$(SUBJECT_CODE)') $(call xslt_parameter,paper-number,'$(PAPER_NUMBER)') $(call xslt_parameter,paper-year,'$(PAPER_YEAR)') $(call xslt_parameter,period-code,'$(PAPER_PERIOD)') $(call xslt_parameter,paper-include-path,'$(PAPER_INCLUDE_PATH)') $(call xslt_parameter,latex-initialisation-file,'$(LATEX_INIT_FILE)')) > $@ endif # # HTML from derived XML. # %.html: %-derived.xml ifdef UNICODE $(call xslt,$<,xml2xhtml.xsl,$(call xslt_parameter,subject-code,'$(SUBJECT_CODE)') $(call xslt_parameter,paper-number,'$(PAPER_NUMBER)') $(call xslt_parameter,paper-year,'$(PAPER_YEAR)') $(call xslt_parameter,period-code,'$(PAPER_PERIOD)')) > $@ else $(call xslt,$<,xml2html.xsl,$(call xslt_parameter,subject-code,'$(SUBJECT_CODE)') $(call xslt_parameter,paper-number,'$(PAPER_NUMBER)') $(call xslt_parameter,paper-year,'$(PAPER_YEAR)') $(call xslt_parameter,period-code,'$(PAPER_PERIOD)')) > $@ endif # # Image rules can be a bit messy, because the prerequisite might be in any one # of several different formats, but we want to apply the same commands anyway # (e.g., ImageMagick convert) to generate the target. It would be nice if we # could specify variable file types in a prerequisite of a pattern rule (e.g., # %-foo.png: %.png %.jpg %.tif), but unfortunately we can't :(. The solution is # to create a make function to refactor the commands, and then specify as many # rules as required depending on the number of file formats. We still end up # repeating the rule actions, but at least the guts of the action is coded only # once in the function. # # PNG from TIFF, JPEG, PICT (normal image) # Note: PNG prerequisites are dealt with further down. # convert_normal = $(CONVERT) "$(1)" "$(2)" %.png %-print.png %-web.png: %.tif $(call convert_normal,$<,$(IMGDIR)/$@) %.png %-print.png %-web.png: %.jpg $(call convert_normal,$<,$(IMGDIR)/$@) %.png %-print.png %-web.png: %.pict $(call convert_normal,$<,$(IMGDIR)/$@) # # PNG from PNG, TIFF, JPEG, PICT (slide background) # # We lighten these so that they don't overwhelm the text. Note that 15% is # too light for most data projectors, so let's try 33% and see what # happens... (this looks far too much on screen, but data projectors tend # to wash things out much, much more). # # Includes both blurred and unblurred versions, use as required. # # Unblurred: convert_bg = $(CONVERT) "$(1)" -fill white -colorize 67% "$(2)" %-BG.png: %.tif $(call convert_bg,$<,$(IMGDIR)/$@) %-BG.png: %.png $(call convert_bg,$<,$(IMGDIR)/$@) %-BG.png: %.jpg $(call convert_bg,$<,$(IMGDIR)/$@) %-BG.png: %.pict $(call convert_bg,$<,$(IMGDIR)/$@) # # Blurred: convert_bg_blur = $(CONVERT) -blur 0.5 -fill white -colorize 67% "$(1)" "$(2)" %-BG-blur.png: %.tif $(call convert_bg_blur,$<,$(IMGDIR)/$@) %-BG-blur.png: %.png $(call convert_bg_blur,$<,$(IMGDIR)/$@) %-BG-blur.png: %.jpg $(call convert_bg_blur,$<,$(IMGDIR)/$@) %-BG-blur.png: %.pict $(call convert_bg_blur,$<,$(IMGDIR)/$@) # # PNG from XCF. # %.png: %.xcf $(XCF2PNG) -o $(IMGDIR)/$@ $< # # PNG from EPS. # %.png %-print.png %-web.png: %.eps $(PS2EPS) --ignoreBB --nohires --loose --gsbbox < $< | \ $(GS) -q -dNOPAUSE -dBATCH -dSAFER -sDEVICE=png16m -dEPSCrop -r96 \ -dTextAlphaBits=4 -dGraphicsAlphaBits=4 -sOutputFile=$(IMGDIR)/$@ - %-web-zoom.png: %.eps $(PS2EPS) --ignoreBB --nohires --loose --gsbbox < $< | \ $(GS) -q -dNOPAUSE -dBATCH -dSAFER -sDEVICE=png16m -dEPSCrop -r144 \ -dTextAlphaBits=4 -dGraphicsAlphaBits=4 -sOutputFile=$(IMGDIR)/$@ - # # PNG from PS. # %-web.png: %.ps @$(PS2EPS) --ignoreBB --nohires --loose --gsbbox < $< | \ $(GS) -q -dNOPAUSE -dBATCH -dSAFER -sDEVICE=png16m -dEPSCrop -r96 \ -dTextAlphaBits=4 -dGraphicsAlphaBits=4 -sOutputFile=$(IMGDIR)/$@ - %-web-zoom.png: %.ps @$(PS2EPS) --ignoreBB --nohires --loose --gsbbox < $< | \ $(GS) -q -dNOPAUSE -dBATCH -dSAFER -sDEVICE=png16m -dEPSCrop -r144 \ -dTextAlphaBits=4 -dGraphicsAlphaBits=4 -sOutputFile=$(IMGDIR)/$@ - # # PNG from PDF. # %-web.png: %.pdf $(GS) -q -dNOPAUSE -dBATCH -dSAFER -sDEVICE=png16m -r96 \ -dTextAlphaBits=4 -dGraphicsAlphaBits=4 -sOutputFile=$(IMGDIR)/$@ $< %-web-zoom.png: %.pdf $(GS) -q -dNOPAUSE -dBATCH -dSAFER -sDEVICE=png16m -r144 \ -dTextAlphaBits=4 -dGraphicsAlphaBits=4 -sOutputFile=$(IMGDIR)/$@ $< # # PDF from Ploticus. # %.pdf %-print.pdf: %.plo $(PLOTICUS) -eps -tightcrop -o stdout $< | $(SHIFTBBOX) | $(EPSTOPDF) --filter --outfile=$(IMGDIR)/$@ # # PDF from R. # This assumes that the first argument to the R script is the output filename # for the resultant PDF. # %.pdf %-print.pdf: %.R $(R) --slave --file=$< --args "$(IMGDIR)/$@" $(PDFCROP) $(IMGDIR)/$@ $(IMGDIR)/$*-crop.pdf -$(MV) $(IMGDIR)/$*-crop.pdf $(IMGDIR)/$@ # # PDF from PS # %.pdf %-print.pdf: %.ps $(PS2EPS) --quiet --ignoreBB --nohires --loose < $< | $(EPSTOPDF) --filter --outfile=$(IMGDIR)/$@ # # PDF from EPS # %.pdf %-print.pdf: %.eps $(EPSTOPDF) --outfile=$(IMGDIR)/$@ $< # $(PS2EPS) --ignoreBB --nohires --loose < $< | $(PS2PDF) -dEPSCrop - $(IMGDIR)/$@ # # PDF from SVG (via Inkscape) # The --export-area-drawing option now appears to behave correctly with # PDFs (previously it over-cropped slightly). # %.pdf %-print.pdf: %.svg $(INKSCAPE) --file=$< --without-gui --export-area-drawing --export-text-to-path --export-pdf=$(IMGDIR)/$@ # # 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=$(IMGDIR)/$@ %-web-zoom.png: %.svg $(INKSCAPE) --file=$< --without-gui --export-area-drawing --export-background-opacity=1.0 --export-dpi=144 --export-png=$(IMGDIR)/$@ %-print-zoom.png: %.svg $(INKSCAPE) --file=$< --without-gui --export-area-drawing --export-background-opacity=1.0 --export-dpi=300 --export-png=$(IMGDIR)/$@ %-print-zoom-transparent.png: %.svg $(INKSCAPE) --file=$< --without-gui --export-area-drawing --export-background-opacity=0 --export-dpi=300 --export-png=$(IMGDIR)/$@ %-transparent.png: %.svg $(INKSCAPE) --file=$< --without-gui --export-area-drawing --export-background-opacity=0 --export-dpi=96 --export-png=$(IMGDIR)/$@ # # PNG from PNG (change the name). # These appear to need to be separate rules. If both variants need to be # created (i.e., both %-web.png and %-print.png), it only generates one of # them (most likely %-web.png as it's first in the rule) if the rules are # combined into one. This is Kind of Weird. # %-print.png: %.png $(CP) $< $(IMGDIR)/$@ %-web.png: %.png $(CP) $< $(IMGDIR)/$@ # # PDF from PDF (change the name). # Only need a print rule for this one, as the web version is handled by the # PDF to PNG rules above. # %-print.pdf: %.pdf $(CP) $< $(IMGDIR)/$@ # # CSS from Sass (both syntaxes). # %.css: %.sass $(SASS) $< $@ %.css: %.scss $(SASS) $< $@ # # SVG, PNG, TeX from PlantUML # %.svg: %.pu $(PLANTUML) -tsvg -pipe < $< > $(IMGDIR)/$@ %.png: %.pu $(PLANTUML) -tpng -pipe < $< > $(IMGDIR)/$@ %.tex: %.pu $(PLANTUML) -tlatex:nopreamble -pipe < $< > $(IMGDIR)/$@ # # PDF from PlantUML # Direct PDF from PlantUML is problematic, go via SVG instead. # %.pdf: %.pu $(PLANTUML) -tsvg -pipe < $< > $(TEMPDIR)/$*.svg $(INKSCAPE) --file=$(TEMPDIR)/$*.svg --without-gui --export-area-drawing --export-text-to-path --export-pdf=$(IMGDIR)/$@
Show line notes below