help-make
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: how to remove spaces from a list?


From: Paul D. Smith
Subject: Re: how to remove spaces from a list?
Date: Thu, 16 Jan 2003 01:10:29 -0500

%% gk <address@hidden> writes:

  g> I need to process a list and have the resultant strings have no
  g> white space between them.  I have looked at all the make text
  g> functions and foreach, patsubst both return white-space separated
  g> result lists Is there a way to force $(subst ...) to accept a space
  g> as the first parameter?  This doesn't work because subst ignores
  g> leading white space before the first parameter: $(subst ,,$(myText))

A very important trick: how to set a variable equal to a space:

  # $E is an empty variable
  # $S is a variable containing exactly one space as its value

  E :=
  S := $E $E

Now you can use this with subst since the variable is not expanded
before the function arguments are parsed:

  $(subst $S,,$(myText))


Have fun!

-- 
-------------------------------------------------------------------------------
 Paul D. Smith <address@hidden>          Find some GNU make tips at:
 http://www.gnu.org                      http://make.paulandlesley.org
 "Please remain calm...I may be mad, but I am a professional." --Mad Scientist




reply via email to

[Prev in Thread] Current Thread [Next in Thread]