【发布时间】:2017-10-29 09:27:00
【问题描述】:
考虑一下这个简短的 Makefile:
ARGS := -foo
my_ARGS := -bar
their_ARGS :=
all: your.foo my.foo their.foo
%.foo:
@echo $*: $(call _choose_,ARGS,$*)
_isndef_ = $(findstring undefined,$(origin $1))
_choose_ = $(value $(if $(call _isndef_,$2_$1),$1,$2_$1))
正确输出:
your: -foo
my: -bar
their:
我的问题:
- 这是automake 的方式吗? (
LDADD和rmt_LDADD) - 有更短或更好的方法吗?
【问题讨论】:
-
我认为你的第二个问题更适合softwareengineering.stackexchange.com,因为它围绕着配置管理中的核心问题(没有明确的答案)。