How to avoid “No such file or directory” Error for `make clean` Makefile target

后端 未结 5 2009
野的像风
野的像风 2021-01-04 00:28

I have a Makefile that defines a .PHONY clean target for cleaning up .o files and executables, that target looks like:

...
.PHONY : clean
clean:
    rm $(add         


        
5条回答
  •  孤城傲影
    2021-01-04 00:53

    Late to the party, but here's another solution that worked with our quirky build environment:

    if exist *.exe rm -f *.exe
    

    Not output free, but reduced and exits cleanly:

    # make clean
            if exist *.exe rm -f *.exe
    

    I tried a lot of alternatives that all had issues before settling on this one.

提交回复
热议问题