--- MITgcm/tools/genmake2 2003/11/24 15:08:24 1.45 +++ MITgcm/tools/genmake2 2003/11/25 17:22:47 1.49 @@ -1,6 +1,6 @@ -#!/bin/sh +#! /usr/bin/env bash # -# $Header: /home/ubuntu/mnt/e9_copy/MITgcm/tools/genmake2,v 1.45 2003/11/24 15:08:24 heimbach Exp $ +# $Header: /home/ubuntu/mnt/e9_copy/MITgcm/tools/genmake2,v 1.49 2003/11/25 17:22:47 edhill Exp $ # # Makefile generator for MITgcm UV codes # created by cnh 03/98 @@ -1147,18 +1147,6 @@ # Create a list of #define and #undef to enable/disable packages PACKAGES_DOT_H=PACKAGES_CONFIG.h -cat <$PACKAGES_DOT_H".tmp" -C=== GENMAKE v2 === -C The following defines have been set by GENMAKE, so please do not -C edit anything below these comments. In general, you should -C add or remove packages by re-running genmake with different -C "-enable" and/or "-disable" options. - -#ifndef PACKAGES_H -#define PACKAGES_H - -C Packages disabled by genmake: -EOF # The following UGLY HACK sets multiple "#undef"s and it needs to go # away. On 2003-08-12, CNH, JMC, and EH3 agreed that the CPP_OPTIONS.h # file would eventually be split up so that all package-related #define @@ -1177,50 +1165,27 @@ done if test "x$has_pack" = xf ; then undef=`echo "ALLOW_$n" | $AWK '{print toupper($0)}'` - echo "#undef $undef" >> $PACKAGES_DOT_H".tmp" DISABLED_PACKAGES="$DISABLED_PACKAGES -U$undef" fi fi done -cat <>$PACKAGES_DOT_H".tmp" - -C Packages enabled by genmake: -EOF ENABLED_PACKAGES= for i in $PACKAGES ; do def=`echo "ALLOW_$i" | $AWK '{print toupper($0)}'` - echo "#define $def" >> $PACKAGES_DOT_H".tmp" ENABLED_PACKAGES="$ENABLED_PACKAGES -D$def" #eh3 DEFINES="$DEFINES -D$def" #EH3 WARNING : This is an UGLY HACK that needs to be removed!!! case $i in aim_v23) - echo "#define ALLOW_AIM" >> $PACKAGES_DOT_H".tmp" DEFINES="$DEFINES -DALLOW_AIM" + ENABLED_PACKAGES="$ENABLED_PACKAGES -DALLOW_AIM" echo "Warning: ALLOW_AIM is set to enable aim_v23. This is REALLY ugly Jean-Michel :-)" ;; esac #EH3 WARNING : This is an UGLY HACK that needs to be removed!!! done -cat <>$PACKAGES_DOT_H".tmp" - -#endif /* PACKAGES_H */ -EOF - -if test ! -f $PACKAGES_DOT_H ; then - mv -f $PACKAGES_DOT_H".tmp" $PACKAGES_DOT_H -else - cmp $PACKAGES_DOT_H".tmp" $PACKAGES_DOT_H - RETVAL=$? - if test "x$RETVAL" = x0 ; then - rm -f $PACKAGES_DOT_H".tmp" - else - mv -f $PACKAGES_DOT_H $PACKAGES_DOT_H".bak" - mv -f $PACKAGES_DOT_H".tmp" $PACKAGES_DOT_H - fi -fi echo " Adding STANDARDDIRS" BUILDDIR=${BUILDDIR:-.} @@ -1521,10 +1486,10 @@ # Special targets ${PACKAGES_DOT_H}: @echo Creating \$@ ... - @\$(TOOLSDIR)/convert_cpp_cmd2defines "Warngin - this file is automatically generated - do NOT edit" "Enabled packages:" \$(ENABLED_PACKAGES) " " "Disabled packages:" \$(DISABLED_PACKAGES) > \$@ + @\$(TOOLSDIR)/convert_cpp_cmd2defines "Warning - this file is automatically generated - do NOT edit" -bPACKAGES_CONFIG_H "Disabled packages:" \$(DISABLED_PACKAGES) " " "Enabled packages:" \$(ENABLED_PACKAGES) > \$@ AD_CONFIG.h: @echo Creating \$@ ... - @\$(TOOLSDIR)/convert_cpp_cmd2defines "Warning - this file is automatically generated - do NOT edit" -UALLOW_ADJOINT_RUN -UALLOW_TANGENTLINEAR_RUN -UALLOW_ECCO_OPTIMIZATION > \$@ + @\$(TOOLSDIR)/convert_cpp_cmd2defines "Warning - this file is automatically generated - do NOT edit" -bAD_CONFIG_H -UALLOW_ADJOINT_RUN -UALLOW_TANGENTLINEAR_RUN -UALLOW_ECCO_OPTIMIZATION > \$@ # The normal chain of rules is ( .F - .f - .o ) .F.f: @@ -1584,7 +1549,7 @@ adtaf: ad_taf_output.f adtamc: ad_tamc_output.f -ad_input_code.f: links \$(AD_FILES) \$(HEADERFILES) +ad_input_code.f: \$(AD_FILES) \$(HEADERFILES) @\$(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 @@ -1616,7 +1581,7 @@ ftltaf: ftl_taf_output.f ftltamc: ftl_tamc_output.f -ftl_input_code.f: links \$(AD_FILES) \$(HEADERFILES) +ftl_input_code.f: \$(AD_FILES) \$(HEADERFILES) @\$(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 @@ -1689,44 +1654,23 @@ 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 < $PACKAGES_DOT_H".tmp" +if test ! -f $PACKAGES_DOT_H ; then + mv -f $PACKAGES_DOT_H".tmp" $PACKAGES_DOT_H +else + cmp $PACKAGES_DOT_H".tmp" $PACKAGES_DOT_H + RETVAL=$? + if test "x$RETVAL" = x0 ; then + rm -f $PACKAGES_DOT_H".tmp" + else + mv -f $PACKAGES_DOT_H $PACKAGES_DOT_H".bak" + mv -f $PACKAGES_DOT_H".tmp" $PACKAGES_DOT_H + fi +fi +if test ! -f AD_CONFIG.h ; then + $TOOLSDIR/convert_cpp_cmd2defines "Warning - this file is automatically generated - do NOT edit" -UALLOW_ADJOINT_RUN -UALLOW_TANGENTLINEAR_RUN -UALLOW_ECCO_OPTIMIZATION > AD_CONFIG.h +fi # Write the "state" for future records