Quellcode durchsuchen

[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 vor 5 Jahren
Ursprung
Commit
91cb93f95d
1 geänderte Dateien mit 6 neuen und 0 gelöschten Zeilen
  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)