我有一个Makefile,应该为我复制所有点文件到主目录中。不幸的是,GNUMake
它不支持bash中使用的通配符,并且通用通配符$(wildcard *.c)
仅限于特殊文件类型。
我的Makefile是:
SHELL := /bin/bash
profile:
@cp -r profile/ $(HOME)/
.PHONY: profile
到目前为止,我尝试过的其他变化:
cp -r profile/* $(HOME)
=> cp: cannot stat profile/*: No such file or directory
cp -r profile/$(wildcard *) $(HOME)
=>尝试复制当前目录中的所有文件cp -r $(wildcard profile/*) $(HOME)/
=> cp: missing destination file operand after /home/foobar
cp -r $(wildcard profile/*) $(HOME)/$(wildcard profile/*) =>
cp:/ home / foobar之后缺少目标文件操作数在makefile中使用直接shell命令尝试shell函数
profile:
$shell(cp -r profile/* $(HOME)/)
.PHONY: profile
否则像这样在开始时设置HOME变量
SHELL := /bin/bash
HOME := $(shell echo $HOME)
profile:
@cp -r profile/* $(HOME)/
.PHONY: profile
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句