Przeglądaj źródła

[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 lat temu
rodzic
commit
91cb93f95d
1 zmienionych plików z 6 dodań i 0 usunięć
  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)