
CXX_STD = CXX11

PKG_CPPFLAGS += -I../inst/include/

UNAME := $(shell uname)

ifeq ($(UNAME), Darwin)
  USE_TBB=yes
endif
ifeq ($(UNAME), Linux)
  USE_TBB=yes
endif

ifdef USE_TBB

.PHONY: all tbb

all: $(SHLIB) tbb

tbb:
	mkdir -p ../inst/lib
	if [[ "$(CC)" == clang* ]]; then \
		(cd tbb/src; make compiler=clang CXXFLAGS=-DTBB_NO_LEGACY=1 tbb_release tbb_build_prefix=lib) \
	else \
		(cd tbb/src; make CXXFLAGS=-DTBB_NO_LEGACY=1 tbb_release tbb_build_prefix=lib) \
	fi
	cp tbb/build/lib_release/libtbb.* ../inst/lib

clean:
	(cd tbb/src; make clean)

endif



