Managing Configurations - CSUS-LLVM/OptSched GitHub Wiki
Environment Variables
Sometimes, you may have many environment variables that you'd need to modify to switch between configurations of the build. In such a case, your .bashrc may not be sufficient.
In cases like this, it is desirable to modify the PS1
environment variable to annotate on your command line what environment you have active.
Populating the current shell's environment
You can modify the environment in-place, which is sufficient for most purposes. Here is a sample way to do this:
export FLANG_INSTALL="/path/to/my/install/of/flang-llvm-7"
export LD_LIBRARY_PATH="$FLANG_INSTALL/lib:$LD_LIBRARY_PATH"
export PS1_OLD="$PS1"
export PS1="(flang-llvm-7) $PS1"
Usage: source the/file/activate
Using a subshell
Subshells can be more convenient, because you can exit the subshell and retain the previous environment. Here is a sample way to do this:
bash --rcfile <(cat <<BASHRC
export PS1_OLD="$PS1"
export PS1="(flang-llvm-7) $PS1"
export FLANG_INSTALL="/path/to/my/install/of/flang-llvm-7"
export LD_LIBRARY_PATH="/path/to/my/install/of/flang-llvm-7/lib:$LD_LIBRARY_PATH"
BASHRC
) -i
Usage: source the/file/shell