Hi,

All versions of bash grok
   for f in $VAR; do ...; done
where VAR is an empty shell variable. But
   for f in $(VAR); do ...; done
where $(VAR) is an empty Makefile variable, leads to a syntax error with
bash 2.00..2.05. The solution is ugly...


2006-10-21  Bruno Haible  <[EMAIL PROTECTED]>

        * gnulib-tool (func_emit_lib_Makefile_am, func_emit_tests_Makefile_am):
        Change mostlyclean-local rule to avoid sh syntax error from bash
        versions 2.00..2.05 when $(MOSTLYCLEANDIRS) is empty.

*** gnulib-tool 2006-10-21 00:24:28.000000000 +0200
--- gnulib-tool 2006-10-22 02:19:50.000000000 +0200
***************
*** 1214,1225 ****
    cat allsnippets.tmp
    echo
    echo "mostlyclean-local: mostlyclean-generic"
!   echo "      @test -z \"\$(MOSTLYCLEANDIRS)\" || \\"
!   echo "        for dir in \$(MOSTLYCLEANDIRS); do \\"
!   echo "          if test -d \$\$dir; then \\"
!   echo "            echo \"rmdir \$\$dir\"; rmdir \$\$dir; \\"
!   echo "          fi; \\"
!   echo "        done"
    rm -f allsnippets.tmp
  }
  
--- 1214,1224 ----
    cat allsnippets.tmp
    echo
    echo "mostlyclean-local: mostlyclean-generic"
!   echo "      @for dir in '' \$(MOSTLYCLEANDIRS); do \\"
!   echo "        if test -n \"\$\$dir\" && test -d \$\$dir; then \\"
!   echo "          echo \"rmdir \$\$dir\"; rmdir \$\$dir; \\"
!   echo "        fi; \\"
!   echo "      done"
    rm -f allsnippets.tmp
  }
  
***************
*** 1317,1328 ****
    echo "      rm -rf SunWS_cache"
    echo
    echo "mostlyclean-local: mostlyclean-generic"
!   echo "      @test -z \"\$(MOSTLYCLEANDIRS)\" || \\"
!   echo "        for dir in \$(MOSTLYCLEANDIRS); do \\"
!   echo "          if test -d \$\$dir; then \\"
!   echo "            echo \"rmdir \$\$dir\"; rmdir \$\$dir; \\"
!   echo "          fi; \\"
!   echo "        done"
    rm -f allsnippets.tmp
  }
  
--- 1316,1326 ----
    echo "      rm -rf SunWS_cache"
    echo
    echo "mostlyclean-local: mostlyclean-generic"
!   echo "      @for dir in '' \$(MOSTLYCLEANDIRS); do \\"
!   echo "        if test -n \"\$\$dir\" && test -d \$\$dir; then \\"
!   echo "          echo \"rmdir \$\$dir\"; rmdir \$\$dir; \\"
!   echo "        fi; \\"
!   echo "      done"
    rm -f allsnippets.tmp
  }
  


Reply via email to