how to prevent “directory already exists error” in a makefile when using mkdir

前端 未结 12 1677
遇见更好的自我
遇见更好的自我 2020-12-04 06:44

I need to generate a directory in my makefile and I would like to not get the \"directory already exists error\" over and over even though I can easily ignore it.

I

12条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-12-04 07:07

    If having the directory already exist is not a problem for you, you could just redirect stderr for that command, getting rid of the error message:

    -mkdir $(OBJDIR) 2>/dev/null
    

提交回复
热议问题