source: codes/icosagcm/trunk/make_icosa @ 89

Last change on this file since 89 was 89, checked in by ymipsl, 12 years ago

improved compilation option in make_icosa:
-full : compile from scratch
-job n : parallel compilation with n task

YM

  • Property svn:executable set to *
File size: 2.2 KB
Line 
1#!/bin/bash
2set -x
3export PATH=$PWD/tools/FCM/bin:$PATH
4
5compil_mode_defined="FALSE"
6compil_mode="prod"
7
8job=1
9full_defined="FALSE"
10arch_defined="FALSE"
11parallel_defined="FALSE"
12arch=""
13parallel="none"
14CPP_KEY="CPP_NONE" 
15
16while (($# > 0))
17  do
18  case $1 in
19      "-h") cat <<fin
20Usage :
21makegcm [options] -m arch exec
22[-h]                       : help
23[-prod / -dev / -debug]    : compilation en mode production (default) / developpement / debug .
24 -arch nom_arch            : nom de l\'architecture cible
25fin
26          exit;;
27
28      "-prod")
29          compil_mode="prod" ; shift ;;
30
31      "-dev")
32          compil_mode="dev" ; shift ;;
33
34      "-debug")
35          compil_mode="debug" ; shift ;;
36
37      "-arch")
38          arch=$2 ; arch_defined="TRUE"; shift ; shift ;;
39
40      "-parallel")
41          parallel=$2 ; parallel_defined="TRUE"; shift ; shift ;;
42
43      "-job")
44          job=$2 ; shift ; shift ;;
45
46      "-full")
47          full_defined="TRUE" ; shift ; shift ;;
48
49      *)
50          code="$1" ; shift ;;
51  esac
52done
53
54rm -f .void_file
55echo > .void_file
56rm -rf .void_dir
57mkdir .void_dir
58
59if [[ "$arch_defined" == "TRUE" ]]
60then
61  rm -f arch.path
62  rm -f arch.fcm
63  rm -f arch.env
64  ln -s arch/arch-${arch}.path ./arch.path
65  ln -s arch/arch-${arch}.fcm  ./arch.fcm
66  if test -f arch/arch-${arch}.env
67    then
68      ln -s arch/arch-${arch}.env arch.env
69    else
70      ln -s .void_file arch.env
71    fi
72  source arch.env
73  source arch.path
74else
75  echo "Veuillez definir une architecture cible"
76  exit 1
77fi
78
79if [[ "$compil_mode" == "prod" ]]
80then
81  COMPIL_FFLAGS="%PROD_FFLAGS"
82elif [[ "$compil_mode" == "dev" ]]
83then
84  COMPIL_FFLAGS="%DEV_FFLAGS"
85elif [[ "$compil_mode" == "debug" ]]
86then
87  COMPIL_FFLAGS="%DEBUG_FFLAGS"
88fi
89
90if [[ "$parallel" == "mpi" ]]
91then
92  CPP_KEY="$CPP_KEY CPP_USING_MPI"
93elif [[ "$parallel" == "none" ]]
94then
95  parallel="none"
96else
97  echo "-parallel value $parallel is invalid, only permited <none> or <mpi>"
98  exit 1
99fi
100
101ICOSA_LIB="$NETCDF_LIBDIR $HDF5_LIBDIR $NETCDF_LIB $HDF5_LIB"
102
103rm -f config.fcm
104
105echo "%COMPIL_FFLAGS $COMPIL_FFLAGS $NETCDF_INCDIR" >> config.fcm
106echo "%CPP_KEY $CPP_KEY" >> config.fcm
107echo "%LIB $ICOSA_LIB">> config.fcm
108
109if [[ "$full_defined" == "TRUE" ]]
110then
111  ./build --job $job --full
112else
113  ./build --job $job
114fi
Note: See TracBrowser for help on using the repository browser.