Kbuild idiom using colon (:) and percent (%) in variable expansion
Clash Royale CLAN TAG#URR8PPP
up vote
0
down vote
favorite
What does the KBuild expression:
FOO := $(BAR:"%"=%)
do as part of a Linux kernel Makefile?
Never mind: I found the answer elsewhere.
make
add a comment |Â
up vote
0
down vote
favorite
What does the KBuild expression:
FOO := $(BAR:"%"=%)
do as part of a Linux kernel Makefile?
Never mind: I found the answer elsewhere.
make
I already answered your question here as well: Make idiom using colon (:) and percent (%) in variable expansion
â steeldriver
Jul 12 at 14:12
1
But the method you discovered is non-portable as it only works withgmake
. The method from your question however works in all recent make implementations.
â schily
Jul 12 at 14:14
add a comment |Â
up vote
0
down vote
favorite
up vote
0
down vote
favorite
What does the KBuild expression:
FOO := $(BAR:"%"=%)
do as part of a Linux kernel Makefile?
Never mind: I found the answer elsewhere.
make
What does the KBuild expression:
FOO := $(BAR:"%"=%)
do as part of a Linux kernel Makefile?
Never mind: I found the answer elsewhere.
make
edited Jul 12 at 14:02
Kusalananda
101k13199312
101k13199312
asked Jul 12 at 13:50
JohnRWicks
42
42
I already answered your question here as well: Make idiom using colon (:) and percent (%) in variable expansion
â steeldriver
Jul 12 at 14:12
1
But the method you discovered is non-portable as it only works withgmake
. The method from your question however works in all recent make implementations.
â schily
Jul 12 at 14:14
add a comment |Â
I already answered your question here as well: Make idiom using colon (:) and percent (%) in variable expansion
â steeldriver
Jul 12 at 14:12
1
But the method you discovered is non-portable as it only works withgmake
. The method from your question however works in all recent make implementations.
â schily
Jul 12 at 14:14
I already answered your question here as well: Make idiom using colon (:) and percent (%) in variable expansion
â steeldriver
Jul 12 at 14:12
I already answered your question here as well: Make idiom using colon (:) and percent (%) in variable expansion
â steeldriver
Jul 12 at 14:12
1
1
But the method you discovered is non-portable as it only works with
gmake
. The method from your question however works in all recent make implementations.â schily
Jul 12 at 14:14
But the method you discovered is non-portable as it only works with
gmake
. The method from your question however works in all recent make implementations.â schily
Jul 12 at 14:14
add a comment |Â
2 Answers
2
active
oldest
votes
up vote
0
down vote
It assigns the value of the Makefile variable BAR
to FOO
, but removes all double quotes around words.
Example:
BAR:= "hello" "world"
FOO:= $(BAR:"%"=%)
all:
@echo 'BAR = $(BAR)'
@echo 'FOO = $(FOO)'
Testing:
$ make
BAR = "hello" "world"
FOO = hello world
add a comment |Â
up vote
-1
down vote
This is a so called pattern macro replacement.
The feature was first introduced in 1986 in SunPro Make and is also part of gmake
.
The construct
$(VAR:op%os=np%ns)
uses % as a match all case and allows to replace the old prefix and suffix by a new prefix and suffix.
In your case, it removes "
around words, since old prefix and old suffix are both "
and new prefix and new suffix are both empty.
add a comment |Â
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
0
down vote
It assigns the value of the Makefile variable BAR
to FOO
, but removes all double quotes around words.
Example:
BAR:= "hello" "world"
FOO:= $(BAR:"%"=%)
all:
@echo 'BAR = $(BAR)'
@echo 'FOO = $(FOO)'
Testing:
$ make
BAR = "hello" "world"
FOO = hello world
add a comment |Â
up vote
0
down vote
It assigns the value of the Makefile variable BAR
to FOO
, but removes all double quotes around words.
Example:
BAR:= "hello" "world"
FOO:= $(BAR:"%"=%)
all:
@echo 'BAR = $(BAR)'
@echo 'FOO = $(FOO)'
Testing:
$ make
BAR = "hello" "world"
FOO = hello world
add a comment |Â
up vote
0
down vote
up vote
0
down vote
It assigns the value of the Makefile variable BAR
to FOO
, but removes all double quotes around words.
Example:
BAR:= "hello" "world"
FOO:= $(BAR:"%"=%)
all:
@echo 'BAR = $(BAR)'
@echo 'FOO = $(FOO)'
Testing:
$ make
BAR = "hello" "world"
FOO = hello world
It assigns the value of the Makefile variable BAR
to FOO
, but removes all double quotes around words.
Example:
BAR:= "hello" "world"
FOO:= $(BAR:"%"=%)
all:
@echo 'BAR = $(BAR)'
@echo 'FOO = $(FOO)'
Testing:
$ make
BAR = "hello" "world"
FOO = hello world
answered Jul 12 at 14:01
Kusalananda
101k13199312
101k13199312
add a comment |Â
add a comment |Â
up vote
-1
down vote
This is a so called pattern macro replacement.
The feature was first introduced in 1986 in SunPro Make and is also part of gmake
.
The construct
$(VAR:op%os=np%ns)
uses % as a match all case and allows to replace the old prefix and suffix by a new prefix and suffix.
In your case, it removes "
around words, since old prefix and old suffix are both "
and new prefix and new suffix are both empty.
add a comment |Â
up vote
-1
down vote
This is a so called pattern macro replacement.
The feature was first introduced in 1986 in SunPro Make and is also part of gmake
.
The construct
$(VAR:op%os=np%ns)
uses % as a match all case and allows to replace the old prefix and suffix by a new prefix and suffix.
In your case, it removes "
around words, since old prefix and old suffix are both "
and new prefix and new suffix are both empty.
add a comment |Â
up vote
-1
down vote
up vote
-1
down vote
This is a so called pattern macro replacement.
The feature was first introduced in 1986 in SunPro Make and is also part of gmake
.
The construct
$(VAR:op%os=np%ns)
uses % as a match all case and allows to replace the old prefix and suffix by a new prefix and suffix.
In your case, it removes "
around words, since old prefix and old suffix are both "
and new prefix and new suffix are both empty.
This is a so called pattern macro replacement.
The feature was first introduced in 1986 in SunPro Make and is also part of gmake
.
The construct
$(VAR:op%os=np%ns)
uses % as a match all case and allows to replace the old prefix and suffix by a new prefix and suffix.
In your case, it removes "
around words, since old prefix and old suffix are both "
and new prefix and new suffix are both empty.
answered Jul 12 at 13:59
schily
8,46521435
8,46521435
add a comment |Â
add a comment |Â
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f454902%2fkbuild-idiom-using-colon-and-percent-in-variable-expansion%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
I already answered your question here as well: Make idiom using colon (:) and percent (%) in variable expansion
â steeldriver
Jul 12 at 14:12
1
But the method you discovered is non-portable as it only works with
gmake
. The method from your question however works in all recent make implementations.â schily
Jul 12 at 14:14