aboutsummaryrefslogtreecommitdiff
path: root/reproduce/src/make/initialize.mk
diff options
context:
space:
mode:
authorMohammad Akhlaghi <mohammad@akhlaghi.org>2018-11-11 19:09:21 +0000
committerMohammad Akhlaghi <mohammad@akhlaghi.org>2018-11-12 00:34:19 +0000
commitb7e88b1bf82b936f8fe07c0c2c5f8621c2018f3a (patch)
treebfec9c7f8746ea1f0682fbf0fc56654b41672c9e /reproduce/src/make/initialize.mk
parent595626499d20c6e3b297e72c90b5bd3f4d528e8a (diff)
Dependencies built at the start of the pipeline
To enable easy/proper reproduction of results, all the high-level dependencies are now built within the pipeline and installed in a fixed directory that is added to the PATH of the Makefile. This includes GNU Bash and GNU Make, which are then used to run the pipeline. The `./configure' script will first build Bash and Make within itself, then it will build All the dependencies are also built to be static. So after they are built, changing of the system's low-level libraries (like C library) won't change the tarballs. Currently the C library and C compiler aren't built within the pipeline, but we'll hopefully add them to the build process also. With this change, we now have full control of the shell and Make that will be used in the pipeline, so we can safely remove some of the generalities we had before.
Diffstat (limited to 'reproduce/src/make/initialize.mk')
-rw-r--r--reproduce/src/make/initialize.mk84
1 files changed, 26 insertions, 58 deletions
diff --git a/reproduce/src/make/initialize.mk b/reproduce/src/make/initialize.mk
index f615e22..165db78 100644
--- a/reproduce/src/make/initialize.mk
+++ b/reproduce/src/make/initialize.mk
@@ -47,36 +47,24 @@ pconfdir = reproduce/config/pipeline
-# Sanity check
-# ------------
+# High level environment
+# ----------------------
#
-# We need to make sure that the `./configure' command has already been
-# run. The output of `./configure' is the `$(pconfdir)/LOCAL.mk' file and
-# this is the non-time-stamp prerequisite of $(BDIR), see below.
+# We want the full recipe to be executed in one call to the shell. Also we
+# want Make to run the specific version of Bash that we have installed
+# during `./configure' time.
#
-# There is one problem however: if the user hasn't run `./configure' yet,
-# then `BDIR' isn't defined (will just evaluate to blank space). Therefore
-# it won't appear in the prerequisites and the pipeline will try to build
-# the other directories in the top root directory (`/'). To solve this
-# problem, when `BDIR' isn't defined, we'll define it with a place-holder
-# name (only so it won't evaluate to blank space). Note that this
-# directory will never be built.
-ifeq ($(BDIR),)
-configure-run = no
-BDIR = reproduce/BDIR
-else
-configure-run = yes
-endif
-$(pconfdir)/LOCAL.mk:
- @echo
- @echo "================================================================"
- @echo "For the pipeline's local settings, please run this command first"
- @echo "(P.S. this local configuration is only necessary one time)"
- @echo
- @echo " $$ ./configure"
- @echo "================================================================"
- @echo
- @exit 1
+# Regarding the directories, this pipeline builds its major dependencies
+# itself and doesn't use the local system's default tools. With these
+# environment variables, we are setting it to prefer the software we have
+# build here.
+.ONESHELL:
+.SHELLFLAGS = -ec
+SHELL := .local/bin/bash
+PATH := .local/bin:$(PATH)
+LDFLAGS := -L.local/lib $(LDFLAGS)
+CPPFLAGS := -I.local/include $(CPPFLAGS)
+LD_LIBRARY_PATH := .local/lib:$(LD_LIBRARY_PATH)
@@ -103,52 +91,32 @@ $(pconfdir)/LOCAL.mk:
# are looking for in this pipeline.
.SUFFIXES:
$(tikzdir): | $(texbdir); mkdir $@
-$(BDIR): | $(pconfdir)/LOCAL.mk; mkdir $@
$(texdir) $(lockdir): | $(BDIR); mkdir $@
$(mtexdir) $(texbdir): | $(texdir); mkdir $@
-# Symbolic link to build directory
-# --------------------------------
-#
-# Besides $(BDIR), we are also making a symbolic link to it for easy
-# access. Recall that it is recommended that the actual build directory be
-# in a completely separate part of the file system (a place that may easily
-# be completely deleted).
-#
-# Note that $(BDIR) might not be an absolute path and this will complicate
-# the symbolic link creation. To be generic, we'll first call `readlink' to
-# make sure we have an absolute address, then we'll make a symbolic link to
-# that.
-reproduce/build: | $(BDIR)
- absbdir=$$(readlink -f $(BDIR)); \
- ln -s $$absbdir $@
-
-
-
-
# High-level Makefile management
# ------------------------------
#
# About `.PHONY': these are targets that must be built even if a file with
-# their name exists. Most don't correspond to a file, but those that do are
-# included here ensure that the file is always built in every run: for
-# example the pipeline versions may change within two separate runs, so we
-# want it to be rebuilt every time.
+# their name exists.
+#
+# Only `$(mtexdir)/initialize.tex' corresponds to a file. This is because
+# we want to ensure that the file is always built in every run: it contains
+# the pipeline version which may change between two separate runs, even
+# when no file actually differs.
.PHONY: all clean distclean clean-mmap $(mtexdir)/initialize.tex
-distclean: clean; rm -f $(pconfdir)/LOCAL.mk
# --------- Delete for no Gnuastro ---------
clean-mmap:; rm -f reproduce/config/gnuastro/mmap*
# ------------------------------------------
clean: clean-mmap
-ifeq ($(configure-run),yes)
rm -rf $(BDIR)
-endif
rm -f reproduce/build *.pdf *.log *.out *.aux *.auxlock
-
+distclean: clean
+ rm -f Makefile $(pconfdir)/LOCAL.mk .gnuastro
@@ -163,12 +131,12 @@ endif
$(mtexdir)/initialize.tex: | $(mtexdir)
# Version of the pipeline.
- @v=$$(git describe --dirty --always); \
+ @v=$$(git describe --dirty --always);
echo "\newcommand{\pipelineversion}{$$v}" > $@
# --------- Delete for no Gnuastro ---------
# Version of Gnuastro.
- @v=$$(astnoisechisel --version | awk 'NR==1{print $$NF}'); \
+ @v=$$(astnoisechisel --version | awk 'NR==1{print $$NF}');
echo "\newcommand{\gnuastroversion}{$$v}" >> $@
# ------------------------------------------