help-make
[Top][All Lists]
Advanced

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

join?


From: Paul D. Smith
Subject: join?
Date: Thu, 08 Mar 2001 02:23:37 -0500

Michael Sterrett writes:

 > How can I produce the functionality of the perl function join() in gmake.

Use the join function.

 > I have a list of directories:
 > 
 >     A = /usr/bin /bin
 > 
 > and I want this:
 > 
 >     A = /usr/bin:/bin
 > 
 > Something like this I thought would work in gmake, but doesn't seem to:
 > 
 >     A := $(subst  ,:,$(A))

This is a different question, relating to whitespace.  Make ignores
whitespace before the argument, so it thinks you are trying to replace
nothing (an empty argument) with ":".

You have to do this (this is described somewhere in the make manual,
but it's not convenient for me to look it up just at the moment):

  E := # empty variable
  S := $(E) # variable containing one space

  A := $(subst $(S),:,$(A))



reply via email to

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