您的位置:首页 > 运维架构 > Linux

Linux Makefile try-run

2016-03-14 10:25 260 查看

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, )
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: