Escapezeichen in Dateinamen in einem Makefile

Gibt es eine Möglichkeit, GNU make mit Dateinamen, die Doppelpunkte enthalten, zum korrekten Funktionieren zu bringen?

Das spezifische Problem, auf das ich stoße, ist eine Musterregel. Hier ist eine vereinfachte Version, die nicht vom Ausschneiden und Einfügen von Tabulatorzeichen abhängt:

% 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 
% 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 -f *.foo *.bar
% make
touch x.foo
cp x.foo x.bar
cp  a\:b.bar
cp: missing destination file operand after `a:b.bar'
Try `cp --help' for more information.
make: *** [a\:b.bar] Error 1
lt; $@ 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 -f *.foo *.bar % make touch x.foo cp x.foo x.bar cp a\:b.bar cp: missing destination file operand after `a:b.bar' Try `cp --help' for more information. make: *** [a\:b.bar] Error 1

Ersetzen Sie $ (COLON) durch ein Literal: Es wird genau dasselbe Ergebnis erzielt. Ohne den Backslash geschieht Folgendes:

Makefile:6: *** target pattern contains no `%'.  Stop.

Antworten auf die Frage(4)

Ihre Antwort auf die Frage