Makefile奇怪的错误打印变量定义

时间:2016-09-09 03:45:25

标签: makefile architecture

我得到一个非常神秘的"不支持的ARCH"我尝试在GNU Make 4.1中打印变量定义时出错。

上下文是一个非常大的Makefile集合,它们相互包含并编译了一长串目标和全局变量(它是cyanogenmod android构建树)。

我已将目标添加到其中一个Makefile:

2273 .PHONY: showvars
2274 showvars:
2275    $(foreach v, $(.VARIABLES), $(info $(v) = $($(v))))

make showvars的输出是:

ALL_MODULES.TtsEngine.INTERMEDIATE_SOURCE_DIR =  /elements/Data/Android/android-source/out/target/common/obj/APPS/TtsEngine_intermediates/src
ALL_MODULES.sound.BUILT =  /elements/Data/Android/android-source/out/target/product/d851/obj/EXECUTABLES/sound_intermediates/sound
..
..
ALL_MODULES.CMFileManagerTests.MAKEFILE =  packages/apps/CMFileManager/tests/Android.mk
build/core/Makefile:2275: *** Unsupported ARCH .  Stop.

#### make failed to build some targets (01:36 (mm:ss)) ####

如何打印变量会导致架构错误?或者ARCH是下一个变量名,但那么错误是什么意思?

编辑: 我将$(info $(。VARIABLES))添加到同一个Makefile的末尾。此命令完成且没有错误,变量名称列表大约为3兆字节!的文字。 305个变量包含单词" ARCH"。但他们都打印得很好。一小时后运行多次(每次运行需要一分钟才能运行),答案是......

功能定义!如果v是函数的名称,则$($(v))运行该函数。不同的函数生成各种有趣的错误消息这是ARCH错误消息的来源,它来自函数define-libcompiler-rt-source-files,它恰好出现在我的原始测试中,紧跟在包含单词ARCH的变量名后面。

define get-libcompiler-rt-source-files
  $(if $(findstring $(1),arm),$(call get-libcompiler-rt-arm-source-files),
      $(if $(findstring $(1),mips),$(call get-libcompiler-rt-mips-source-files),
          $(if $(findstring $(1),x86),$(call get-libcompiler-rt-x86-source-files),
             $(if $(findstring $(1),x86_64),$(call get-libcompiler-rt-x86_64-source-files),
                 $(if $(findstring $(1),x32),$(call get-libcompiler-rt-x86-source-files),
                    $(if $(findstring $(1),arm64),$(call get-libcompiler-rt-arm64-source-files),
                       $(if $(findstring $(1),mips64),$(call get-libcompiler-rt-mips64-source-files),
  $(error Unsupported ARCH $(1)))))))))
endef

那么,有没有办法获取所有已定义函数的列表,以便我可以将它们从变量列表中过滤掉来?

0 个答案:

没有答案
相关问题