diff --git a/Makefile b/Makefile index ea24f28..5a830c7 100644 --- a/Makefile +++ b/Makefile @@ -11,9 +11,23 @@ else UNAME_S := $(shell uname -s) endif +# For Darwin (Mac OS X / macOS) we assume that the default compiler +# clang++ is used; when $(CXX) is some version of g++, then +# $(CXXSTD) has to be set to -std=c++11 (or newer) so +# that -stdlib=libc++ is not automatically added. + +ifeq ($(CXXSTD),) +CXXSTD := -std=c++11 +ifeq ($(UNAME_S),Darwin) +CXXSTD += -stdlib=libc++ +endif +endif + +# Ensure strict standard compliance and no warnings, can be +# changed if desired. + CPPFLAGS ?= -pedantic -CXXSTD ?= c++11 -CXXFLAGS ?= -O3 -Wall -Wextra -Werror +CXXFLAGS ?= -Wall -Wextra -Wshadow -Werror -O3 CLANG_TIDY ?= clang-tidy