相关疑难解决方法(0)

转义Makefile中文件名中的冒号

有没有办法让GNU make与包含冒号的文件名一起正常工作?

我遇到的具体问题恰好涉及模式规则.这是一个简化版本,不依赖于剪切和粘贴制表符:

% make --version
GNU Make 3.81
Copyright (C) 2006  Free Software Foundation, Inc.
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.

This program built for x86_64-redhat-linux-gnu
% cat Makefile
COLON := \:
all: ; true
%.bar: ; cp $< $@
x.bar: x.foo
%.foo: ; touch $@
a$(COLON)b.bar: a$(COLON)b.foo
all: x.bar a$(COLON)b.bar
clean: ; rm -f *.foo *.bar
% make clean
rm …
Run Code Online (Sandbox Code Playgroud)

unix makefile gnu-make

16
推荐指数
2
解决办法
9255
查看次数

标签 统计

gnu-make ×1

makefile ×1

unix ×1