aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.file-metadatabin6123 -> 6402 bytes
-rw-r--r--README-hacking.md8
-rw-r--r--reproduce/analysis/make/initialize.mk4
-rw-r--r--reproduce/software/bash/bashrc.sh45
-rw-r--r--reproduce/software/make/basic.mk5
-rw-r--r--reproduce/software/make/high-level.mk4
6 files changed, 66 insertions, 0 deletions
diff --git a/.file-metadata b/.file-metadata
index 28f008f..3f5e3ef 100644
--- a/.file-metadata
+++ b/.file-metadata
Binary files differ
diff --git a/README-hacking.md b/README-hacking.md
index e836f36..b8d0484 100644
--- a/README-hacking.md
+++ b/README-hacking.md
@@ -856,6 +856,14 @@ for the benefit of others.
learn over the years in using Make and are useful/handy in research
contexts.
+ - *Environment of each recipe*: If you need to define a special
+ environment (or alises, or scripts to run) for all the recipes in
+ your Makefiles, you can use the Bash startup file
+ `reproduce/software/bash/bashrc.sh`. This file is loaded before every
+ Make recipe is run, just like the `.bashrc` in your home directory is
+ loaded everytime you start a new interactive, non-login terminal. See
+ the comments in that file for more.
+
- *Automatic variables*: These are wonderful and very useful Make
constructs that greatly shrink the text, while helping in
read-ability, robustness (less bugs in typos for example) and
diff --git a/reproduce/analysis/make/initialize.mk b/reproduce/analysis/make/initialize.mk
index bf79c94..adaf407 100644
--- a/reproduce/analysis/make/initialize.mk
+++ b/reproduce/analysis/make/initialize.mk
@@ -120,6 +120,10 @@ export LD_LIBRARY_PATH := $(installdir)/lib
# causes crashs (see bug #56682). So we'll just give it no value at all.
export DYLD_LIBRARY_PATH :=
+# Recipe startup script, see `reproduce/software/bash/bashrc.sh'.
+export PROJECT_STATUS := make
+export BASH_ENV := $(shell pwd)/reproduce/software/bash/bashrc.sh
+
diff --git a/reproduce/software/bash/bashrc.sh b/reproduce/software/bash/bashrc.sh
new file mode 100644
index 0000000..5a2ca2b
--- /dev/null
+++ b/reproduce/software/bash/bashrc.sh
@@ -0,0 +1,45 @@
+# Bash startup file for better control of project environment.
+#
+# To have better control over the environment of each analysis step (Make
+# recipe), besides having environment variables (directly included from
+# Make), it may also be useful to have a Bash startup file (this file). All
+# of the Makefiles set this file as the `BASH_ENV' environment variable, so
+# it is loaded into all the Make recipes within the project.
+#
+# The special `PROJECT_STATUS' environment variable is defined in every
+# top-level Makefile of the project. It defines the the state of the Make
+# that is calling this script. It can have three values:
+#
+# configure_basic
+# ---------------
+# When doing basic configuration, therefore the executed steps cannot
+# make any assumptions about the version of Bash (or any other
+# program). Therefore it is important for any step in this step to be
+# highly portable.
+#
+# configure_highlevel
+# -------------------
+# When building the higher-level programs, so the versions of the
+# most basic tools are set and you may safely assume certain
+# features.
+#
+# make
+# ----
+# When doing the project's analysis: all software have known
+# versions.
+#
+#
+# Copyright (C) 2019 Mohammad Akhlaghi <mohammad@akhlaghi.org>
+#
+# This script 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 script 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.
+#
+# A copy of the GNU General Public License is available at
+# <http://www.gnu.org/licenses/>.
diff --git a/reproduce/software/make/basic.mk b/reproduce/software/make/basic.mk
index fc28683..d1c9fa1 100644
--- a/reproduce/software/make/basic.mk
+++ b/reproduce/software/make/basic.mk
@@ -54,6 +54,7 @@ syspath := $(PATH)
# and libraries, not the host's.
export CCACHE_DISABLE := 1
export PATH := $(ibdir):$(PATH)
+export BASH_ENV = $(BDIR)/.bashrc
export PKG_CONFIG_PATH := $(ildir)/pkgconfig
export PKG_CONFIG_LIBDIR := $(ildir)/pkgconfig
export CPPFLAGS := -I$(idir)/include $(CPPFLAGS)
@@ -65,6 +66,10 @@ export LDFLAGS := $(rpath_command) -L$(ildir) $(LDFLAGS)
# causes crashs (see bug #56682). So we'll just give it no value at all.
export DYLD_LIBRARY_PATH :=
+# Recipe startup script, see `reproduce/software/bash/bashrc.sh'.
+export PROJECT_STATUS := configure_basic
+export BASH_ENV := $(shell pwd)/reproduce/software/bash/bashrc.sh
+
# Define the top-level basic programs (that don't depend on any other).
top-level-programs = low-level-links gcc
all: $(foreach p, $(top-level-programs), $(ibidir)/$(p))
diff --git a/reproduce/software/make/high-level.mk b/reproduce/software/make/high-level.mk
index 3b37961..e7ef6e5 100644
--- a/reproduce/software/make/high-level.mk
+++ b/reproduce/software/make/high-level.mk
@@ -83,6 +83,10 @@ export PKG_CONFIG_LIBDIR := $(ildir)/pkgconfig
# causes crashs (see bug #56682). So we'll just give it no value at all.
export DYLD_LIBRARY_PATH :=
+# Recipe startup script, see `reproduce/software/bash/bashrc.sh'.
+export PROJECT_STATUS := configure_highlevel
+export BASH_ENV := $(shell pwd)/reproduce/software/bash/bashrc.sh
+
# Building flags:
#
# C++ flags: when we build GCC, the C++ standard library needs to link with