/[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.116 by edhill, Thu Jan 6 15:32:16 2005 UTC revision 1.119 by edhill, Wed Mar 9 19:57:00 2005 UTC
# Line 122  EOF Line 122  EOF
122        stop        stop
123        end        end
124  EOF  EOF
125      test -f Makefile  &&  mv -f Makefile Makefile.bak      test -f $MAKEFILE  &&  mv -f $MAKEFILE $MAKEFILE".tst"
126      cat <<EOF >> Makefile      cat <<EOF >> $MAKEFILE
127  .SUFFIXES:  .SUFFIXES:
128  .SUFFIXES: .$tfs .F  .SUFFIXES: .$tfs .F
129  .F.$tfs:  .F.$tfs:
# Line 148  EOF Line 148  EOF
148              return              return
149          fi          fi
150      fi      fi
151      rm -f genmake_hello.* Makefile      rm -f genmake_hello.* $MAKEFILE
152      test -f Makefile  &&  mv -f Makefile.bak Makefile      test -f $MAKEFILE".tst"  &&  mv -f $MAKEFILE".tst" $MAKEFILE
153    
154      #  If we make it here, use the extensions      #  If we make it here, use the extensions
155      FS=$tfs      FS=$tfs
# Line 181  look_for_makedepend()  { Line 181  look_for_makedepend()  {
181      if test "x${MAKEDEPEND}" = x ; then      if test "x${MAKEDEPEND}" = x ; then
182          which makedepend > /dev/null 2>&1          which makedepend > /dev/null 2>&1
183          RV0=$?          RV0=$?
184            test -f $MAKEFILE  &&  mv -f $MAKEFILE $MAKEFILE".tst"
185            #  echo 'MAKEFILE="'$MAKEFILE'"'
186            cat <<EOF >> $MAKEFILE
187    #   THIS IS A TEST MAKEFILE GENERATED BY "genmake2"
188    #
189    #   Some "makedepend" implementations will die if they cannot
190    #   find a Makefile -- so this file is here to gives them an
191    #   empty one to find and parse.
192    EOF
193          cat <<EOF >> genmake_tc.f          cat <<EOF >> genmake_tc.f
194        program test        program test
195        write(*,*) 'test'        write(*,*) 'test'
# Line 188  look_for_makedepend()  { Line 197  look_for_makedepend()  {
197        end        end
198  EOF  EOF
199          makedepend genmake_tc.f > /dev/null 2>&1          makedepend genmake_tc.f > /dev/null 2>&1
200            test -f $MAKEFILE  &&  rm -f $MAKEFILE
201            test -f $MAKEFILE".tst"  &&  mv -f $MAKEFILE".tst" $MAKEFILE
202          RV1=$?          RV1=$?
203          if test "x${RV0}${RV1}" = x00 ; then          if test "x${RV0}${RV1}" = x00 ; then
204              MAKEDEPEND=makedepend              MAKEDEPEND=makedepend
# Line 581  WARNING: Please contact <MITgcm-support@ Line 592  WARNING: Please contact <MITgcm-support@
592  EOF  EOF
593          return 1          return 1
594      fi      fi
595      cat > genmake_tcomp.f <<EOF      cat > genmake_tcomp.$FS <<EOF
596        subroutine tcall( string )        subroutine tcall( string )
597        character*(*) string        character*(*) string
598        call tsub( string )        call tsub( string )
599        end        end
600  EOF  EOF
601      $FC $FFLAGS $DEFINES -c genmake_tcomp.f >> genmake_warnings 2>&1      $FC $FFLAGS $DEFINES -c genmake_tcomp.$FS >> genmake_warnings 2>&1
602      RETVAL=$?      RETVAL=$?
603      if test "x$RETVAL" != x0 ; then      if test "x$RETVAL" != x0 ; then
604          FC_NAMEMANGLE=$default_nm          FC_NAMEMANGLE=$default_nm
# Line 653  void FC_NAMEMANGLE(cloc) ( double *curti Line 664  void FC_NAMEMANGLE(cloc) ( double *curti
664   *curtim = *curtim/1.E6;   *curtim = *curtim/1.E6;
665  }  }
666  EOF  EOF
667      make genmake_tc_1.o >> genmake_tc.log 2>&1      make genmake_tc_1.o >> genmake_warnings 2>&1
668      RET_C=$?      RET_C=$?
669      cat <<EOF > genmake_tc_2.f      cat <<EOF > genmake_tc_2.$FS
670        program hello        program hello
671        Real*8 wtime        Real*8 wtime
672        external cloc        external cloc
# Line 663  EOF Line 674  EOF
674        print *," HELLO WORLD", wtime        print *," HELLO WORLD", wtime
675        end program hello        end program hello
676  EOF  EOF
677      $FC $FFLAGS -o genmake_tc genmake_tc_2.f genmake_tc_1.o >> genmake_tc.log 2>&1      $FC $FFLAGS -o genmake_tc genmake_tc_2.$FS genmake_tc_1.o >> genmake_warnings 2>&1
678      RET_F=$?      RET_F=$?
679      test -x ./genmake_tc  &&  ./genmake_tc >> genmake_tc.log 2>&1      test -x ./genmake_tc  &&  ./genmake_tc >> genmake_warnings 2>&1
680      RETVAL=$?      RETVAL=$?
681      if test "x$RETVAL" = x0 ; then      if test "x$RETVAL" = x0 ; then
682          HAVE_CLOC=t          HAVE_CLOC=t
# Line 698  void FC_NAMEMANGLE(tfsize) ( int *nbyte Line 709  void FC_NAMEMANGLE(tfsize) ( int *nbyte
709  EOF  EOF
710      make genmake_tc_1.o >> genmake_tc.log 2>&1      make genmake_tc_1.o >> genmake_tc.log 2>&1
711      RET_C=$?      RET_C=$?
712      cat <<EOF > genmake_tc_2.f      cat <<EOF > genmake_tc_2.$FS
713        program hello        program hello
714        integer nbyte        integer nbyte
715        call tfsize(nbyte)        call tfsize(nbyte)
716        print *," HELLO WORLD", nbyte        print *," HELLO WORLD", nbyte
717        end program hello        end program hello
718  EOF  EOF
719      $FC $FFLAGS -o genmake_tc genmake_tc_2.f genmake_tc_1.o >> genmake_tc.log 2>&1      $FC $FFLAGS -o genmake_tc genmake_tc_2.$FS genmake_tc_1.o >> genmake_tc.log 2>&1
720      RET_F=$?      RET_F=$?
721      test -x ./genmake_tc  &&  ./genmake_tc >> genmake_tc.log 2>&1      test -x ./genmake_tc  &&  ./genmake_tc >> genmake_tc.log 2>&1
722      RETVAL=$?      RETVAL=$?
# Line 722  check_netcdf_libs()  { Line 733  check_netcdf_libs()  {
733          return          return
734      fi      fi
735      echo "" > genmake_tnc.log      echo "" > genmake_tnc.log
736      cat <<EOF > genmake_tnc.for      cat <<EOF > genmake_tnc.F
737        program fgennc        program fgennc
738  #include "netcdf.inc"  #include "netcdf.inc"
739  EOF  EOF
740      if test ! "x$MPI" = x ; then      if test ! "x$MPI" = x ; then
741          echo '#include "mpif.h"' >> genmake_tnc.for          echo '#include "mpif.h"' >> genmake_tnc.F
742      fi      fi
743      cat <<EOF >> genmake_tnc.for      cat <<EOF >> genmake_tnc.F
744        integer iret, ncid, xid        integer iret, ncid, xid
745        iret = nf_create('genmake_tnc.nc', NF_CLOBBER, ncid)        iret = nf_create('genmake_tnc.nc', NF_CLOBBER, ncid)
746        IF (iret .NE. NF_NOERR) write(*,*) NF_STRERROR(iret)        IF (iret .NE. NF_NOERR) write(*,*) NF_STRERROR(iret)
# Line 740  EOF Line 751  EOF
751        end        end
752  EOF  EOF
753      echo "Executing:" > genmake_tnc.log      echo "Executing:" > genmake_tnc.log
754      echo "  $CPP $DEFINES $INCLUDES genmake_tnc.for > genmake_tnc.f" \      echo "  $CPP $DEFINES $INCLUDES genmake_tnc.F > genmake_tnc.$FS" \
755          > genmake_tnc.log          > genmake_tnc.log
756      RET_CPP=f      RET_CPP=f
757      $CPP $DEFINES $INCLUDES genmake_tnc.for > genmake_tnc.f 2>/dev/null  \      $CPP $DEFINES $INCLUDES genmake_tnc.F > genmake_tnc.$FS 2>/dev/null  \
758          &&  RET_CPP=t          &&  RET_CPP=t
759      if test "x$RET_CPP" = xf ; then      if test "x$RET_CPP" = xf ; then
760          echo "  WARNING: CPP failed to pre-process the netcdf test." \          echo "  WARNING: CPP failed to pre-process the netcdf test." \
# Line 752  EOF Line 763  EOF
763              > genmake_tnc.log              > genmake_tnc.log
764      fi      fi
765      echo "Executing:" > genmake_tnc.log      echo "Executing:" > genmake_tnc.log
766      echo "  $FC $FFLAGS $FOPTIM -c genmake_tnc.f" > genmake_tnc.log      echo "  $FC $FFLAGS $FOPTIM -c genmake_tnc.$FS" > genmake_tnc.log
767      echo "  $LINK -o genmake_tnc.o $LIBS" > genmake_tnc.log      echo "  $LINK -o genmake_tnc.o $LIBS" > genmake_tnc.log
768      $FC $FFLAGS $FOPTIM -c genmake_tnc.f >> genmake_tnc.log 2>&1  \      $FC $FFLAGS $FOPTIM -c genmake_tnc.$FS >> genmake_tnc.log 2>&1  \
769          &&  $LINK -o genmake_tnc genmake_tnc.o $LIBS >> genmake_tnc.log 2>&1          &&  $LINK -o genmake_tnc genmake_tnc.o $LIBS >> genmake_tnc.log 2>&1
770      RET_COMPILE=$?      RET_COMPILE=$?
771    
# Line 769  EOF Line 780  EOF
780          HAVE_NETCDF=t          HAVE_NETCDF=t
781      else      else
782          # try again with "-lnetcdf" added to the libs          # try again with "-lnetcdf" added to the libs
783          $CPP $DEFINES $INCLUDES genmake_tnc.for > genmake_tnc.f 2>/dev/null  \          $CPP $DEFINES $INCLUDES genmake_tnc.F > genmake_tnc.$FS 2>/dev/null  \
784              &&  $FC $FFLAGS $FOPTIM -c genmake_tnc.f >> genmake_tnc.log 2>&1  \              &&  $FC $FFLAGS $FOPTIM -c genmake_tnc.$FS >> genmake_tnc.log 2>&1  \
785              &&  $LINK -o genmake_tnc genmake_tnc.o $LIBS -lnetcdf >> genmake_tnc.log 2>&1              &&  $LINK -o genmake_tnc genmake_tnc.o $LIBS -lnetcdf >> genmake_tnc.log 2>&1
786          RET_COMPILE=$?          RET_COMPILE=$?
787          if test "x$RET_COMPILE" = x0 ; then          if test "x$RET_COMPILE" = x0 ; then
# Line 804  DEFINES= Line 815  DEFINES=
815  PACKAGES=  PACKAGES=
816  ENABLE=  ENABLE=
817  DISABLE=  DISABLE=
818  MAKEFILE=  # MAKEFILE=
819  #MAKEDEPEND=  # MAKEDEPEND=
820  PDEPEND=  PDEPEND=
821  DUMPSTATE=t  DUMPSTATE=t
822  PDEFAULT=  PDEFAULT=
# Line 1095  for ac_option in "$@" ; do Line 1106  for ac_option in "$@" ; do
1106            
1107  done  done
1108    
1109    
1110  if test -f ./.genmakerc ; then  if test -f ./.genmakerc ; then
1111      echo      echo
1112      echo "WARNING: genmake2 has detected a copy of the old-style \"./.genmakerc\""      echo "WARNING: genmake2 has detected a copy of the old-style \"./.genmakerc\""
# Line 1139  if test -f "${ROOTDIR}/doc/tag-index" ; Line 1151  if test -f "${ROOTDIR}/doc/tag-index" ;
1151      THISVER=`grep checkpoint ${ROOTDIR}/doc/tag-index | head -1`      THISVER=`grep checkpoint ${ROOTDIR}/doc/tag-index | head -1`
1152  fi  fi
1153    
1154    if test "x$MAKEFILE" = x ; then
1155        MAKEFILE="Makefile"
1156    fi
1157    
1158  echo "  getting OPTFILE information:  "  echo "  getting OPTFILE information:  "
1159  if test "x${OPTFILE}" = x ; then  if test "x${OPTFILE}" = x ; then
1160      if test "x$MITGCM_OF" = x ; then      if test "x$MITGCM_OF" = x ; then
# Line 1168  if test "x$OPTFILE" != xNONE ; then Line 1184  if test "x$OPTFILE" != xNONE ; then
1184      fi      fi
1185  fi  fi
1186    
 #  Check for broken systems that cannot correctly distinguish *.F and *.f files  
 # check_for_broken_Ff  
   
1187  echo "  getting AD_OPTFILE information:  "  echo "  getting AD_OPTFILE information:  "
1188  if test "x${AD_OPTFILE}" = x ; then  if test "x${AD_OPTFILE}" = x ; then
1189      if test "x$MITGCM_AD_OF" = x ; then      if test "x$MITGCM_AD_OF" = x ; then
# Line 1198  if test "x${AD_OPTFILE}" != xNONE ; then Line 1211  if test "x${AD_OPTFILE}" != xNONE ; then
1211      fi      fi
1212  fi  fi
1213    
1214    #====================================================================
1215    #  Set default values if not set by the optfile
1216    #
1217  #  Check that FC, CC, LINK, CPP, S64, LN, and MAKE are defined.  If not,  #  Check that FC, CC, LINK, CPP, S64, LN, and MAKE are defined.  If not,
1218  #  either set defaults or complain and abort!  #  either set defaults or complain and abort!
1219  if test ! "x$BASH" = x ; then  if test ! "x$BASH" = x ; then
# Line 1286  fi Line 1302  fi
1302    
1303  printf "\n===  Checking system libraries  ===\n"  printf "\n===  Checking system libraries  ===\n"
1304  printf "  Do we have the system() command using $FC...  "  printf "  Do we have the system() command using $FC...  "
1305  cat > genmake_tcomp.f <<EOF  cat > genmake_tcomp.$FS <<EOF
1306        program hello        program hello
1307        call system('echo hi')        call system('echo hi')
1308        end        end
1309  EOF  EOF
1310  $FC $FFLAGS $DEFINES -o genmake_tcomp genmake_tcomp.f > genmake_tcomp.log 2>&1  $FC $FFLAGS $DEFINES -o genmake_tcomp genmake_tcomp.$FS > genmake_tcomp.log 2>&1
1311  RETVAL=$?  RETVAL=$?
1312  if test "x$RETVAL" = x0 ; then  if test "x$RETVAL" = x0 ; then
1313      HAVE_SYSTEM=t      HAVE_SYSTEM=t
# Line 1304  fi Line 1320  fi
1320  rm -f genmake_tcomp*  rm -f genmake_tcomp*
1321    
1322  printf "  Do we have the fdate() command using $FC...  "  printf "  Do we have the fdate() command using $FC...  "
1323  cat > genmake_tcomp.f <<EOF  cat > genmake_tcomp.$FS <<EOF
1324        program hello        program hello
1325        CHARACTER(128) string        CHARACTER(128) string
1326        string = ' '        string = ' '
# Line 1312  cat > genmake_tcomp.f <<EOF Line 1328  cat > genmake_tcomp.f <<EOF
1328        print *, string        print *, string
1329        end        end
1330  EOF  EOF
1331  $FC $FFLAGS $DEFINES -o genmake_tcomp genmake_tcomp.f > genmake_tcomp.log 2>&1  $FC $FFLAGS $DEFINES -o genmake_tcomp genmake_tcomp.$FS > genmake_tcomp.log 2>&1
1332  RETVAL=$?  RETVAL=$?
1333  if test "x$RETVAL" = x0 ; then  if test "x$RETVAL" = x0 ; then
1334      HAVE_FDATE=t      HAVE_FDATE=t
# Line 1325  fi Line 1341  fi
1341  rm -f genmake_tcomp*  rm -f genmake_tcomp*
1342    
1343  printf "  Do we have the etime() command using $FC...  "  printf "  Do we have the etime() command using $FC...  "
1344  cat > genmake_tcomp.f <<EOF  cat > genmake_tcomp.$FS <<EOF
1345        program hello        program hello
1346        REAL*4 ACTUAL, TARRAY(2)        REAL*4 ACTUAL, TARRAY(2)
1347        EXTERNAL ETIME        EXTERNAL ETIME
# Line 1334  cat > genmake_tcomp.f <<EOF Line 1350  cat > genmake_tcomp.f <<EOF
1350        print *, tarray        print *, tarray
1351        end        end
1352  EOF  EOF
1353  $FC $FFLAGS $DEFINES -o genmake_tcomp genmake_tcomp.f > genmake_tcomp.log 2>&1  $FC $FFLAGS $DEFINES -o genmake_tcomp genmake_tcomp.$FS > genmake_tcomp.log 2>&1
1354  RETVAL=$?  RETVAL=$?
1355  if test "x$RETVAL" = x0 ; then  if test "x$RETVAL" = x0 ; then
1356      HAVE_ETIME=t      HAVE_ETIME=t
# Line 1388  for d in $MODS ; do Line 1404  for d in $MODS ; do
1404  done  done
1405  echo  echo
1406    
 if test "x$MAKEFILE" = x ; then  
     MAKEFILE="Makefile"  
 fi  
1407  if test "x${PLATFORM}" = x ; then  if test "x${PLATFORM}" = x ; then
1408      PLATFORM=$p_PLATFORM      PLATFORM=$p_PLATFORM
1409  fi  fi

Legend:
Removed from v.1.116  
changed lines
  Added in v.1.119

  ViewVC Help
Powered by ViewVC 1.1.22