make.exe with rm -f *.pattern gives error

  • Adam Gibson

    Adam Gibson - 2004-10-19

    If you have a makefile with a clean target that has a rm -f  with a globbing pattern that does not match any files, make bails out with an error.

              rm -f *.obj

    rm -f *.obj
    C:\DOCUME~1\myusername\LOCALS~1\Temp\ no matches found: *.obj [1]

    After reading around is sounds like zsh is giving the error before rm ever does anything with it.  The '-f' flag to rm should ignore non existent files.  I have tried exporting NULL_GLOB in the makefile to tell zsh to remove patterns if they do not match, but that does not seem to change anything.

    Has anyone figured out how to let rm -f work with UnixUtils's make/zsh ?

    • os_fan

      os_fan - 2005-03-12

      zsh morphs its behavior depending on its name.  For the behavior you seek, you need to rename zsh or copy it to "sh.exe".  You may still see this problem if sh forks a sub-shell.  There is a bug in the Windows port of zsh wherein it incorretly identifies its name when appended with .EXE, which is what happens when it is invoked as a sub-shell.  I am working on a set of fixes for zsh and this is one of them.

    • Sam Walker

      Sam Walker - 2006-11-08

      Surrounding the epression in quotes seems to make it work.

      rm -f "*.obj"


Log in to post a comment.