diff options
Diffstat (limited to 'reproduce/analysis/make')
| -rw-r--r-- | reproduce/analysis/make/paper.mk | 60 | ||||
| -rw-r--r-- | reproduce/analysis/make/verify.mk | 41 |
2 files changed, 75 insertions, 26 deletions
diff --git a/reproduce/analysis/make/paper.mk b/reproduce/analysis/make/paper.mk index d2db4d3..c218cdd 100644 --- a/reproduce/analysis/make/paper.mk +++ b/reproduce/analysis/make/paper.mk @@ -19,6 +19,21 @@ +# Software info in TeX +# -------------------- +# +# The information of the installed software is placed in the +# '.build/software' directory (which the TeX build should not depend +# on). Therefore, we should copy those macros here in the LaTeX build +# directory, so the TeX directory is completely independent from each +# other. +$(mtexdir)/dependencies.tex: $(bsdir)/config/dependencies.tex + cp $(bsdir)/config/*.tex $(mtexdir)/ + + + + + # LaTeX macros for paper # ---------------------- # @@ -40,19 +55,36 @@ # Note that if you don't want the final PDF and just want the processing # and file outputs, you can give any value other than 'yes' to # 'pdf-build-final' in 'reproduce/analysis/config/pdf-build.conf'. -$(mtexdir)/project.tex: $(mtexdir)/verify.tex +$(mtexdir)/project.tex: $(mtexdir)/verify.tex $(mtexdir)/dependencies.tex # If no PDF is requested, or if LaTeX isn't available, don't continue # to building the final PDF. Otherwise, merge all the TeX macros into # one for building the PDF. - @if [ -f .local/bin/pdflatex ] && [ x"$(pdf-build-final)" = xyes ]; then + @if [ -f .local/bin/pdflatex ] && [ x"$(pdf-build-final)" = xyes ]; + then # Put a LaTeX input command for all the necessary macro files. -# 'hardware-parameters.tex' is created in 'configure.sh'. +# Note that 'hardware-parameters.tex' is created in 'configure.sh' +# (which is why it is first in the list). projecttex=$(mtexdir)/project.tex rm -f $$projecttex - for t in $(subst paper,,$(makesrc)) hardware-parameters; do - echo "\input{tex/build/macros/$$t.tex}" >> $$projecttex + for t in hardware-parameters $(subst paper,,$(makesrc)); do + +# Only add the macro file to 'project.tex' if the macro file is +# not empty. Empty macro files are not a bug in Maneage alone: 1) +# the processing of a sub-Makefile may not need to produce any +# written macro for the PDF, and that is perfectly fine. 2) LaTeX +# can also '\input' an empty file. However, it is important for +# for publication servers (like arXiv) that do not allow +# uploading empty files. Therefore, when 'project.tex' contains +# empty files, such severs will not be able compile the PDF +# because the file name is mentioned in 'project.tex', but cannot +# be found in the uploaded files. + tfile=tex/build/macros/$$t.tex + if [ -s $$tfile ]; then + echo "\input{$$tfile}" >> $$projecttex + fi + done # Possibly highlight the '\new' parts of the text. @@ -110,21 +142,6 @@ tikzdir:=$(texbdir)/tikz -# Software info in TeX -# -------------------- -# -# The information of the installed software is placed in the -# '.build/software' directory (which the TeX build should not depend -# on). Therefore, we should copy those macros here in the LaTeX build -# directory, so the TeX directory is completely independent from each -# other. -$(mtexdir)/dependencies.tex: $(bsdir)/config/dependencies.tex - cp $(bsdir)/config/*.tex $(mtexdir)/ - - - - - # The bibliography # ---------------- # @@ -137,8 +154,7 @@ $(mtexdir)/dependencies.tex: $(bsdir)/config/dependencies.tex # recipe and the 'paper.pdf' recipe. But if 'tex/src/references.tex' hasn't # been modified, we don't want to re-build the bibliography, only the final # PDF. -$(texbdir)/paper.bbl: tex/src/references.tex $(mtexdir)/dependencies.tex \ - | $(mtexdir)/project.tex +$(texbdir)/paper.bbl: tex/src/references.tex | $(mtexdir)/project.tex # If '$(mtexdir)/project.tex' is empty, don't build PDF. @macros=$$(cat $(mtexdir)/project.tex) diff --git a/reproduce/analysis/make/verify.mk b/reproduce/analysis/make/verify.mk index 4fedefd..91c4b77 100644 --- a/reproduce/analysis/make/verify.mk +++ b/reproduce/analysis/make/verify.mk @@ -138,11 +138,44 @@ $(mtexdir)/verify.tex: $(foreach s, $(verify-dep), $(mtexdir)/$(s).tex) # Verify TeX macros (the values that go into the PDF text). for m in $(verify-check); do - file=$(mtexdir)/$$m.tex - if [ $$m == delete-me ]; then s=711e2f7fa1f16ecbeeb3df6bcb4ec705 - else echo; echo "'$$m' not recognized."; exit 1 + +# Set the macro file name, make sure it exists (the user may have +# forgot to create it in the respective sub-Makefile). + tfile=$(mtexdir)/$$m.tex + if ! [ -f $$tfile ]; then + printf "$$tfile: ERROR: does not exist! If you do not " + printf "(currently) plan macros to be added to the final " + printf "PDF from that sub-Makefile, do the following to " + printf "avoid this error: put a 'touch \$$@' as the recipe " + printf "of the '\$$(mtexdir)/$$m.tex' target (at the bottom " + printf "of 'reproduce/analysis/make/$$m.mk'). If you later " + printf "decide to define macros there, simply replace the " + printf "temporary 'touch \$$@' command with the command(s) " + printf "to prepare/write the macro (see 'initialize.mk' " + printf "as an example)\n"; + exit 1 fi - $(call verify-txt-no-comments-no-space, $$file, $$s, $@.tmp) + +# Check the hash for this file and verify it. + case $$m in + delete-me) s=711e2f7fa1f16ecbeeb3df6bcb4ec705;; + *) # This file's hash is not in the list above. + +# If the file is empty, we can skip it (with the 'continue' +# command). Otherwise, the user should be informed with an +# error. + if [ -s $$tfile ]; then + printf "$$tfile: ERROR: please add the hash of this " + printf "macro file to the list of hashes above this " + printf "error message (in " + printf "'reproduce/analysis/make/verify.mk')\n"; exit 1 + else + continue + fi + ;; + esac + $(call verify-txt-no-comments-no-space, $$tfile, $$s, $@.tmp) + done # Move temporary file to final target. |
