私はMakefileを持っています:
#Build Configurations
CONFIGS = Debug Release Profile
#Config flags
Debug_Flags=dasd
Release_Flags=
.SECONDEXPANSION:
#Debug_safety_check Release_safety_check Profile_safety_check targets
$(addsuffix _safety_check,$(CONFIGS)):
#Check existence of variable
ifeq '$(origin $(subst safety_check,FLAGS,$@))' 'undefined'
$(error $(subst safety_check,FLAGS,$@) variable undefined)
endif
#How to make our configurations (do corresponding safety_checks)
$(CONFIGS): $$@_safety_check
この行は正しくありません:
ifeq '$(origin $(subst safety_check,FLAGS,$@))' 'undefined'
対応する安全チェックを呼び出すときに$@拡張が発生するためだと思います。しかし、ifeq展開は「すぐに」発生するため、実際には、次のような行が得られます。
ifeq '$(origin ' ') 'undefined'
リストから変数定義をチェックする方法はありますか?