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
Added support for Sass → CSS.
master
1 parent
3e9ba90
commit
15ac25ba08b4c61cbb121e9ec25bf64cbe9edbcb
Nigel Stanger
authored
on 13 Jun 2013
Patch
Showing
3 changed files
configuration/configure.ac
make-includes/local_configuration.make.in
make-includes/standard_rules.make
Ignore Space
Show notes
View
configuration/configure.ac
dnl dnl $Id$ dnl dnl Autoconf script for database paper handbooks. It creates a ./configure dnl that sets up the local configuration of tools, so that it's easy to get dnl up and going again quickly should some package suddenly decide to rearange dnl itself and install things in different locations. It also makes things dnl completely independent of whatever package manager we happen to be using. dnl dnl All tools used in the handbook makefiles should be included here, so as dnl to abstract things as much as possible. This includes even "obvious" things dnl like cp, mv, etc., and also any required environment variables. dnl AC_PREREQ([2.61]) AC_INIT([INFO Database Handbook], [2.0]) dnl dnl Files to be generated. Currently this is only make include file containing dnl the list of tools used. We could use autoconf to just insert these directly dnl into each of the files in ../make-includes and ../makefile-templates, as dnl appropriate, but it seems to make more sense to define them all in one dnl place. This will make it easier to reuse them in other (especially dnl non-handbook) contexts. dnl AC_CONFIG_FILES([../make-includes/local_configuration.make]) dnl dnl Check required environment variables. Note that we don't error out if any dnl aren't defined, as the makefiles will warn about this anyway. It's really dnl just more for completeness than anything that they're included here. dnl AC_MSG_NOTICE([checking handbook environment]) AC_ARG_VAR(TEACHING_SHARED, [the root level of the shared teaching directory (e.g., /path/to/Teaching/Shared)]) AC_ARG_VAR(ALL_PAPERS_ROOT, [the root level of the current teaching directory hierarchy (e.g., /path/to/Teaching/2005)]) AC_ARG_VAR(HANDBOOK_INSTALL_ROOT, [the root level of the directory hierarchy on the web server (e.g., \\INFO-NTS-12\DBCourses$)]) AC_ARG_VAR(XSLT, [default XSLT processor (in order of preference: "saxon-b", "saxon", "xalan-j", "xalan-c")]) AC_CHECK_ENVVAR([TEACHING_SHARED]) AC_CHECK_ENVVAR([ALL_PAPERS_ROOT]) AC_CHECK_ENVVAR([HANDBOOK_INSTALL_ROOT]) dnl This one is required for configuration, so handle separately. AC_MSG_CHECKING([variable XSLT]) AS_IF([test -z $XSLT], [ AC_MSG_RESULT([no]) AC_MSG_ERROR([required environment variable XSLT not defined])], [AC_MSG_RESULT([$XSLT])]) dnl dnl Check required tools. dnl AC_MSG_NOTICE([checking for required tools]) dnl dnl File system. dnl AC_PROG_MKDIR_P AC_PATH_PROG(MV, mv) AC_PATH_PROG(CP, cp) AC_PATH_PROG(RM, rm) AC_PATH_PROG(TOUCH, touch) AC_PROG_LN_S dnl dnl Searching. dnl AC_PROG_GREP dnl We need GNU find as we use some of its specific command-line switches. AC_CACHE_CHECK([for GNU find], [ac_cv_path_FIND], [AC_PATH_PROGS_FEATURE_CHECK([FIND], [gnufind gfind find], [AS_IF([( sh -c "$ac_path_FIND --version" 2> /dev/null | grep GNU 2>&1 > /dev/null )], [ ac_cv_path_FIND=$ac_path_FIND ac_path_FIND_found=:], [])], [AC_MSG_ERROR([could not find GNU find (irony)])])]) AC_SUBST([FIND], [$ac_cv_path_FIND]) dnl dnl Tests. dnl AC_PATH_PROG(TEST_PROGRAM, test) AC_PATH_PROG(TRUE, true) AC_PATH_PROG(FALSE, false) dnl dnl Output. dnl AC_PATH_PROG(ECHO, echo) AC_PATH_PROG(CAT, cat) AC_PATH_PROG(ANNOUNCE, announce) dnl dnl Miscellaneous utilities. dnl AC_PROG_SED AC_PATH_PROG(CUT, cut) AC_PROG_PERL_VERSION(5.6.0) AC_PATH_PROG(DATE, date) AC_PATH_PROG(EXPR, expr) AC_PATH_PROG(BASENAME, basename) dnl Java stuff. AC_PROG_JAVA dnl AC_CHECK_CLASS([org.apache.xml.resolver.apps.resolver]) dnl AC_CHECK_CLASS([net.sf.saxon.Transform]) dnl We make heavy use of features specific to GNU make. AC_CACHE_CHECK([for GNU make], [ac_cv_path_MAKE], [AC_PATH_PROGS_FEATURE_CHECK([MAKE], [gnumake gmake make], [AS_IF([( sh -c "$ac_path_MAKE --version" 2> /dev/null | grep GNU 2>&1 > /dev/null )], [ ac_cv_path_MAKE=$ac_path_MAKE ac_path_MAKE_found=:], [])], [AC_MSG_ERROR([could not find GNU make])])]) AC_SUBST([MAKE], [$ac_cv_path_MAKE]) dnl dnl LaTeX and friends. dnl AC_PROG_LATEX AC_PROG_PDFLATEX AC_PROG_XELATEX AC_PROG_DVIPS dnl dnl XML manipulation. dnl AC_PATH_PROG(XMLLINT, xmllint) dnl Use a different variable for the XSLT processor path to keep it distinct dnl from the XSLT environment variable, which serves a slightly different dnl purpose. However, we use the value derived from $XSLT above to seed the dnl executable name. # Figure out the appropriate name of the executable based on $XSLT. AS_CASE([$XSLT], [xalan-c], [AC_PATH_PROG(XSLTPROC, [Xalan])], [xalan-j], [AC_PATH_PROG(XSLTPROC, [xalan])], [saxon-b], [ AC_PATH_JARFILE([saxon9], [SAXON], [/opt/local/share/java /sw/share/java /usr/local/share/java /usr/share/java /opt/local/lib/java /sw/lib/java /usr/local/lib/java /usr/lib/java ${HOME}/Library/Java /Library/Java /System/Library/Java]) AC_MSG_CHECKING([for Saxon-B]) AS_IF([$SAXON_AVAILABLE], [AC_SUBST([XSLTPROC], ["${JAVA} -jar ${SAXON_JAR}"]) AC_MSG_RESULT([$XSLTPROC])], [ AC_MSG_RESULT([no]) AC_MSG_ERROR([could not find Saxon-B])])], [AC_MSG_ERROR([unknown XSLT processor "${XSLT}" specified])]) AC_PATH_JARFILE(resolver, RESOLVER, [/opt/local/share/java /sw/share/java /usr/local/share/java /usr/share/java /opt/local/lib/java /sw/lib/java /usr/local/lib/java /usr/lib/java ${HOME}/Library/Java /Library/Java /System/Library/Java]) AC_MSG_CHECKING([for XML entity resolver]) # We can't use -jar for the entity resolver, because it needs to be able # to use the CLASSPATH to find the CatalogManager.properties file. Using # -jar suppresses the CLASSPATH completely. AS_IF([$RESOLVER_AVAILABLE], [ AC_SUBST([RESOLVER], ["${JAVA} -cp ${RESOLVER_JAR}:${CLASSPATH} org.apache.xml.resolver.apps.resolver"]) AC_MSG_RESULT([$RESOLVER])], [ AC_MSG_RESULT([no]) AC_MSG_ERROR([could not find the XML entity resolver])]) dnl dnl Image manipulation and conversion (includes PDF & PS). dnl AC_PATH_PROG(CONVERT, convert) AC_PATH_PROG(COMPOSITE, composite) AC_PATH_PROG(PDFNUP, pdfnup) AC_PATH_PROG(PDFCROP, pdfcrop) AC_PATH_PROG(PS2EPS, ps2eps) AC_PATH_PROG(PS2PDF, ps2pdf) AC_PATH_PROG(SHIFTBBOX, shiftbbox) AC_PATH_PROG(EPSTOPDF, epstopdf) AC_PATH_PROG(INKSCAPE, inkscape) AC_PATH_PROG(GS, gs) AC_PATH_PROG(XCF2PNG, xcf2png) dnl dnl Plotting tools. dnl AC_PATH_PROG(PLOTICUS, ploticus) AC_PATH_PROG(R, R) dnl dnl Web site synchronisation. dnl AC_PATH_PROG(SITECOPY, sitecopy) dnl dnl CSS development. dnl AC_PATH_PROG(SASS, sass) AC_OUTPUT
dnl dnl $Id$ dnl dnl Autoconf script for database paper handbooks. It creates a ./configure dnl that sets up the local configuration of tools, so that it's easy to get dnl up and going again quickly should some package suddenly decide to rearange dnl itself and install things in different locations. It also makes things dnl completely independent of whatever package manager we happen to be using. dnl dnl All tools used in the handbook makefiles should be included here, so as dnl to abstract things as much as possible. This includes even "obvious" things dnl like cp, mv, etc., and also any required environment variables. dnl AC_PREREQ([2.61]) AC_INIT([INFO Database Handbook], [2.0]) dnl dnl Files to be generated. Currently this is only make include file containing dnl the list of tools used. We could use autoconf to just insert these directly dnl into each of the files in ../make-includes and ../makefile-templates, as dnl appropriate, but it seems to make more sense to define them all in one dnl place. This will make it easier to reuse them in other (especially dnl non-handbook) contexts. dnl AC_CONFIG_FILES([../make-includes/local_configuration.make]) dnl dnl Check required environment variables. Note that we don't error out if any dnl aren't defined, as the makefiles will warn about this anyway. It's really dnl just more for completeness than anything that they're included here. dnl AC_MSG_NOTICE([checking handbook environment]) AC_ARG_VAR(TEACHING_SHARED, [the root level of the shared teaching directory (e.g., /path/to/Teaching/Shared)]) AC_ARG_VAR(ALL_PAPERS_ROOT, [the root level of the current teaching directory hierarchy (e.g., /path/to/Teaching/2005)]) AC_ARG_VAR(HANDBOOK_INSTALL_ROOT, [the root level of the directory hierarchy on the web server (e.g., \\INFO-NTS-12\DBCourses$)]) AC_ARG_VAR(XSLT, [default XSLT processor (in order of preference: "saxon-b", "saxon", "xalan-j", "xalan-c")]) AC_CHECK_ENVVAR([TEACHING_SHARED]) AC_CHECK_ENVVAR([ALL_PAPERS_ROOT]) AC_CHECK_ENVVAR([HANDBOOK_INSTALL_ROOT]) dnl This one is required for configuration, so handle separately. AC_MSG_CHECKING([variable XSLT]) AS_IF([test -z $XSLT], [ AC_MSG_RESULT([no]) AC_MSG_ERROR([required environment variable XSLT not defined])], [AC_MSG_RESULT([$XSLT])]) dnl dnl Check required tools. dnl AC_MSG_NOTICE([checking for required tools]) dnl dnl File system. dnl AC_PROG_MKDIR_P AC_PATH_PROG(MV, mv) AC_PATH_PROG(CP, cp) AC_PATH_PROG(RM, rm) AC_PATH_PROG(TOUCH, touch) AC_PROG_LN_S dnl dnl Searching. dnl AC_PROG_GREP dnl We need GNU find as we use some of its specific command-line switches. AC_CACHE_CHECK([for GNU find], [ac_cv_path_FIND], [AC_PATH_PROGS_FEATURE_CHECK([FIND], [gnufind gfind find], [AS_IF([( sh -c "$ac_path_FIND --version" 2> /dev/null | grep GNU 2>&1 > /dev/null )], [ ac_cv_path_FIND=$ac_path_FIND ac_path_FIND_found=:], [])], [AC_MSG_ERROR([could not find GNU find (irony)])])]) AC_SUBST([FIND], [$ac_cv_path_FIND]) dnl dnl Tests. dnl AC_PATH_PROG(TEST_PROGRAM, test) AC_PATH_PROG(TRUE, true) AC_PATH_PROG(FALSE, false) dnl dnl Output. dnl AC_PATH_PROG(ECHO, echo) AC_PATH_PROG(CAT, cat) AC_PATH_PROG(ANNOUNCE, announce) dnl dnl Miscellaneous utilities. dnl AC_PROG_SED AC_PATH_PROG(CUT, cut) AC_PROG_PERL_VERSION(5.6.0) AC_PATH_PROG(DATE, date) AC_PATH_PROG(EXPR, expr) AC_PATH_PROG(BASENAME, basename) dnl Java stuff. AC_PROG_JAVA dnl AC_CHECK_CLASS([org.apache.xml.resolver.apps.resolver]) dnl AC_CHECK_CLASS([net.sf.saxon.Transform]) dnl We make heavy use of features specific to GNU make. AC_CACHE_CHECK([for GNU make], [ac_cv_path_MAKE], [AC_PATH_PROGS_FEATURE_CHECK([MAKE], [gnumake gmake make], [AS_IF([( sh -c "$ac_path_MAKE --version" 2> /dev/null | grep GNU 2>&1 > /dev/null )], [ ac_cv_path_MAKE=$ac_path_MAKE ac_path_MAKE_found=:], [])], [AC_MSG_ERROR([could not find GNU make])])]) AC_SUBST([MAKE], [$ac_cv_path_MAKE]) dnl dnl LaTeX and friends. dnl AC_PROG_LATEX AC_PROG_PDFLATEX AC_PROG_XELATEX AC_PROG_DVIPS dnl dnl XML manipulation. dnl AC_PATH_PROG(XMLLINT, xmllint) dnl Use a different variable for the XSLT processor path to keep it distinct dnl from the XSLT environment variable, which serves a slightly different dnl purpose. However, we use the value derived from $XSLT above to seed the dnl executable name. # Figure out the appropriate name of the executable based on $XSLT. AS_CASE([$XSLT], [xalan-c], [AC_PATH_PROG(XSLTPROC, [Xalan])], [xalan-j], [AC_PATH_PROG(XSLTPROC, [xalan])], [saxon-b], [ AC_PATH_JARFILE([saxon9], [SAXON], [/opt/local/share/java /sw/share/java /usr/local/share/java /usr/share/java /opt/local/lib/java /sw/lib/java /usr/local/lib/java /usr/lib/java ${HOME}/Library/Java /Library/Java /System/Library/Java]) AC_MSG_CHECKING([for Saxon-B]) AS_IF([$SAXON_AVAILABLE], [AC_SUBST([XSLTPROC], ["${JAVA} -jar ${SAXON_JAR}"]) AC_MSG_RESULT([$XSLTPROC])], [ AC_MSG_RESULT([no]) AC_MSG_ERROR([could not find Saxon-B])])], [AC_MSG_ERROR([unknown XSLT processor "${XSLT}" specified])]) AC_PATH_JARFILE(resolver, RESOLVER, [/opt/local/share/java /sw/share/java /usr/local/share/java /usr/share/java /opt/local/lib/java /sw/lib/java /usr/local/lib/java /usr/lib/java ${HOME}/Library/Java /Library/Java /System/Library/Java]) AC_MSG_CHECKING([for XML entity resolver]) # We can't use -jar for the entity resolver, because it needs to be able # to use the CLASSPATH to find the CatalogManager.properties file. Using # -jar suppresses the CLASSPATH completely. AS_IF([$RESOLVER_AVAILABLE], [ AC_SUBST([RESOLVER], ["${JAVA} -cp ${RESOLVER_JAR}:${CLASSPATH} org.apache.xml.resolver.apps.resolver"]) AC_MSG_RESULT([$RESOLVER])], [ AC_MSG_RESULT([no]) AC_MSG_ERROR([could not find the XML entity resolver])]) dnl dnl Image manipulation and conversion (includes PDF & PS). dnl AC_PATH_PROG(CONVERT, convert) AC_PATH_PROG(COMPOSITE, composite) AC_PATH_PROG(PDFNUP, pdfnup) AC_PATH_PROG(PDFCROP, pdfcrop) AC_PATH_PROG(PS2EPS, ps2eps) AC_PATH_PROG(PS2PDF, ps2pdf) AC_PATH_PROG(SHIFTBBOX, shiftbbox) AC_PATH_PROG(EPSTOPDF, epstopdf) AC_PATH_PROG(INKSCAPE, inkscape) AC_PATH_PROG(GS, gs) AC_PATH_PROG(XCF2PNG, xcf2png) dnl dnl Plotting tools. dnl AC_PATH_PROG(PLOTICUS, ploticus) AC_PATH_PROG(R, R) dnl dnl Web site synchronisation. dnl AC_PATH_PROG(SITECOPY, sitecopy) AC_OUTPUT
Ignore Space
Show notes
View
make-includes/local_configuration.make.in
################################################################################ # # $Id$ # # @configure_input@ # # This file sets up items that are system dependent (mostly paths to various) # tools, so it must always be loaded FIRST, before any other make includes! In # particular, it MUST be loaded before files that assume its existence, such # as standard_rules.make. # ################################################################################ # File system. MKDIR_P=@MKDIR_P@ MV=@MV@ CP=@CP@ RM=@RM@ TOUCH=@TOUCH@ LN_S=@LN_S@ # Searching. GREP=@GREP@ FIND=@FIND@ # Tests. TEST=@TEST_PROGRAM@ TRUE=@TRUE@ FALSE=@FALSE@ # Output. ECHO=@ECHO@ CAT=@CAT@ ANNOUNCE=@ANNOUNCE@ # Miscellaneous. SED=@SED@ CUT=@CUT@ PERL=@PERL@ DATE=@DATE@ EXPR=@EXPR@ BASENAME=@BASENAME@ JAVA=@JAVA@ MAKE=@MAKE@ # LaTeX and friends. LATEX=@latex@ PDFLATEX=@pdflatex@ XELATEX=@xelatex@ DVIPS=@dvips@ # XML manipulation. XMLLINT=@XMLLINT@ # Note: XSLTPROC is distinct from the XSLT environment variable. # We may not even use this directly, as the command-line arguments are # different for each processor anyway, which means that the current # approach of parameterised make functions is better in general. XSLTPROC=@XSLTPROC@ RESOLVER=@RESOLVER@ # Image manipulation and conversion (includes PDF & PS). CONVERT=@CONVERT@ COMPOSITE=@COMPOSITE@ PDFNUP=@PDFNUP@ PDFCROP=@PDFCROP@ PS2EPS=@PS2EPS@ PS2PDF=@PS2PDF@ SHIFTBBOX=@SHIFTBBOX@ EPSTOPDF=@EPSTOPDF@ INKSCAPE=@INKSCAPE@ GS=@GS@ XCF2PNG=@XCF2PNG@ # Plotting tools. PLOTICUS=@PLOTICUS@ R=@R@ # Web site synchronisation. SITECOPY=@SITECOPY@ # CSS development. SASS=@SASS@
################################################################################ # # $Id$ # # @configure_input@ # # This file sets up items that are system dependent (mostly paths to various) # tools, so it must always be loaded FIRST, before any other make includes! In # particular, it MUST be loaded before files that assume its existence, such # as standard_rules.make. # ################################################################################ # File system. MKDIR_P=@MKDIR_P@ MV=@MV@ CP=@CP@ RM=@RM@ TOUCH=@TOUCH@ LN_S=@LN_S@ # Searching. GREP=@GREP@ FIND=@FIND@ # Tests. TEST=@TEST_PROGRAM@ TRUE=@TRUE@ FALSE=@FALSE@ # Output. ECHO=@ECHO@ CAT=@CAT@ ANNOUNCE=@ANNOUNCE@ # Miscellaneous. SED=@SED@ CUT=@CUT@ PERL=@PERL@ DATE=@DATE@ EXPR=@EXPR@ BASENAME=@BASENAME@ JAVA=@JAVA@ MAKE=@MAKE@ # LaTeX and friends. LATEX=@latex@ PDFLATEX=@pdflatex@ XELATEX=@xelatex@ DVIPS=@dvips@ # XML manipulation. XMLLINT=@XMLLINT@ # Note: XSLTPROC is distinct from the XSLT environment variable. # We may not even use this directly, as the command-line arguments are # different for each processor anyway, which means that the current # approach of parameterised make functions is better in general. XSLTPROC=@XSLTPROC@ RESOLVER=@RESOLVER@ # Image manipulation and conversion (includes PDF & PS). CONVERT=@CONVERT@ COMPOSITE=@COMPOSITE@ PDFNUP=@PDFNUP@ PDFCROP=@PDFCROP@ PS2EPS=@PS2EPS@ PS2PDF=@PS2PDF@ SHIFTBBOX=@SHIFTBBOX@ EPSTOPDF=@EPSTOPDF@ INKSCAPE=@INKSCAPE@ GS=@GS@ XCF2PNG=@XCF2PNG@ # Plotting tools. PLOTICUS=@PLOTICUS@ R=@R@ # Web site synchronisation. SITECOPY=@SITECOPY@
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. # # 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 via DVI, typically for images drawn using PSTricks). # %.pdf %-print.pdf: $(IMGDIR)/%.tex $(LATEX) --jobname=$(IMGDIR)/$* $< $(DVIPS) -q -f $(IMGDIR)/$* | $(PS2EPS) --quiet --loose | $(EPSTOPDF) --filter --outfile=$(IMGDIR)/$@ # # 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)')) > $@ 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)')) > $@ 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)" -threshold "-1" -depth 16 - | $(COMPOSITE) -dissolve 33% "$(1)" - "$(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 "$(1)" "$(2)"; $(CONVERT) "$(2)" -threshold "-1" -depth 16 - | $(COMPOSITE) -dissolve 33% "$(2)" - "$(3)"; rm -f "$(2)" %-BG-blur.png: %.tif $(call convert_bg_blur,$<,$(IMGDIR)/$*-tmp.png,$(IMGDIR)/$@) %-BG-blur.png: %.png $(call convert_bg_blur,$<,$(IMGDIR)/$*-tmp.png,$(IMGDIR)/$@) %-BG-blur.png: %.jpg $(call convert_bg_blur,$<,$(IMGDIR)/$*-tmp.png,$(IMGDIR)/$@) %-BG-blur.png: %.pict $(call convert_bg_blur,$<,$(IMGDIR)/$*-tmp.png,$(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-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)/$@ # # CSS from Sass (both syntaxes). # %.css: %.sass $(SASS) $< $@ %.css: %.scss $(SASS) $< $@
################################################################################ # # 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. # # 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 via DVI, typically for images drawn using PSTricks). # %.pdf %-print.pdf: $(IMGDIR)/%.tex $(LATEX) --jobname=$(IMGDIR)/$* $< $(DVIPS) -q -f $(IMGDIR)/$* | $(PS2EPS) --quiet --loose | $(EPSTOPDF) --filter --outfile=$(IMGDIR)/$@ # # 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)')) > $@ 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)')) > $@ 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)" -threshold "-1" -depth 16 - | $(COMPOSITE) -dissolve 33% "$(1)" - "$(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 "$(1)" "$(2)"; $(CONVERT) "$(2)" -threshold "-1" -depth 16 - | $(COMPOSITE) -dissolve 33% "$(2)" - "$(3)"; rm -f "$(2)" %-BG-blur.png: %.tif $(call convert_bg_blur,$<,$(IMGDIR)/$*-tmp.png,$(IMGDIR)/$@) %-BG-blur.png: %.png $(call convert_bg_blur,$<,$(IMGDIR)/$*-tmp.png,$(IMGDIR)/$@) %-BG-blur.png: %.jpg $(call convert_bg_blur,$<,$(IMGDIR)/$*-tmp.png,$(IMGDIR)/$@) %-BG-blur.png: %.pict $(call convert_bg_blur,$<,$(IMGDIR)/$*-tmp.png,$(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-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)/$@
Show line notes below