xref: /optee_os/mk/cc-option.mk (revision 331ebf7eab80eb41828979ff4ba8372691117f30)
1*331ebf7eSJerome Forissier_cc-option-supported = $(if $(shell $(CC$(sm)) $(1) -c -x c /dev/null -o /dev/null 2>/dev/null >/dev/null || echo "Not supported"),,1)
2*331ebf7eSJerome Forissier_cc-opt-cached-var-name = $(subst =,~,$(strip cached-cc-option-$(1)-$(subst $(empty) $(empty),,$(CC$(sm)))))
3*331ebf7eSJerome Forissierdefine _cc-option
4*331ebf7eSJerome Forissier$(eval _var_name := $(call _cc-opt-cached-var-name,$(1)))
5*331ebf7eSJerome Forissier$(eval $(_var_name) := $(if $(filter $(origin $(_var_name)),undefined),$(call _cc-option-supported,$(1)),$($(_var_name))))
6*331ebf7eSJerome Forissier$(if $($(_var_name)),$(1),$(2))
7*331ebf7eSJerome Forissierendef
8*331ebf7eSJerome Forissiercc-option = $(strip $(call _cc-option,$(1),$(2)))
9*331ebf7eSJerome Forissier
10