diff options
author | Mohammad Akhlaghi <mohammad@akhlaghi.org> | 2019-08-01 12:48:15 +0100 |
---|---|---|
committer | Mohammad Akhlaghi <mohammad@akhlaghi.org> | 2019-08-01 12:54:46 +0100 |
commit | 025dee1276a39e447042cc52fd91ed001d9047d6 (patch) | |
tree | 75585e7ab44e8abd634e9d53c87059c9684f768c /README-hacking.md | |
parent | 704fffcfb11d1b41e276bbb52624c393ff7e4428 (diff) |
Bash startup script for every recipe
Until now the only way to define the environment of the Make recipes was
through the exported Make variables (mostly in `initialize.mk' for the
analysis steps for example). However, there is only so much you can do with
environment variables! In some situations you want slightly more
complicated environment control, like setting an alias or running of
scripts (things that are commonly done in the `~/.bashrc' file of users to
configure their interactive, non-login shells).
With this commit, a `reproduce/software/bash/bashrc.sh' has been defined
for this job (which is currently empty!). Every major Make step of the
project adds this file as the `BASH_ENV' environment variable, so the shell
that is created to execute a recipe first executes this file, then the
recipe. Each top-level Makefile also defines a `PROJECT_STATUS' environment
variable that enables users to limit their envirnoment setup based on the
condition it is being setup (in particular in the early phase of
`basic.mk', where the user can't make any assumption about the programs and
has to write a portable shell script).
Diffstat (limited to 'README-hacking.md')
-rw-r--r-- | README-hacking.md | 8 |
1 files changed, 8 insertions, 0 deletions
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 |