description.mk 3.85 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50
# Build the report describing the pipeline. This text/figures is
# finally planned to be a section of the MUSE UDF paper.
#
# This Makefile is indented to be included by a Makefile that is in
# the top directory of this script.
#
# Copyright (C) 2016, Mohammad Akhlaghi <mohammad.akhlaghi@univ-lyon1.fr>
#
# This Makefile is free software: you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This Makefile is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
# General Public License for more details. See
# <http://www.gnu.org/licenses/>.





# Build the tikz directory
# ------------------------
#
# TeX's TikZ tool (along with PGFPlots) is used to build all the
# images in the paper. In order to do its job fast and not have to
# rebuild the images on each run of LaTeX we are using its external
# feature so the image is rebuilt only when necessary. All the
# internal TikZ information for each figure is kept in this directory.
tikz:; mkdir tikz





# Merge all LaTeX macros
# ----------------------
#
# All the separate makefiles wrote their necessary information for the
# paper in the $(mtexdir) directory. Here, we will just concatenate
# all of them into one file to easily import into the LaTeX source of
# the paper.
#
# IMPORTANT NOTE: we cannot simply put `$(mtexdir)/*.tex' for the list
# of prerequisites because all these files are targets them selves and
# do not necessarily exist before Make actually starts (for example
# when the pipeline is run for the first time). You just have to add
# their root filename to the prerequisites list manually here.
51
tex/pipeline.tex: $(foreach t, versions statistics, $(mtexdir)/$(t).tex)
52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85
	echo "\\newcommand{\\buildtexdir}{$(BDIR)/tex}"       > $@
	cat $^                                               >> $@





# BibLaTeX references
# -------------------
#
# To build the BibLaTeX references, we need to run LaTeX once and then
# biber, the rule for building the final PDF will build the final PDF.
description.bbl: tex/ref.tex tex/pipeline.tex | tikz

	if pdflatex -shell-escape -halt-on-error description.tex; then  \
	  echo "LaTeX (in preparation for BibLaTeX) is done.";          \
	else                                                            \
	  rm -f *.auxlock *.bcf *.run.xml *.blg *.aux *.log *.out;      \
	  exit 1;                                                       \
	fi;
	biber description.bcf
	pdflatex -shell-escape description.tex;





# Build final PDF
# ---------------
#
# Note that eventhough `tex/pipeline.tex' is in the `tex/' directory
# `tex/*' will not detect it necessarily because it might not be
# present (it is a target to be built by Make).
description.pdf: description.tex tex/* tex/pipeline.tex description.bbl \
86
	         $(two-d-hists) $(deghst-demo) | tikz
87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104

        # Delete some outputs for TeX to rebuild (if needed)
#	rm tikz/description-figure0*

        # Build the PDF
	if pdflatex -shell-escape -halt-on-error description.tex; then  \
	  echo "LaTeX is done.";                                        \
	else                                                            \
	  rm description.aux;                                           \
	  exit 1;                                                       \
	fi

        # Clean up
	rm -f description.log description.out description.bcf
	rm -f description.blg description.run.xml description.auxlock

        # Alert that the versions.tex file is not necessarily up to date
	@echo; echo; echo; echo "NOTE: Before sharing this PDF, make sure you have committed your changes, delete $(mtexdir)/versions.tex and run 'make' again so the PDF is stamped with the most recent version."