support.mk (556B)
1 # Helper to determine if a compiler option is supported 2 # Args: 3 # $(1) = option to test, if successful will be output 4 # $(2) = option to use if $(1) is not supported 5 # $(3) = additional arguments to pass to the compiler during the test, but aren't contained in the output 6 cc-option = $(shell \ 7 if { echo 'int main(){return 0;}' | $(CC) $(1) $(3) -o /dev/null -x c /dev/null >/dev/null 2>&1; }; \ 8 then echo "$(1)"; else echo "$(2)"; fi) 9 10 # Helper to pass comma character to make functions (use with `$(,)` to pass in `$(call ...)` arguments) 11 , := ,