--- MITgcm/tools/genmake2 2011/08/03 18:14:08 1.222 +++ MITgcm/tools/genmake2 2012/01/17 22:55:39 1.228 @@ -1,6 +1,6 @@ #! /usr/bin/env bash # -# $Header: /home/ubuntu/mnt/e9_copy/MITgcm/tools/genmake2,v 1.222 2011/08/03 18:14:08 jmc Exp $ +# $Header: /home/ubuntu/mnt/e9_copy/MITgcm/tools/genmake2,v 1.228 2012/01/17 22:55:39 jmc Exp $ # $Name: $ # # Makefile generator for MITgcm UV codes @@ -297,7 +297,7 @@ .F.$tfs: $LN \$< \$@ EOF - $MAKE "genmake_hello."$tfs > /dev/null 2>&1 + $MAKE -f $MAKEFILE "genmake_hello."$tfs > /dev/null 2>&1 RETVAL=$? if test "x$RETVAL" != x0 -o ! -f "genmake_hello."$tfs ; then if test "x$FS" = x ; then @@ -1522,8 +1522,16 @@ fi if test "x$GET_FC_VERSION" != x ; then echo "Get compiler version using: $FC $GET_FC_VERSION" >> $LOGFILE - $FC $GET_FC_VERSION >> $LOGFILE 2>&1 + ff=`echo $FC | sed 's/ .*//'` ; xx=`echo $ff | sed 's/^./& /' | sed 's/ .*//'` + if test $xx != '/' ; then which $ff >> $LOGFILE ; fi + $FC $GET_FC_VERSION > genmake_fc_vers1 2> genmake_fc_vers2 + if test -s genmake_fc_vers1 ; then + cat genmake_fc_vers1 >> $LOGFILE + else + cat genmake_fc_vers2 >> $LOGFILE + fi echo "<-- compiler version ----" >> $LOGFILE + rm -f genmake_fc_vers1 genmake_fc_vers2 fi if test "x$CC" = x ; then @@ -2650,7 +2658,7 @@ NOOPTFLAGS = ${NOOPTFLAGS} # Flags and libraries needed for linking LIBS = ${LIBS} -# Name of the Mekfile +# Name of the makefile MAKEFILE=${MAKEFILE} EOF @@ -2688,7 +2696,7 @@ \$(LINK) -o \$@ \$(FFLAGS) \$(FOPTIM) \$(OBJFILES) \$(LIBS) depend: - @make links + @make -f \$(MAKEFILE) links \$(MAKEDEPEND) -o .$FS \$(DEFINES) \$(INCLUDES) \$(F77_SRC_FILES) \$(TOOLSDIR)/f90mkdepend >> \$(MAKEFILE) -rm -f makedepend.out @@ -2718,8 +2726,8 @@ # remove most of the files that "make" and "make depend" generate Clean: - @make clean - @make cleanlinks + @make -f \$(MAKEFILE) clean + @make -f \$(MAKEFILE) cleanlinks -rm -f \$(SPECIAL_FILES) f90mkdepend.log $MAKEFILE.old -rm -f taf_command taf_output taf_ad.log taf_ad_flow.log -rm -f genmake_warnings genmake_errors make.log @@ -2727,7 +2735,7 @@ # remove also the executable, files that "genmake2" generates (except Makefile) # and output from a run (plus log files from testreport) CLEAN: - @make Clean + @make -f \$(MAKEFILE) Clean -rm -f \$(EXECUTABLE) \$(EXE_AD) *.bak -rm -f $LOGFILE genmake_state genmake_*optfile -rm -f SIZE.h.mpi genmake.tr_log make.tr_log @@ -2866,8 +2874,8 @@ @$BASH\$(TOOLSDIR)/convert_cpp_cmd2defines "Warning - this file is automatically generated - do NOT edit" -DALLOW_ADJOINT_RUN -UALLOW_TANGENTLINEAR_RUN -UALLOW_ECCO_OPTIMIZATION > ad_config.template cmp ad_config.template AD_CONFIG.h || cat ad_config.template > AD_CONFIG.h -rm -f ad_config.template - @make \$(F77_PP_SRC_FILES) - @make \$(FLOFILES) + @make -f \$(MAKEFILE) \$(F77_PP_SRC_FILES) + @make -f \$(MAKEFILE) \$(FLOFILES) cat \$(FLOFILES) \$(AD_FILES) | sed -f \$(TOOLSDIR)/remove_comments_sed > ad_input_code.$FS ad_taf_output.$FS: ad_input_code.$FS @@ -2896,6 +2904,8 @@ adtrick: patch < \$(TOOLSDIR)/ad_taf_output.f.adtrick.diff +adobj: ad_taf_output.o \$(OBJFILES) + # ... FTL ... ftlall: ftl_taf ftltaf: ftl_taf_output.$FS @@ -2905,8 +2915,8 @@ @$BASH\$(TOOLSDIR)/convert_cpp_cmd2defines "Warning - this file is automatically generated - do NOT edit" -UALLOW_ADJOINT_RUN -DALLOW_TANGENTLINEAR_RUN -UALLOW_ECCO_OPTIMIZATION > ftl_config.template cmp ftl_config.template AD_CONFIG.h || cat ftl_config.template > AD_CONFIG.h -rm -f ftl_config.template - @make \$(F77_PP_SRC_FILES) - @make \$(AD_FLOW_FILES) + @make -f \$(MAKEFILE) \$(F77_PP_SRC_FILES) + @make -f \$(MAKEFILE) \$(AD_FLOW_FILES) cat \$(AD_FLOW_FILES) \$(AD_FILES) > ftl_input_code.$FS ftl_taf_output.$FS: ftl_input_code.$FS @@ -3165,7 +3175,7 @@ # this step also creates the file postProcess.make but we cannot # name it as the target or else make will try to remake it for # the include directive above for any rule, e.g. make clean - ./postProcess.py --progress --timing --outputFormat=fixed -m r -i ../OAD_support/ad_inline.f --width 4 \$< + ./postProcess.py --progress --timing --infoUnitFile w2f__types.f90 --outputFormat=fixed -m r -i ../OAD_support/ad_inline.f --width 4 \$< # setup some links %.xsd: