“mv” 和 “mv” 和有什么不一样?和“-mv” makefile 中的 shell 命令?
我偶然发现有人在 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 $(@)
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 $(@)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在 Makefile 中的任何命令之前添加一个“-”,告诉 make 如果命令返回非零状态则不退出。基本上这是一个“我不在乎它是否失败”。
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".