2012-03-04 18 views

答えて

14

以下のコードを参照してください。

# 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)) 

使用法:

FOO = foo1 foo2 ... fooN 

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

あなたは、単にコロンとスペースを置き換えることができます。

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

FOO_LISTfoo1:foo2:...:fooNです。

+1

なぜ 'FOO_LIST = $(subst $(SPACE)、:, $(FOO))'だけではないのですか? – Beta

+0

@Beta良い点。修正されました。 –

関連する問題