[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Quick question: joining strings
From: |
Paul Smith |
Subject: |
Re: Quick question: joining strings |
Date: |
Fri, 01 Aug 2008 17:02:10 -0400 |
On Fri, 2008-08-01 at 16:57 -0400, Yang Zhang wrote:
> Hi, if I have "xs := a b c", how do I get "a:b:c"?
You need to use "subst" on spaces. But, it's tricky to do this; there's
no good way to "escape" a space inside a function argument.
However, you can hide anything from make's function parsing by putting
it inside a variable, since make chops up the arguments BEFORE it
expands anything.
Getting a space into a variable is ALSO a little tricky. Do this:
# make an empty variable
E =
# Make a variable containing exactly one space:
S = $(E) $(E)
# now you can subst:
$(subst $(S),:,$(xs))