2012-03-04 23 views

Respuesta

14

Vea el código a continuación.

# A literal space. 
space := 
space += 

# Joins elements of the list in arg 2 with the given separator. 
# 1. Element separator. 
# 2. The list. 
join-with = $(subst $(space),$1,$(strip $2)) 

Uso:

FOO = foo1 foo2 ... fooN 

COLON_SEPARATED_FOO := $(call join-with,:,$(FOO)) 
12

Usted puede simplemente sustituir los espacios de colon:

EMPTY := 
SPACE := $(EMPTY) $(EMPTY) 
FOO = foo1 foo2 ... fooN 
FOO_LIST = $(subst $(SPACE),:,$(FOO)) 

FOO_LIST es foo1:foo2:...:fooN.

+1

¿Por qué no simplemente 'FOO_LIST = $ (subst $ (SPACE),:, $ (FOO))'? – Beta

+0

@Beta Buen punto. Corregido –

Cuestiones relacionadas