/[MITgcm]/MITgcm/tools/genmake2
ViewVC logotype

Diff of /MITgcm/tools/genmake2

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

revision 1.160 by ce107, Wed Jan 31 21:28:10 2007 UTC revision 1.170 by jahn, Thu May 8 19:48:37 2008 UTC
# Line 746  void FC_NAMEMANGLE(cloc) ( double *curti Line 746  void FC_NAMEMANGLE(cloc) ( double *curti
746   *curtim = *curtim/1.E6;   *curtim = *curtim/1.E6;
747  }  }
748  EOF  EOF
749      make genmake_tc_1.o >> genmake_warnings 2>&1      COMM="$CC $CFLAGS -c genmake_tc_1.c"
750        echo $COMM >> genmake_warnings
751        $COMM >> genmake_warnings 2>&1
752      RET_C=$?      RET_C=$?
753      cat <<EOF > genmake_tc_2.$FS      cat <<EOF > genmake_tc_2.$FS
754        program hello        program hello
# Line 756  EOF Line 758  EOF
758        print *," HELLO WORLD", wtime        print *," HELLO WORLD", wtime
759        end        end
760  EOF  EOF
761      $FC $FFLAGS -o genmake_tc genmake_tc_2.$FS genmake_tc_1.o >> genmake_warnings 2>&1      COMM="$FC $FFLAGS -o genmake_tc genmake_tc_2.$FS genmake_tc_1.o"
762        echo $COMM >> genmake_warnings
763        $COMM >> genmake_warnings 2>&1
764      RET_F=$?      RET_F=$?
765      test -x ./genmake_tc  &&  ./genmake_tc >> genmake_warnings 2>&1      test -x ./genmake_tc  &&  ./genmake_tc >> genmake_warnings 2>&1
766      RETVAL=$?      RETVAL=$?
# Line 803  void FC_NAMEMANGLE(sigreg) (int * aip) Line 807  void FC_NAMEMANGLE(sigreg) (int * aip)
807      return;      return;
808  }  }
809  EOF  EOF
810      make genmake_tc_1.o >> genmake_warnings 2>&1      COMM="$CC $CFLAGS -c genmake_tc_1.c"
811        echo $COMM >> genmake_warnings
812        $COMM >> genmake_warnings 2>&1
813      RET_C=$?      RET_C=$?
814      cat <<EOF > genmake_tc_2.$FS      cat <<EOF > genmake_tc_2.$FS
815        program hello        program hello
# Line 851  void FC_NAMEMANGLE(setrlstk) () Line 857  void FC_NAMEMANGLE(setrlstk) ()
857      return;      return;
858  }  }
859  EOF  EOF
860      make genmake_tc_1.o >> genmake_warnings 2>&1      COMM="$CC $CFLAGS -c genmake_tc_1.c"
861        echo $COMM >> genmake_warnings
862        $COMM >> genmake_warnings 2>&1
863      RET_C=$?      RET_C=$?
864      cat <<EOF > genmake_tc_2.$FS      cat <<EOF > genmake_tc_2.$FS
865        program hello        program hello
# Line 895  void FC_NAMEMANGLE(tfsize) ( int *nbyte Line 903  void FC_NAMEMANGLE(tfsize) ( int *nbyte
903          *nbyte = -1;          *nbyte = -1;
904  }  }
905  EOF  EOF
906      make genmake_tc_1.o >> genmake_tc.log 2>&1      COMM="$CC $CFLAGS -c genmake_tc_1.c"
907        echo $COMM >> genmake_warnings
908        $COMM >> genmake_tc.log 2>&1
909      RET_C=$?      RET_C=$?
910      cat <<EOF > genmake_tc_2.$FS      cat <<EOF > genmake_tc_2.$FS
911        program hello        program hello
# Line 1035  OPTFILE= Line 1045  OPTFILE=
1045  INCLUDES="-I. $INCLUDES"  INCLUDES="-I. $INCLUDES"
1046  FFLAGS=  FFLAGS=
1047  FOPTIM=  FOPTIM=
1048    FEXTRAFLAGS=
1049  CFLAGS=  CFLAGS=
1050  KFLAGS1=  KFLAGS1=
1051  KFLAGS2=  KFLAGS2=
# Line 1115  gm_s1="OPTFILE PDEPEND PDEFAULT MAKEFILE Line 1126  gm_s1="OPTFILE PDEPEND PDEFAULT MAKEFILE
1126  gm_s2="FC CPP IEEE TS PAPIS PCLS PAPI PCL HPMT GSL DEVEL MPI JAM DUMPSTATE STANDARDDIRS"  gm_s2="FC CPP IEEE TS PAPIS PCLS PAPI PCL HPMT GSL DEVEL MPI JAM DUMPSTATE STANDARDDIRS"
1127    
1128  #  The following state is not directly set by command-line switches  #  The following state is not directly set by command-line switches
1129  gm_s3="LN S64 KPP LINK PACKAGES MAKEDEPEND PDEPEND PDEFAULT INCLUDES FFLAGS FOPTIM "  gm_s3="LN S64 KPP LINK PACKAGES MAKEDEPEND PDEPEND PDEFAULT INCLUDES FFLAGS FOPTIM FEXTRAFLAGS"
1130  gm_s4="CFLAGS KFLAGS1 KFLAGS2 LIBS KPPFILES NOOPTFILES NOOPTFLAGS"  gm_s4="CFLAGS KFLAGS1 KFLAGS2 LIBS KPPFILES NOOPTFILES NOOPTFLAGS"
1131  gm_s5="TOOLSDIR SOURCEDIRS INCLUDEDIRS PWD MAKE THISHOST THISUSER THISDATE THISVER MACHINE"  gm_s5="TOOLSDIR SOURCEDIRS INCLUDEDIRS PWD MAKE THISHOST THISUSER THISDATE THISVER MACHINE"
1132  gm_s6="EXECUTABLE EXEHOOK EXEDIR PACKAGES_CONF"  gm_s6="EXECUTABLE EXEHOOK EXEDIR PACKAGES_CONF"
# Line 1142  EOF Line 1153  EOF
1153    
1154  echo "===  Processing options files and arguments  ==="  echo "===  Processing options files and arguments  ==="
1155  gm_local="genmake_local"  gm_local="genmake_local"
 for i in . $MODS ; do  
     if test -r $i/$gm_local ; then  
         . $i/$gm_local  
         break  
     fi  
 done  
1156  printf "  getting local config information:  "  printf "  getting local config information:  "
1157  if test -f $gm_local ; then  if test -f $gm_local ; then
1158      echo "using $gm_local"      echo "using $gm_local"
# Line 1361  done Line 1366  done
1366  if test -f ./.genmakerc ; then  if test -f ./.genmakerc ; then
1367      echo      echo
1368      echo "WARNING: genmake2 has detected a copy of the old-style \"./.genmakerc\""      echo "WARNING: genmake2 has detected a copy of the old-style \"./.genmakerc\""
1369      echo "  file.  This file format is no longer supported.  Please see:"      echo "  file.  This file format is no longer supported.  For directions on"
1370      echo      echo "  how to setup and use the new \"genmake2\" script, please see:"
1371      echo "    http://mitgcm.org/devel_HOWTO/"      echo "    http://mitgcm.org/devel_HOWTO/"
1372      echo      echo "  and send an email to MITgcm-support@mitgcm.org if you need help."
1373      echo "  for directions on how to setup and use the new \"genmake2\" input"      echo "WARNING: ignore \"./.genmakerc\" and continue."
     echo "  files and send an email to MITgcm-support@mitgcm.org if you want help."  
1374      echo      echo
1375  fi  fi
1376    
# Line 1563  if test ! "x$TS" = x ; then Line 1567  if test ! "x$TS" = x ; then
1567        else        else
1568              DEFINES="$DEFINES -DTIME_PER_TIMESTEP"              DEFINES="$DEFINES -DTIME_PER_TIMESTEP"
1569        fi        fi
1570          PACKAGES="$PACKAGES showflops"
1571  fi  fi
1572  if test ! "x$PAPIS" = x ; then  if test ! "x$PAPIS" = x ; then
1573        echo "  Turning on PAPI flop summary per timestep"        echo "  Turning on PAPI flop summary per timestep"
# Line 1574  if test ! "x$PAPIS" = x ; then Line 1579  if test ! "x$PAPIS" = x ; then
1579        fi        fi
1580        INCLUDES="$INCLUDES $PAPIINC"        INCLUDES="$INCLUDES $PAPIINC"
1581        LIBS="$LIBS $PAPILIB"        LIBS="$LIBS $PAPILIB"
1582          PACKAGES="$PACKAGES showflops"
1583  fi  fi
1584  if test ! "x$PCLS" = x ; then  if test ! "x$PCLS" = x ; then
1585        echo "  Turning on PCL counter summary per timestep"        echo "  Turning on PCL counter summary per timestep"
# Line 1585  if test ! "x$PCLS" = x ; then Line 1591  if test ! "x$PCLS" = x ; then
1591        fi        fi
1592        INCLUDES="$INCLUDES $PCLINC"        INCLUDES="$INCLUDES $PCLINC"
1593        LIBS="$LIBS $PCLLIB"        LIBS="$LIBS $PCLLIB"
1594          PACKAGES="$PACKAGES showflops"
1595  fi  fi
1596  if test ! "x$PAPI" = x ; then  if test ! "x$PAPI" = x ; then
1597        if test ! "x$PAPIS" = x ; then        if test ! "x$PAPIS" = x ; then
# Line 1964  done Line 1971  done
1971  rm -f ./.tmp_pack  rm -f ./.tmp_pack
1972  echo "    packages are:  $PACKAGES"  echo "    packages are:  $PACKAGES"
1973    
1974  #  Check availability of NetCDF and then either build the MNC template  #  Check for package MNC: if NetCDF is available, then build the MNC
1975  #  files or delete mnc from the list of available packages.  #  template files ; otherwise, delete mnc from the list of packages.
1976  echo $PACKAGES | grep ' mnc ' > /dev/null 2>&1  echo $PACKAGES | grep ' mnc ' > /dev/null 2>&1
1977  RETVAL=$?  RETVAL=$?
1978  if test "x$RETVAL" = x0 ; then  if test "x$RETVAL" = x0 ; then
# Line 1999  EOF Line 2006  EOF
2006      fi      fi
2007  fi  fi
2008    
2009    #  Check for package PROFILES: if NetCDF is not available,
2010    #  then delete profiles from the list of available packages.
2011    echo $PACKAGES | grep ' profiles ' > /dev/null 2>&1
2012    RETVAL=$?
2013    if test "x$RETVAL" = x0 ; then
2014        if test "x$HAVE_NETCDF" != xt ; then
2015            cat <<EOF
2016    
2017    *********************************************************************
2018    WARNING: the "profiles" package was enabled but tests failed to
2019      compile NetCDF applications.  Please check that:
2020    
2021      1) NetCDF is correctly installed for this compiler and
2022      2) the LIBS variable (within the "optfile") specifies the correct
2023           NetCDF library to link against.
2024    
2025      Due to this failure, the "profiles" package is now DISABLED.
2026    *********************************************************************
2027    
2028    EOF
2029            PACKAGES=`echo $PACKAGES | sed -e 's/profiles//g'`
2030            DISABLE="$DISABLE profiles"
2031        fi
2032    fi
2033    
2034  echo "  applying package dependency rules"  echo "  applying package dependency rules"
2035  ck=  ck=
2036  while test "x$ck" != xtt ; do  while test "x$ck" != xtt ; do
2037      i=0      i=0
2038      # rtot=${#PNAME[@]}      # rtot=${#PNAME[@]}
2039      rtot=$nname      rtot=$nname
2040      while test $i -lt $rtot ; do      while test $i -le $rtot ; do
2041    
2042          #  Is $pname in the current $PACKAGES list?          #  Is $pname in the current $PACKAGES list?
2043          #  pname=${PNAME[$i]}          #  pname=${PNAME[$i]}
# Line 2039  while test "x$ck" != xtt ; do Line 2071  while test "x$ck" != xtt ; do
2071    
2072          #  Do we need to add $dname according to the dependency rules?          #  Do we need to add $dname according to the dependency rules?
2073          if test "x$pin" = xt -a "x$plus" = "x+" -a "x$din" = xf ; then          if test "x$pin" = xt -a "x$plus" = "x+" -a "x$din" = xf ; then
2074                #echo "   " $pname ": need to add :" $dname
2075              in_dis="f"              in_dis="f"
2076              for dis in $DISABLE ; do              for dis in $DISABLE ; do
2077                  if test "x$dis" = "x$dname" ; then                  if test "x$dis" = "x$dname" ; then
# Line 2328  for d in $alldirs ; do Line 2361  for d in $alldirs ; do
2361          echo "" >> srclinks.tmp          echo "" >> srclinks.tmp
2362          echo "#  These files are linked from $d" >> srclinks.tmp          echo "#  These files are linked from $d" >> srclinks.tmp
2363          echo "$deplist :" >> srclinks.tmp          echo "$deplist :" >> srclinks.tmp
2364          printf "\t\$(LN) %s/\$@ \$@\n" $d >> srclinks.tmp  # We need to make sure that the link isn't already there.
2365    # This may happen when make thinks that a header file has to be "remade"
2366    # because a module it depends on has changed.  In this case we do nothing.
2367            printf "\tif [ ! -L \$@ ]; then \$(LN) %s/\$@ \$@; fi\n" $d >> srclinks.tmp
2368      fi      fi
2369  done  done
2370  rm -rf .links.tmp  rm -rf .links.tmp
# Line 2431  INCLUDES = ${INCLUDES} Line 2467  INCLUDES = ${INCLUDES}
2467  KFLAGS1 = ${KFLAGS1}  KFLAGS1 = ${KFLAGS1}
2468  KFLAGS2 = ${KFLAGS2}  KFLAGS2 = ${KFLAGS2}
2469  # Optim./debug for FC  # Optim./debug for FC
2470  FFLAGS = ${FFLAGS}  FFLAGS = ${FFLAGS} ${FEXTRAFLAGS}
2471  FOPTIM = ${FOPTIM}  FOPTIM = ${FOPTIM}
2472  # Optim./debug for FC  # Optim./debug for FC
2473  F90FLAGS = ${F90FLAGS}  F90FLAGS = ${F90FLAGS}
# Line 2498  Clean: Line 2534  Clean:
2534          @make cleanlinks          @make cleanlinks
2535          -rm -f \$(SPECIAL_FILES)          -rm -f \$(SPECIAL_FILES)
2536          -rm -f genmake_state genmake_*optfile genmake_warnings make.log run.log *.bak          -rm -f genmake_state genmake_*optfile genmake_warnings make.log run.log *.bak
2537            -rm -f taf_command taf_output taf_ad.log taf_ad_flow.log
2538  CLEAN:  CLEAN:
2539          @make Clean          @make Clean
2540          -find \$(EXEDIR) -name "*.meta" -exec rm {} \;          -find \$(EXEDIR) -name "*.meta" -exec rm {} \;
2541          -find \$(EXEDIR) -name "*.data" -exec rm {} \;          -find \$(EXEDIR) -name "*.data" -exec rm {} \;
2542          -find \$(EXEDIR) -name "fort.*" -exec rm {} \;          -find \$(EXEDIR) -name "fort.*" -exec rm {} \;
2543          -rm -f \$(EXECUTABLE) \$(EXE_AD) *.txt STD* *diagnostics.log datetime          -rm -f \$(EXECUTABLE) \$(EXE_AD) *.txt STD* *diagnostics.log datetime
2544            -rm -f *_MIT_CE_000.opt0000 costfunction*0000
2545          -rm -rf mnc_test_*          -rm -rf mnc_test_*
2546    
2547  #eh3 Makefile: makefile  #eh3 Makefile: makefile
# Line 2562  cat >>$MAKEFILE <<EOF Line 2600  cat >>$MAKEFILE <<EOF
2600          \$(CPP) \$(DEFINES) \$(INCLUDES) > \$@          \$(CPP) \$(DEFINES) \$(INCLUDES) > \$@
2601  .$FS.o:  .$FS.o:
2602          \$(FC) \$(FFLAGS) \$(FOPTIM) -c \$<          \$(FC) \$(FFLAGS) \$(FOPTIM) -c \$<
2603    .F.o:
2604            \$(FC) \$(FFLAGS) \$(FOPTIM) -c \$<
2605  .F90.o:    .F90.o:  
2606          \$(F90C) \$(F90FLAGS) \$(F90OPTIM) -c \$<          \$(F90C) \$(F90FLAGS) \$(F90OPTIM) -c \$<
2607  .c.o:  .c.o:

Legend:
Removed from v.1.160  
changed lines
  Added in v.1.170

  ViewVC Help
Powered by ViewVC 1.1.22