Procházet zdrojové kódy

[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 před 5 roky
rodič
revize
91cb93f95d
1 změnil soubory, kde provedl 6 přidání a 0 odebrání
  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)