Index: LMDZ4/trunk/makegcm
===================================================================
--- LMDZ4/trunk/makegcm	(revision 680)
+++ LMDZ4/trunk/makegcm	(revision 768)
@@ -10,13 +10,14 @@
 set physique=lmd
 set phys="PHYS=$physique"
-set include='-I$(LIBF)/grid -I$(LIBF)/bibio -I. '
+set include='-I$(LIBF)/grid -I$(LIBF)/bibio -I$(LIBF)/filtrez -I. '
 set ntrac = 4
 set filtre=filtrez
 set grille=reg
 set couple=false
-set veget=true
+set veget=false
 set chimie=false
 set psmile=false
 set parallel=false
+set vampir=false
 set OPT_STACK='-Wf,-init stack=nan'
 set OPT_STACK=' '
@@ -26,5 +27,5 @@
 set io=ioipsl
 
-set FC_LINUX=g95
+set FC_LINUX=pgf90
 
 ########################################################################
@@ -36,10 +37,13 @@
 #setenv LIBOGCM $LMDGCM/libo
 #set LMDGCM="`pwd`"
+set INCALIB=../INCA3/lib
 #setenv LIBOGCM $LMDGCM/libo
 #
-#setenv IOIPSLDIR /u/fairhead/modipsl_g95/lib
-#setenv MODIPSLDIR /u/fairhead/modipsl_g95/lib
-#setenv NCDFINC "/u/fairhead/netcdf-3.6.0-p1/linux-g95/include/"
-#setenv NCDFLIB "/u/fairhead/netcdf-3.6.0-p1/linux-g95/lib/"
+#setenv IOIPSLDIR /u/fairhead/modipsl_ioipsl_3/lib
+#setenv MODIPSLDIR /u/fairhead/modipsl_ioipsl_3/lib
+#setenv NCDFINC /distrib/local/netcdf/pgi_32bits/include
+#setenv NCDFLIB /distrib/local/netcdf/pgi_32bits/lib/
+
+
 
 setenv localdir "`pwd`"
@@ -64,4 +68,7 @@
       set NCDFINC=`grep sx6nec ../../util/AA_make.gdef| grep NCDF_INC|sed -e "s/^.* =//"`
       set NCDFLIB=`grep sx6nec ../../util/AA_make.gdef| grep NCDF_LIB|sed -e 's/^.* =//'`
+    else  if ( `hostname` == brodie ) then
+      set NCDFINC=`grep sx8brodie ../../util/AA_make.gdef| grep NCDF_INC|sed -e "s/^.* =//"`
+      set NCDFLIB=`grep sx8brodie ../../util/AA_make.gdef| grep NCDF_LIB|sed -e 's/^.* =//'`
     else
       echo 'Probleme de definition des variables NCDFINC et NCDFLIB'
@@ -112,4 +119,5 @@
 set XNEC=0
 set X6NEC=0
+set X8BRODIE=0
 if ( `uname` == HP-UX ) then
    set machine=HP
@@ -127,5 +135,5 @@
    set machine=ALPHA
    set DEC=1
-else if ( `uname` == Linux && `hostname` != mercure ) then
+else if ( `uname` == Linux && `hostname` != mercure  && `hostname` != brodie ) then
    set machine=LINUX
    set LINUX=1
@@ -142,4 +150,7 @@
    set machine=X6NEC
    set X6NEC=1
+else if ( `hostname` == brodie) then
+   set machine=X8BRODIE
+   set X8BRODIE=1
 else
    echo Vous travaillez sur une machine non prevue par le reglement
@@ -231,6 +242,8 @@
      set optim="-fast "
      set optim90=" -fast "
-#   set optimtru90=" -fast -c -Mfree -module $MODIPSLDIR "
      set optimtru90=" -fast -c -Mfree "
+#     set optim=" "
+#     set optim90="  "
+#     set optimtru90=" -c -Mfree "
    else if ( $FC_LINUX == 'g95' ) then 
      set optim=" $OPT_LINUX -fno-second-underscore -ffixed-form -fstatic "
@@ -267,6 +280,19 @@
 #################
    set optdbl='-dw -Wf\"-A dbl4\"'  
-   set optim90=' -clear -float0 -f3 -size_t64 -P stack -Wf "-init stack=nan -init heap=nan" -Ep -DNC_DOUBLE -dw -Wf\"-A dbl4\" -R5 -Wf,"-pvctl loopcnt=40000 fullmsg noassume "'
-   set optimtru90=' -clear -f4 -float0 -size_t64 -P stack -Wf "-init stack=nan -init heap=nan" -Ep -DNC_DOUBLE -dw -Wf\"-A dbl4\" -R2 -R3 -R4 -R5 -Wf,"-pvctl loopcnt=40000 fullmsg noassume"'
+   set optim90=' -clear -float0 -size_t64 -P stack -Wf "-ptr byte -init stack=nan -init heap=nan" -Ep -DNC_DOUBLE -dw -Wf\"-A dbl4\" -R5 -Wf,"-pvctl loopcnt=40000 fullmsg noassume "'
+   set optimtru90=' -clear -f4 -float0 -size_t64 -P stack -Wf "-ptr byte -init stack=nan -init heap=nan" -Ep -DNC_DOUBLE -dw -Wf\"-A dbl4\" -R2 -R3 -R4 -R5 -Wf,"-pvctl loopcnt=40000 fullmsg noassume"'
+   set optim="$optim90"
+   set optimbis=" "
+   set mod_suffix="mod"
+   set mod_loc_dir="./"
+#################
+else if $X8BRODIE then
+##################
+   set optdbl='-dw -Wf\"-A dbl4\"'  
+#   set optim90='-P stack -Wf,-pvctl res=whole,-A dbl4,-init stack=nan,-init heap=nan,-ptr byte -EP -R5 -float0 -dw -Wf,"-pvctl loopcnt=999999 fullmsg noassume" -I/SX/usr/include'
+   set optim90='-P stack -Wf,-pvctl res=whole,-A dbl4,-ptr byte -EP -R5 -float0 -dw -Wf,"-pvctl loopcnt=999999 fullmsg noassume" -I/SX/usr/include'
+#   set optim90='-C vsafe -P stack -Wf,-pvctl res=whole,-A dbl4,-ptr byte -EP -R5 -float0 -dw -Wf,"-pvctl loopcnt=999999 fullmsg noassume" -I/SX/usr/include'
+   set optimtru90="$optim90"
+   set optim90="$optim90"
    set optim="$optim90"
    set optimbis=" "
@@ -503,8 +529,12 @@
 ########################################################################
 
+set cppflags=''
+
+if $X8BRODIE then
+  set cppflags="$cppflags -DNC_DOUBLE -DBLAS -DSGEMV=DGEMV -DSGEMM=DGEMM"
+endif
+
 if ( $io == ioipsl ) then
-   set optim="$optim -DCPP_IOIPSL"
-   set optim90="$optim"
-   set optimtru90="$optimtru90 -DCPP_IOIPSL"
+   set cppflags="$cppflags -DCPP_IOIPSL"
 endif
 
@@ -512,64 +542,57 @@
    set phys="L_PHY= LIBPHY="
 else
-   set optim="$optim -DCPP_PHYS"
-   set optim90="$optim"
-   set optimtru90="$optimtru90 -DCPP_PHYS"
+   set cppflags="$cppflags -DCPP_PHYS"
 endif
 
 set link_veget=" "
 if ( "$veget" == 'true' ) then
-   set optim="$optim -DCPP_VEGET"
-   set optim90="$optim"
-   set optimtru90="$optimtru90 -DCPP_VEGET"
-   set link_veget=" -lsechiba -lparameters -lstomate"
-   if ( $XNEC ) then
-      set link_veget=" -lsxsechiba -lsxparameters -lsxstomate"
+   set cppflags="$cppflags -DCPP_VEGET"
+   set link_veget=" -lsechiba -lparameters -lstomate -lparallel"
+   if ( $XNEC || $X8BRODIE || $X6NEC) then
+      set link_veget=" -lsxsechiba -lsxparameters -lsxstomate -lsxparallel"
    endif
 endif
 
 if ( "$chimie" == 'CH4' ) then
-    set optim="$optim -DINCA -DINCA_CH4 "
-    set optim90="$optim"
+    set cppflags="$cppflags -DINCA -DINCA_CH4 "
 else if ( "$chimie" == 'CH4_AER' ) then
-    set optim="$optim -DINCA -DINCA_CH4 -DINCA_AER"
-    set optim90="$optim"
+    set cppflags="$cppflags -DINCA -DINCA_CH4 -DINCA_AER"
 else if ( "$chimie" == 'NMHC' ) then
-    set optim="$optim -DINCA -DINCA_NMHC "
-    set optim90="$optim"
+    set cppflags="$cppflags -DINCA -DINCA_NMHC "
 else if ( "$chimie" == 'NMHC_AER' ) then
-    set optim="$optim -DINCA -DINCA_NMHC -DINCA_AER"
-    set optim90="$optim"
+    set cppflags="$cppflags -DINCA -DINCA_NMHC -DINCA_AER"
 else if ( "$chimie" == 'AER' ) then
-    set optim="$optim -DINCA -DINCA_AER"
-    set optim90="$optim"
+    set cppflags="$cppflags -DINCA -DINCA_AER"
 else if ("$chimie" == 'GES' ) then
-    set optim="$optim -DINCA" 
-    set optim90="$optim"
+    set cppflags="$cppflags -DINCA" 
 endif
 if ( "$chimie" == 'CH4' || "$chimie" == 'CH4_AER' || "$chimie" == 'NMHC' || "$chimie" == 'NMHC_AER' || "$chimie" == 'AER' || "$chimie" == 'GES' ) then
-    set opt_dep="$opt_dep chimie" 
-    set libchimie="-lchimie"
-    if ( $XNEC || $X6NEC ) then
-      set libchimie="-lsxchimie"
-    endif
+#    set opt_dep="$opt_dep chimie" 
+    set libchimie=" -L$INCALIB -lchimie"
+    set opt_link="$opt_link  -L$INCALIB -lchimie"
+#    set libchimie="-lchimie"
+#    if ( $XNEC || $X6NEC || $X8BRODIE ) then
+#      set libchimie="-lsxchimie"
+#    endif
 endif
     
 if ( "$couple" == 'true' ) then
-   set optim="$optim -DCPP_COUPLE"
-   set optim90="$optim90 -DCPP_COUPLE"
-   set optimtru90="$optimtru90 -DCPP_COUPLE"
+   set cppflags="$cppflags -DCPP_COUPLE"
 endif
 
 if ( "$psmile" == 'true' ) then
-   set optim="$optim -DCPP_PSMILE"
-   set optim90="$optim90 -DCPP_PSMILE"
-   set optimtru90="$optimtru90 -DCPP_PSMILE"
-endif
-
+   set cppflags="$cppflags -DCPP_PSMILE"
+endif
+
+set FLAG_PARA=''
 if ( "$parallel" == 'true' ) then
-   set optim="$optim -DCPP_PARALLEL"
-   set optim90="$optim90 -DCPP_PARALLEL"
-   set optimtru90="$optimtru90 -DCPP_PARALLEL"
-endif
+   set cppflags="$cppflags -DCPP_PARA"
+   set FLAG_PARA='par'
+endif
+
+set optim="$optim $cppflags"
+set optim90="$optim90 $cppflags"
+set optimtru90="$optimtru90 $cppflags"
+
 
 ########################################################################
@@ -633,5 +656,5 @@
     set nomlib=F90_${dim_}_t${ntrac}
 endif
-if ( $NEC || $XNEC || $X6NEC) then
+if ( $NEC || $XNEC || $X6NEC || $X8BRODIE ) then
     set nomlib=F90_${dim_}_t${ntrac}
 endif
@@ -643,5 +666,5 @@
 set dimh=$dim
 else
-set include="$include "'-I$(LIBF)/dyn3d '
+set include="$include "'-I$(LIBF)/dyn3d${FLAG_PARA} '
 set dimh=`echo $dim | awk ' { print $1 "." $2 } '`
 endif
@@ -794,8 +817,8 @@
 # On adapte d'abord certains include à F90
 ##########################################
-sed -e 's/^c/\!/' $libf/grid/dimensions.h >! $libf/grid/dimensions90.tmp
-if ( ! -f $libf/grid/dimensions90.h || `diff $libf/grid/dimensions90.tmp $libf/grid/dimensions90.h | wc -w` ) then
-      \mv $libf/grid/dimensions90.tmp $libf/grid/dimensions90.h
-endif
+#sed -e 's/^c/\!/' $libf/grid/dimensions.h >! $libf/grid/dimensions90.tmp
+#if ( ! -f $libf/grid/dimensions90.h || `diff $libf/grid/dimensions90.tmp $libf/grid/dimensions90.h | wc -w` ) then
+#      \mv $libf/grid/dimensions90.tmp $libf/grid/dimensions90.h
+#endif
 awk 'BEGIN {} { sub ("^c","\!") ; if ($0 ~ /^     s/) {if (NR > 1) print p0," &"; sub ("     s","     \\&")} else { if (NR > 1) print p0  } p0=$0 } END { print p0}' $libf/dyn3d/paramet.h >! $libf/dyn3d/paramet90.tmp
 # sed -n -e 's/^c/\!/' -e '1 h' -e '2,$ H' -e '$ { x ; s/\n     s/ \&\n     \& /g ; p }' $libf/dyn3d/paramet.h >! $libf/dyn3d/paramet90.tmp
@@ -884,5 +907,5 @@
    set f90=$FC_LINUX
    if ( $FC_LINUX == 'pgf90' ) then
-   set opt_link=" -L /usr/local/pgi/linux86/lib -lpgf90 -lpgftnrtl -lpghpf -lpghpf2 -L$MODIPSLDIR $link_veget -L$NCDFLIB -lnetcdf -lioipsl -Wl,-Bstatic -L/usr/lib/gcc-lib/i386-linux/2.95.2/"
+   set opt_link=" -L$MODIPSLDIR $link_veget -L$NCDFLIB -lioipsl -lnetcdf -Wl,-Bstatic -L/usr/lib/gcc-lib/i386-linux/2.95.2/"
    else if ($FC_LINUX == 'g95') then
      set opt_link="-L$MODIPSLDIR $link_veget -lioipsl -L$NCDFLIB -lnetcdf -lioipsl -lnetcdf "
@@ -945,7 +968,7 @@
    set f90=sxmpif90
    if $MODIPSL then
-     set opt_link="-L$MODIPSLDIR"
+     set opt_link="$opt_link -L$MODIPSLDIR"
      if ($veget == true) then
-       set opt_link="$opt_link -lsxsechiba -lsxparameters -lsxstomate"
+       set opt_link="$opt_link $link_veget"
      endif
      if ($couple == true) then
@@ -960,5 +983,30 @@
    else
 #     set opt_link=" -float0 -size_t64 $optdbl -P static -L$MODIPSLDIR -lsxsechiba -lsxparameters -lsxstomate -lsxioipsl $NCDFLIB "
-     set opt_link=" -float0 -size_t64 $optdbl -P static -L$MODIPSLDIR -lsxioipsl $NCDFLIB "
+     set opt_link=" $opt_link -float0 -size_t64 $optdbl -P static -L$MODIPSLDIR -lsxioipsl $NCDFLIB "
+
+   endif
+   set mod_loc_dir="./"
+##################
+else if $X8BRODIE then
+##################
+   set f77=sxmpif90
+   set f90=sxmpif90
+   if $MODIPSL then
+     set opt_link="$opt_link -float0 -Wf,-A dbl4 -L$MODIPSLDIR -lblas"
+     if ($veget == true) then
+       set opt_link="$opt_link $link_veget"
+     endif
+     if ($couple == true) then
+	if ($psmile == true) then
+	set opt_link="$opt_link -lsxioipsl -float0 $optdbl -P static $NCDFLIB "
+	else
+	set opt_link="$opt_link -lsxioipsl -loasis2.4_mpi2 -float0 $optdbl -P static $NCDFLIB "
+	endif
+     else
+       set opt_link="$opt_link -lsxioipsl -float0 $optdbl -P static $NCDFLIB "
+     endif
+   else
+#     set opt_link=" -float0 $optdbl -P static -L$MODIPSLDIR -lsxsechiba -lsxparameters -lsxstomate -lsxioipsl $NCDFLIB "
+     set opt_link=" -float0 $optdbl -P static -L$MODIPSLDIR -lsxioipsl $NCDFLIB "
 
    endif
@@ -984,4 +1032,6 @@
 set make="gmake RANLIB=ls"
 else if $X6NEC then
+set make="gmake RANLIB=ls"
+else if $X8BRODIE then
 set make="gmake RANLIB=ls"
 else
@@ -1023,4 +1073,7 @@
  set optim90=" $optim90 -I$libo "
  set optimtru90=" $optimtru90 -I$libo "
+else if $X8BRODIE then
+ set optim90=" $optim90 -I$libo "
+ set optimtru90=" $optimtru90 -I$libo "
 else if $LINUX then
  if ( $FC_LINUX == "pgf90" ) then
@@ -1033,6 +1086,6 @@
  set optim="$optim90"
  set mod_loc_dir=$libo
- \cp /d3/fairhead/sechiba/ioipsl/*.mod $libo
- \cp $IOIPSLDIR/*.mod $libo
+# \cp /d3/fairhead/sechiba/ioipsl/*.mod $libo
+# \cp $IOIPSLDIR/*.mod $libo
 endif
 
@@ -1047,5 +1100,8 @@
 else if $X6NEC then
   set link="sxld $opt_link"
-  set link="$f90 "
+  set link="$f90 -Wl,-hlib_cyclic "
+else if $X8BRODIE then
+  set link="sxld $opt_link"
+  set link="$f90 -Wl,-hlib_cyclic "
 endif
 
@@ -1064,4 +1120,5 @@
 $phys \
 DIM=$dimc \
+FLAG_PARA="$FLAG_PARA"\
 L_ADJNT="$adjnt" \
 L_CHIMIE="$libchimie" \
@@ -1088,4 +1145,5 @@
 $phys \
 DIM=$dimc \
+FLAG_PARA="$FLAG_PARA"\
 L_ADJNT="$adjnt" \
 L_CHIMIE="$libchimie" \
