1. try-run
scripts/Kbuild.include
try-run = $(shell set -e; TMP="$(TMPOUT).$$$$.tmp"; TMPO="$(TMPOUT).$$$$.O"; if ($(1)) >/dev/null 2>&1; then echo "$(2)"; else echo "$(3)"; fi; rm -f "$$TMP" "$$TMPO")
2. cc-option
scripts/Kbuild.include
cc-option = $(call try-run, $(CC) $(KBUILD_CPPFLAGS) $(KBUILD_CFLAGS) $(1) -c -x c /dev/null -o "$$TMP", $(1), $(2))
cc-option在顶层makefile的示例
KBUILD_CFLAGS += $(call cc-option, --param=allow-store-data-races=0)
3. cc-disable-warning
scripts/Kbuild.include
cc-disable-warning = $(call try-run, $(CC) $(KBUILD_CPPFLAGS) $(KBUILD_CFLAGS) -W$(strip $(1)) -c -x c /dev/null -o "$$TMP" -Wno-$(strip $(1)))
cc-disable-warning在顶层makefile的示例
KBUILD_FLAGS += -Os $(call cc-disable-warning, maybe-uninitialized, )
Kbuild.include中try-run和cc-option的使用示例
本文介绍了Kbuild.include中的try-run和cc-option的使用方法,包括如何在顶层makefile中应用这些函数来优化编译过程,并提供具体的示例代码。
1810

被折叠的 条评论
为什么被折叠?



