xref: /optee_os/mk/cc-option.mk (revision 769d857b9cbf2cbfef1c4d3f64a2b8658ee73d9e)
1_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_cc-opt-cached-var-name = $(subst =,~,$(strip cached-cc-option-$(1)-$(subst $(empty) $(empty),,$(CC$(sm)))))
3define _cc-option
4$(eval _var_name := $(call _cc-opt-cached-var-name,$(1)))
5$(eval $(_var_name) := $(if $(filter $(origin $(_var_name)),undefined),$(call _cc-option-supported,$(1)),$($(_var_name))))
6$(if $($(_var_name)),$(1),$(2))
7endef
8cc-option = $(strip $(call _cc-option,$(1),$(2)))
9
10