diff --git a/Makefile b/Makefile index 416de9661421c..d4d87addffa76 100644 --- a/Makefile +++ b/Makefile @@ -219,12 +219,6 @@ ifneq ($(findstring BSD,$(OS)),) BSD = 1 endif -# Which standard library to use (e.g. libstdc++ or libc++) -ifdef USE_LIBCXX - OTHERS += -stdlib=$(USE_LIBCXX) - LDFLAGS += -stdlib=$(USE_LIBCXX) -endif - # This sets CXX and so must be up here ifdef CLANG # Allow setting specific CLANG version @@ -233,6 +227,13 @@ ifdef CLANG else CLANGCMD = $(CLANG) endif + ifeq ($(NATIVE), osx) + USE_LIBCXX = 1 + endif + ifdef USE_LIBCXX + OTHERS += -stdlib=libc++ + LDFLAGS += -stdlib=libc++ + endif ifdef CCACHE CXX = CCACHE_CPP2=1 ccache $(CROSS)$(CLANGCMD) LD = CCACHE_CPP2=1 ccache $(CROSS)$(CLANGCMD)