1 |
# This is a script in Bash. |
# This is a script in Bash. |
2 |
|
|
3 |
# This script allows to build LMDZE into a directory other than |
# This script allows to build LMDZE into a directory other than |
4 |
# "libf". Optionally, a compiler may be chosen on the command line. |
# "libf". If you just want to build into "libf" with the current |
5 |
|
# compiler file, you can invoke "make" directly. |
|
# -- If a compiler is chosen on the command line then the script links |
|
|
# a compiler file to the directory "libf" and builds LMDZE into a |
|
|
# directory associated to the chosen compiler. |
|
|
|
|
|
# -- If the compiler is not chosen on the command line and a compiler |
|
|
# file already exists in "libf" then the script builds LMDZE with that |
|
|
# compiler into the directory associated to it. |
|
|
|
|
|
# -- If the compiler is not chosen on the command line and there is no |
|
|
# compiler file in "libf" then the script builds LMDZE with the |
|
|
# default compiler macros of make into a default directory. The |
|
|
# default directory is defined in the script. |
|
|
|
|
|
# If you just want to build into "libf" with the current compiler |
|
|
# file, you can invoke "make" directly. |
|
6 |
|
|
7 |
# Usage: |
# Usage: |
8 |
|
# make.sh [options and arguments for make] |
9 |
|
|
10 |
# make.sh [-c <<<compiler>>>] [options and arguments for make] |
set -xe |
|
|
|
|
# The file "<<<compiler>>>.mk" should exist in "../Compilers" and the |
|
|
# directory "<<<compiler>>>" shoud exist in "$dest_dir". |
|
11 |
|
|
12 |
# Note that "-c" was chosen because it is not an option of "make". |
compiler=nag_tools |
13 |
|
|
14 |
getopts :c: name |
dest_dir=~/Bureau/Compil_prod_$compiler |
15 |
if ((($? == 0)) && [[ $name = c ]]) |
##dest_dir=/save/workdir_Lionel/LMDZ_work/LMDZE/Compil_prod_$compiler |
|
then |
|
|
echo "Linking \"$OPTARG.mk\"..." |
|
|
ln -sf ../Compilers/$OPTARG.mk compiler.mk |
|
|
target=$OPTARG |
|
|
shift $((OPTIND - 1)) |
|
|
else |
|
|
# Find the current compiler, if any: |
|
|
if [[ -L compiler.mk ]] |
|
|
then |
|
|
target=`basename $(readlink compiler.mk) .mk` |
|
|
fi |
|
|
fi |
|
16 |
|
|
|
##dest_dir=$workdir/In_transit/LMDZE/Compil_prod |
|
|
dest_dir=/usr/local/guez/LMDZ_work/LMDZE/Compil_prod${target:+_$target} |
|
17 |
# (Do not just use the name of the compiler as a directory name, it |
# (Do not just use the name of the compiler as a directory name, it |
18 |
# confuses some compilers.) |
# confuses some compilers.) |
19 |
|
|
20 |
set -xe |
if [[ ../Compilers/$compiler.mk -nt $dest_dir/compiler.mk ]] |
21 |
gmake -C $dest_dir -f $PWD/GNUmakefile -I$PWD $* libf_dir=$PWD |
then |
22 |
|
cp --force ../Compilers/$compiler.mk $dest_dir/compiler.mk |
23 |
|
chmod a-w $dest_dir/compiler.mk |
24 |
|
fi |
25 |
|
|
26 |
|
make -C $dest_dir -f $PWD/GNUmakefile -I$PWD $* libf_dir=$PWD |
27 |
|
# "-I" option for "nag_rules.mk" |