GNU Make: replace spaces with commas

  • Follow


Greetings.

I have a Makefile which needs to construct a command line for the program
curl.  Curl takes its filename arguments as a strictly comma-delimited list
(i.e., no spaces unless they're part of the filename).  In my case I need
to convert the contents of the $? variable from a space-delimited list into
such a comma-delimited list.  I can't figure out how to do this using
Make-internal string commands, though.

The $(subst) command is the obvious solution, but I can't figure out how to
escape the space and the comma so that they're recognized by Make.  That
is, $(subst \ ,\,,$?) (and variations thereof I've tried) don't work.

$(foreach f,$?,$f,) is not an option as it inserts extraneous space which
confuses curl.

Any solutions besides resorting to $(shell tr)?

Regards,
Tristan

-- 
   _
  _V.-o  Tristan Miller [en,(fr,de,ia)]  ><  Space is limited
 / |`-'  -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=  <>  In a haiku, so it's hard
(7_\\    http://www.nothingisreal.com/   ><  To finish what you
0
Reply psychonaut (528) 1/12/2004 2:48:29 PM


0 Replies
463 Views

(page loaded in 0.013 seconds)

Similiar Articles:













7/23/2012 9:53:20 PM


Reply: