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