Ignore:
Timestamp:
05/03/18 14:05:28 (6 years ago)
Author:
oabramkina
Message:

Adding the following compilation options in order to separate the build and the source directories:

--build_path : path to the build directory
--build_dir : name of the build directory
--build_suffixed : generate automatically suffixed name of the build directory.

By default the root directory of the build and the source is the same.
If both options, build_dir and build_suffixed, are specified, the suffixed name will be used.

For example, if XIOS is compiled with the following command:
./make_xios --arch GCC_LINUX --prod --build_path ~/toto --build_indexed

the build directory will be:

~/toto/config_GCC_LINUX_prod

File:
1 edited

Legend:

Unmodified
Added
Removed
  • XIOS/dev/XIOS_DEV_CMIP6/make_xios

    r1458 r1497  
    55use_oasis="false" 
    66oasis="oasis3_mct" 
     7build_path="./" 
     8build_dir="./" 
     9build_suffixed="false" 
    710use_extern_boost="false" 
    811use_extern_blitz="false" 
     
    1114netcdf_lib="netcdf4_par" 
    1215compil_mode="prod" 
    13 arch_path="arch" 
    14 arch_default_path="arch" 
     16arch_path=$PWD/"arch" 
     17arch_default_path=$PWD/"arch" 
    1518arch_defined="FALSE" 
    1619arch_path_defined="FALSE" 
     
    3033            echo "       [--avail] : to know available target architectures " 
    3134            echo "       [--full] : to generate dependencies and recompile from scratch" 
    32             echo "       [--use_oasis 'oasis3' 'oasis3_mct' : default oasis3_mct] : to use Oasis coupler"i 
     35            echo "       [--use_oasis 'oasis3' 'oasis3_mct' : default oasis3_mct] : to use Oasis coupler" 
     36        echo "       [--build_path : absolute or relative path to the build directory" 
     37        echo "       [--build_dir : name of the build directory" 
     38        echo "       [--build_suffixed : generate automatically suffixed name of the build directory (e.g. config_X64_CURIE_prod)" 
    3339        echo "       [--use_extern_boost : to use external boost library" 
    3440        echo "       [--use_extern_blitz : to use external blitz library" 
     
    4854         "--full")  compil_full="true"  ; shift ;; 
    4955         "--use_oasis")  use_oasis="true" oasis=$2 ; shift ; shift  ;; 
     56         "--build_path")  build_path=$2     ; shift ; shift ;; 
     57         "--build_dir")  build_dir=$2     ; shift ; shift ;; 
     58         "--build_suffixed")  build_suffixed="true" ; shift  ;; 
    5059         "--use_extern_boost")  use_extern_boost="true" ; shift  ;; 
    5160         "--use_extern_blitz")  use_extern_blitz="true" ; shift  ;; 
     
    7382fi 
    7483 
     84# Definition of the root directory of the build  
     85if [[ "$build_suffixed" == "true" ]]; then 
     86    install_dir=$PWD/${build_path}/config_${arch}_${compil_mode} 
     87else 
     88    install_dir=$PWD/${build_path}/${build_dir} 
     89fi 
     90mkdir -p $install_dir 
     91 
     92rm -f ${PWD}/bld_dir.cfg 
     93echo "inc    ${install_dir}/arch.fcm" >> ${PWD}/bld_dir.cfg  
     94echo "inc    ${install_dir}/config.fcm" >> ${PWD}/bld_dir.cfg 
     95echo "dir::root  ${install_dir}"   >> ${PWD}/bld_dir.cfg 
     96 
    7597# Vérification de la présence d'un identifiant d'architecture. 
    7698 
     
    87109if [[ "$arch_defined" == "TRUE" ]] 
    88110then 
    89   rm -f arch.path 
    90   rm -f arch.fcm 
    91   rm -f arch.env 
     111  rm -f ${install_dir}/arch.path 
     112  rm -f ${install_dir}/arch.fcm 
     113  rm -f ${install_dir}/arch.env 
    92114 
    93115  if test -f $arch_path/arch-${arch}.path 
    94116  then 
    95     ln -s $arch_path/arch-${arch}.path arch.path 
     117    ln -s $arch_path/arch-${arch}.path ${install_dir}/arch.path 
    96118  elif test -f $arch_default_path/arch-${arch}.path 
    97119  then 
    98     ln -s $arch_default_path/arch-${arch}.path arch.path 
     120    ln -s $arch_default_path/arch-${arch}.path ${install_dir}/arch.path 
    99121  fi 
    100122         
    101123  if test -f $arch_path/arch-${arch}.fcm 
    102124  then 
    103     ln -s $arch_path/arch-${arch}.fcm arch.fcm 
     125    ln -s $arch_path/arch-${arch}.fcm ${install_dir}/arch.fcm 
    104126  elif test -f $arch_default_path/arch-${arch}.fcm 
    105127  then 
    106     ln -s $arch_default_path/arch-${arch}.fcm arch.fcm 
     128    ln -s $arch_default_path/arch-${arch}.fcm ${install_dir}/arch.fcm 
    107129  fi 
    108130 
    109131  if test -f $arch_path/arch-${arch}.env 
    110132  then 
    111     ln -s $arch_path/arch-${arch}.env arch.env 
     133    ln -s $arch_path/arch-${arch}.env ${install_dir}/arch.env 
    112134  elif test -f $arch_default_path/arch-${arch}.env 
    113135  then 
    114     ln -s $arch_default_path/arch-${arch}.env arch.env 
     136    ln -s $arch_default_path/arch-${arch}.env ${install_dir}/arch.env 
    115137  else 
    116     ln -s .void_file arch.env 
     138    ln -s .void_file ${install_dir}/arch.env 
    117139  fi 
    118   source arch.env 
    119   source arch.path 
     140  source ${install_dir}/arch.env 
     141  source ${install_dir}/arch.path 
    120142else 
    121143      echo "Please choose a target achitecture --> list all available architecture using make_xios --avail!" 
     
    225247XIOS_LIB="$XIOS_LIB $NETCDF_LIBDIR $HDF5_LIBDIR $MPI_LIBDIR $NETCDF_LIB $HDF5_LIB $MPI_LIB" 
    226248 
    227 rm -f config.fcm 
    228 echo "%COMPIL_CFLAGS $COMPIL_CFLAGS" >> config.fcm 
    229 echo "%COMPIL_FFLAGS $COMPIL_FFLAGS" >> config.fcm 
    230 echo "%CPP_KEY       $XIOS_CPPKEY"   >> config.fcm 
    231  
    232 echo "%CBASE_INC     $XIOS_CINCDIR" >> config.fcm      
    233 echo "%FBASE_INC     $XIOS_FINCDIR" >> config.fcm 
    234 echo "%ARCH_LD       $XIOS_LIB"     >> config.fcm  
     249rm -f ${install_dir}/config.fcm 
     250echo "%COMPIL_CFLAGS $COMPIL_CFLAGS" >> ${install_dir}/config.fcm 
     251echo "%COMPIL_FFLAGS $COMPIL_FFLAGS" >> ${install_dir}/config.fcm 
     252echo "%CPP_KEY       $XIOS_CPPKEY"   >> ${install_dir}/config.fcm 
     253 
     254echo "%CBASE_INC     $XIOS_CINCDIR" >> ${install_dir}/config.fcm      
     255echo "%FBASE_INC     $XIOS_FINCDIR" >> ${install_dir}/config.fcm 
     256echo "%ARCH_LD       $XIOS_LIB"     >> ${install_dir}/config.fcm  
    235257 
    236258echo "=> Using "$compil_mode" mode for compiling under architecture \""$arch"\" !" 
Note: See TracChangeset for help on using the changeset viewer.