aboutsummaryrefslogtreecommitdiff
path: root/reproduce/src/make/initialize.mk
diff options
context:
space:
mode:
authorMohammad Akhlaghi <mohammad@akhlaghi.org>2019-02-06 02:45:41 +0000
committerMohammad Akhlaghi <mohammad@akhlaghi.org>2019-02-06 02:45:41 +0000
commit33e00f02d4ecd28ea5084fc553d2ad182a11ca52 (patch)
tree5505e4badcf844cfe9f3f12b2817db737053811c /reproduce/src/make/initialize.mk
parente19c7d38f00fe3612a8c499f8ac4c965f52cb86b (diff)
Better management for .tex directories to build from tarball
In order to collaborate effectively in the project, even project members that don't necessarily want (or have the capacity) to do the whole analysis must be able to contribute to the project. Until now, the users of the distributed tarball could only modify the text and not the figures (built with PGFPlots) of the paper. With this commit, the management of TeX source files in the pipeline was slightly modified to allow this as cleanly as I could think of now! In short, the hand-written TeX files are now kept in `tex/src' and for the pipeline's generated TeX files (in particular the old `tex/pipeline.tex'), we now have a `tex/pipeline' symbolic-link/directory that points to the `tex' directory under the build directory. When packaging the project, `tex/pipeline' will be a full directory with a copy of all the necessary files. Therefore as far as LaTeX is concerned, having a build-directory is no longer relevant. Many other small changes were made to do this job cleanly which will just make this commit message too long! Also, the old `tarball' and `zip' targets are now `dist' and `dist-zip' (as in the standard GNU Build system).
Diffstat (limited to 'reproduce/src/make/initialize.mk')
-rw-r--r--reproduce/src/make/initialize.mk68
1 files changed, 51 insertions, 17 deletions
diff --git a/reproduce/src/make/initialize.mk b/reproduce/src/make/initialize.mk
index b3180e3..ff06dcb 100644
--- a/reproduce/src/make/initialize.mk
+++ b/reproduce/src/make/initialize.mk
@@ -140,9 +140,9 @@ export CPPFLAGS := -I$(installdir)/include
# option: they add too many extra checks that make it hard to find what you
# are looking for in this pipeline.
.SUFFIXES:
-$(tikzdir): | $(texbdir); mkdir $@
$(texdir) $(lockdir): | $(BDIR); mkdir $@
$(mtexdir) $(texbdir): | $(texdir); mkdir $@
+$(tikzdir): | $(texbdir); mkdir $@ && ln -s $(tikzdir) tex/tikz
@@ -160,7 +160,7 @@ $(mtexdir) $(texbdir): | $(texdir); mkdir $@
# when no file actually differs.
packagebasename := $(shell echo paper-$$(git describe --dirty --always))
packagecontents = $(texdir)/$(packagebasename)
-.PHONY: all clean distclean clean-mmap tarball zip $(packagecontents) \
+.PHONY: all clean dist dist-zip distclean clean-mmap $(packagecontents) \
$(mtexdir)/initialize.tex
# --------- Delete for no Gnuastro ---------
@@ -206,32 +206,67 @@ $(packagecontents): | $(texdir)
rm -rf $$dir
mkdir $$dir
+ # Build a small Makefile to help in automatizing the paper building
+ # (including the bibliography).
+ m=$$dir/Makefile
+ echo "paper.pdf: paper.tex paper.bbl" > $$m
+ printf "\tpdflatex -shell-escape -halt-on-error paper\n" >> $$m
+ echo "paper.bbl: tex/src/references.tex" >> $$m
+ printf "\tpdflatex -shell-escape -halt-on-error paper\n" >> $$m
+ printf "\tbiber paper\n" >> $$m
+ echo ".PHONY: clean" >> $$m
+ echo "clean:" >> $$m
+ printf "\trm -f *.aux *.auxlock *.bbl *.bcf\n" >> $$m
+ printf "\trm -f *.blg *.log *.out *.run.xml\n" >> $$m
+
# Copy the top-level contents into it.
cp configure COPYING for-group README.md README-hacking.md $$dir/
- # Since the tarball is mainly intended for high-level building of
- # the PDF with LaTeX, we'll comment the `makepdf' LaTeX macro in
- # the paper.
- sed -e's|\\newcommand{\\makepdf}{}|%\\newcommand{\\makepdf}{}|' \
- paper.tex > $$dir/paper.tex
+ # Build the top-level directories.
+ mkdir $$dir/reproduce $$dir/tex $$dir/tex/tikz $$dir/tex/pipeline
# Copy all the `reproduce' contents except for the `build' symbolic
# link.
shopt -s extglob
- mkdir $$dir/reproduce $$dir/tex $$dir/tex/tikz
- cp tex/*.tex $$dir/tex
- cp -r reproduce/!(build) $$dir/reproduce
- cp tex/tikz/*.pdf $$dir/tex/tikz
+ cp -r tex/src $$dir/tex/src
+ cp tex/tikz/*.pdf $$dir/tex/tikz
+ cp -r reproduce/!(build) $$dir/reproduce
+ cp -r tex/pipeline/!($(packagebasename)) $$dir/tex/pipeline
+
+ # Clean up un-necessary/local files: 1) the $(texdir)/build*
+ # directories (when building in a group structure, there will be
+ # `build-user1', `build-user2' and etc), are just temporary LaTeX
+ # build files and don't have any relevant/hand-written files in
+ # them. 2) The `LOCAL.mk' and `gnuastro-local.conf' files just have
+ # this machine's local settings and are irrelevant for anyone else.
+ rm -rf $$dir/tex/pipeline/build*
+ rm $$dir/reproduce/config/pipeline/LOCAL.mk
+ rm $$dir/reproduce/config/gnuastro/gnuastro-local.conf
+
+ # PIPELINE SPECIFIC: under this comment, copy any other file for
+ # packaging, or remove any of the copied files above to suite your
+ # project.
+
+ # Since the packaging is mainly intended for high-level building of
+ # the PDF with LaTeX, we'll comment the `makepdf' LaTeX macro in
+ # the paper.
+ sed -e's|\\newcommand{\\makepdf}{}|%\\newcommand{\\makepdf}{}|' \
+ paper.tex > $$dir/paper.tex
- # PIPELINE SPECIFIC: add or remove any of the copied files above,
- # specific to your pipeline here.
+ # Just in case the package users want to rebuild some of the
+ # figures (manually un-comments the `makepdf' command we commented
+ # above), correct the TikZ external directory, so the figures can
+ # be rebuilt.
+ pgfsettings="$$dir/tex/src/preamble-pgfplots.tex"
+ sed -e's|{tikz/}|{tex/tikz/}|' $$pgfsettings > $$pgfsettings.new
+ mv $$pgfsettings.new $$pgfsettings
- # Clean all temporary files.
+ # Clean temporary (currently those ending in `~') files.
cd $(texdir)
find $(packagebasename) -name \*~ -delete
# Package into `.tar.gz'.
-tarball: $(packagecontents)
+dist: $(packagecontents)
curdir=$$(pwd)
cd $(texdir)
tar -cf $(packagebasename).tar $(packagebasename)
@@ -240,7 +275,7 @@ tarball: $(packagecontents)
mv $(texdir)/$(packagebasename).tar.gz ./
# Package into `.zip'.
-zip: $(packagecontents)
+dist-zip: $(packagecontents)
curdir=$$(pwd)
cd $(texdir)
zip -q -r $(packagebasename).zip $(packagebasename)
@@ -294,7 +329,6 @@ $(mtexdir)/initialize.tex: | $(mtexdir)
# Version of the pipeline and build directory (for LaTeX inputs).
@v=$$(git describe --dirty --always);
echo "\newcommand{\pipelineversion}{$$v}" > $@
- @echo "\newcommand{\bdir}{$(BDIR)}" >> $@
# Versions of programs (same order as 'dependency-versions.mk'),
# ordered alphabetically (by their executable name).