/[lmdze]/trunk/libf/make.sh
ViewVC logotype

Diff of /trunk/libf/make.sh

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 11 by guez, Thu Jun 5 12:43:08 2008 UTC revision 51 by guez, Tue Sep 20 09:14:34 2011 UTC
# Line 1  Line 1 
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".  MAKE=make
13    ##compiler=gfortran
14    compiler=nag_tools
15    
16  getopts :c: name  ##dest_dir=/save/workdir_Lionel/LMDZ_work/LMDZE/Compil_prod_$compiler
17  if ((($? == 0)) && [[ $name = c ]])  dest_dir=~/Bureau/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  
18    
 ##dest_dir=$workdir/LMDZE/Compil_prod  
 dest_dir=/home/guez/In_transit/LMDZE_work/Compil_prod${target:+_$target}  
19  # (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
20  # confuses some compilers.)  # confuses some compilers.)
21    
22  set -xe  compiler_macros_dir=../Compilers
23  gmake -C $dest_dir -f $PWD/GNUmakefile -I$PWD $* libf_dir=$PWD  
24    test -d $dest_dir
25    test -d $compiler_macros_dir
26    
27    if [[ ! -f $compiler_macros_dir/$compiler.mk && -f $dest_dir/compiler.mk ]]
28    then
29        rm $dest_dir/compiler.mk
30    elif [[ $compiler_macros_dir/$compiler.mk -nt $dest_dir/compiler.mk ]]
31    then
32        cp --force $compiler_macros_dir/$compiler.mk $dest_dir/compiler.mk
33        chmod a-w $dest_dir/compiler.mk
34    fi
35    
36    $MAKE -C $dest_dir -f $PWD/GNUmakefile -I$PWD $* libf_dir=$PWD
37    # "-I" option for "nag_rules.mk"

Legend:
Removed from v.11  
changed lines
  Added in v.51

  ViewVC Help
Powered by ViewVC 1.1.21