makefile中“mv”和“-mv”shell命令有什么区别?

时间:2010-11-14 21:38:28

标签: bash makefile

我偶然发现一个人在makefile目标中将mv命令更改为-mv。有什么区别?

%/install-stamp:                                                                                                           
        dh_testdir                                                                                                         
        dh_testroot                                                                                                        
        dh_prep -p$(subst _,-,$(a))-toolchain                                                                                       
        cp -rl $(r) debian/$(subst _,-,$(a))-toolchain                                                                     
        -mv debian/$(subst _,-,$(a))-toolchain/usr/bin/libgcc_s_sjlj-1.dll debian/$(subst _,-,$(a))-toolchain/usr/$(subst \
_,-,$(a))/bin                                                                                                              
        -mv debian/$(subst _,-,$(a))-toolchain/usr/lib/libiberty.a debian/$(subst _,-,$(a))-toolchain/usr/$(subst _,-,$(a)\
)/lib                                                                                                                      
        rm -f debian/$(subst _,-,$(a))-toolchain/usr/share/man/man1/dllwrap*                                               
        rm -f debian/$(subst _,-,$(a))-toolchain/usr/share/man/man7/fsf-funding*                                           
        rm -f debian/$(subst _,-,$(a))-toolchain/usr/share/man/man7/gfdl*                                                  
        rm -f debian/$(subst _,-,$(a))-toolchain/usr/share/man/man7/gpl*                                                   
        touch $(@)       

1 个答案:

答案 0 :(得分:8)

在Makefile中的任何命令之前添加“ - ”,如果命令返回非零状态,则告诉make不退出。基本上它是“我不在乎它是否失败”。