Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the difference between "mv" and "-mv" shell commands in a makefile?

Tags:

bash

makefile

I have stumbled upon a person changing mv command to -mv within a makefile target. What is the difference?

%/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 $(@)       
like image 348
Dima Avatar asked Jan 21 '23 02:01

Dima


1 Answers

Add a "-" before any command in a Makefile tells make to not quit if the command returns a non-zero status. Basically it's a "I don't care if it fails".

like image 99
JOTN Avatar answered May 20 '23 12:05

JOTN