浏览代码

[Makefile.rules] Add function "cc-option" to check available GCC options

The "cc-option" must be used to conditionally add compiler options only
in those environments which support these options (e.g., older verions
of gcc may not support some options, thus they must be declared via
"cc-option").
Isaku Yamahata 5 年之前
父节点
当前提交
91cb93f95d
共有 1 个文件被更改,包括 6 次插入0 次删除
  1. 6 0
      Makefile.rules

+ 6 - 0
Makefile.rules

@@ -58,3 +58,9 @@ CLEAN_FILES += generated_offsets.py generated_offsets.pyc
 
 quiet_cmd_ln_sf = [ $@ ]
       cmd_ln_sf = ln -sf $(abspath $<) $@
+
+
+cc-option = $(shell set -e; \
+	if ($(CC) -Werror $(1) -c -x c /dev/null -o /dev/null) >/dev/null 2>&1; \
+	then echo "$(1)"; \
+	fi)