--- MITgcm/tools/genmake2 2003/10/22 18:00:49 1.21 +++ MITgcm/tools/genmake2 2003/10/30 19:11:45 1.26 @@ -1,6 +1,6 @@ #!/bin/bash # -# $Header: /home/ubuntu/mnt/e9_copy/MITgcm/tools/genmake2,v 1.21 2003/10/22 18:00:49 edhill Exp $ +# $Header: /home/ubuntu/mnt/e9_copy/MITgcm/tools/genmake2,v 1.26 2003/10/30 19:11:45 heimbach Exp $ # # Makefile generator for MITgcm UV codes # created by cnh 03/98 @@ -72,7 +72,8 @@ tmp1=`uname`"_"`uname -m` tmp2=`echo $tmp1 | sed -e 'y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/'` - PLATFORM=`echo $tmp2 | sed -e 's/i[3-6]86/ia32/' | sed -e 's/athlon/ia32/'` + tmp3=`echo $tmp2 | sed -e 's/power macintosh/ppc/'` + PLATFORM=`echo $tmp3 | sed -e 's/i[3-6]86/ia32/' | sed -e 's/athlon/ia32/'` OFLIST=`(cd $ROOTDIR/tools/build_options; ls | grep "^$PLATFORM")` echo " The platform appears to be: $PLATFORM" # if test "x$OFLIST" = x ; then @@ -104,7 +105,7 @@ fi # look for possible fortran compilers - tmp="$MITGCM_FC $FC g77 f77 pgf77 pgf95 ifc f90 f95 mpif77 mpf77 mpxlf95" + tmp="$MITGCM_FC $FC efc g77 f77 pgf77 pgf95 ifc f90 f95 mpif77 mpf77 mpxlf95" p_FC= for c in $tmp ; do rm -f ./hello.f ./hello @@ -1041,8 +1042,8 @@ fi done -echo " Searching for CPP_OPTIONS.h in order to warn about the presence" -echo " of \"#define ALLOW_PKGNAME\"-type statements:" +echo " Searching for CPP_OPTIONS.h in order to warn about the presence" +echo " of \"#define ALLOW_PKGNAME\"-type statements:" CPP_OPTIONS= spaths=". $INCLUDEDIRS" for i in $spaths ; do @@ -1292,11 +1293,12 @@ @\$(EXECUTABLE) > \$@ clean: + -cat AD_CONFIG.template > AD_CONFIG.h -rm -rf *.o *.f *.p *.f90 *.mod ${RMFILES} work.{pc,pcl} Clean: @make clean @make cleanlinks - -rm -f Makefile.bak genmake_state genmake_optfile make.log + -rm -f Makefile.bak genmake_state genmake_*optfile make.log CLEAN: @make Clean -find \$(EXEDIR) -name "*.meta" -exec rm {} \; @@ -1363,15 +1365,17 @@ cat >>$MAKEFILE < AD_CONFIG.h + @make \$(F77FILES) @make \$(AD_FLOW_FILES) cat \$(AD_FLOW_FILES) \$(AD_FILES) > ad_input_code.f -# ... AD ... -ad: ad_taf -ad_taf_f: ad_taf_output.f -ad_tamc_f: ad_tamc_output.f - ad_taf_output.f: ad_input_code.f \$(TAF) \$(AD_TAF_FLAGS) \$(TAF_EXTRA) ad_input_code.f cat ad_input_code_ad.f | sed -f adjoint_sed > ad_taf_output.f @@ -1388,20 +1392,26 @@ # ... FTL ... -ftl: ftl_taf -ftl_taf_f: ftl_taf_output.f -ftl_tamc_f: ftl_tamc_output.f - -ftl_taf_output.f: ad_input_code.f - \$(TAF) \$(FTL_TAF_FLAGS) \$(TAF_EXTRA) ad_input_code.f - cat ad_input_code_ftl.f | sed -f adjoint_sed > ftl_taf_output.f +ftlall: ftl_taf +ftltaf: ftl_taf_output.f +ftltamc: ftl_tamc_output.f + +ftl_input_code.f: \$(AD_FILES) \$(HEADERFILES) + cmp ftl_config.template AD_CONFIG.h || cat ftl_config.template > AD_CONFIG.h + @make \$(F77FILES) + @make \$(AD_FLOW_FILES) + cat \$(AD_FLOW_FILES) \$(AD_FILES) > ftl_input_code.f + +ftl_taf_output.f: ftl_input_code.f + \$(TAF) \$(FTL_TAF_FLAGS) \$(TAF_EXTRA) ftl_input_code.f + cat ftl_input_code_ftl.f | sed -f adjoint_sed > ftl_taf_output.f ftl_taf: ftl_taf_output.o \$(OBJFILES) \$(LINK) -o ${EXE_FTL} \$(FFLAGS) \$(FOPTIM) \$(OBJFILES) ftl_taf_output.o \$(LIBS) -ftl_tamc_output.f: ad_input_code.f - \$(TAMC) \$(FTL_TAMC_FLAGS) \$(TAMC_EXTRA) ad_input_code.f - cat ad_input_code_ftl.f | sed -f adjoint_sed > ftl_tamc_output.f +ftl_tamc_output.f: ftl_input_code.f + \$(TAMC) \$(FTL_TAMC_FLAGS) \$(TAMC_EXTRA) ftl_input_code.f + cat ftl_input_code_ftl.f | sed -f adjoint_sed > ftl_tamc_output.f ftl_tamc: ftl_tamc_output.o \$(OBJFILES) \$(LINK) -o ${EXE_FTL} \$(FFLAGS) \$(FOPTIM) \$(OBJFILES) ftl_tamc_output.o \$(LIBS) @@ -1411,9 +1421,15 @@ svd: svd_taf svd_taf_f: svd_taf_output.f -svd_taf_output.f: ad_input_code.f - \$(TAF) \$(SVD_TAF_FLAGS) \$(TAF_EXTRA) ad_input_code.f - cat ad_input_code_ad.f | sed -f adjoint_sed > svd_taf_output.f +svd_input_code.f: \$(SRCFILES) + cmp svd_config.template AD_CONFIG.h || cat svd_config.template > AD_CONFIG.h + @make \$(F77FILES) + @make \$(AD_FLOW_FILES) + cat \$(AD_FLOW_FILES) \$(AD_FILES) > svd_input_code.f + +svd_taf_output.f: svd_input_code.f + \$(TAF) \$(SVD_TAF_FLAGS) \$(TAF_EXTRA) svd_input_code.f + cat svd_input_code_ad.f | sed -f adjoint_sed > svd_taf_output.f svd_taf: svd_taf_output.o \$(OBJFILES) \$(LINK) -o ${EXE_SVD} \$(FFLAGS) \$(FOPTIM) \$(OBJFILES) svd_taf_output.o \$(LIBS) @@ -1457,6 +1473,45 @@ printf "\n=== Done ===\n" +# Write the "template" files for the adjoint builds +cat >AD_CONFIG.template <ad_config.template <ftl_config.template <svd_config.template <