11
22PKG_CXXFLAGS = @CXX11STD@
33
4+ # If TBB_LIB is defined by TBB_INC is not, make a guess.
5+ ifdef TBB_LIB
6+ ifndef TBB_INC
7+ TBB_INC = $(TBB_LIB)/../include
8+ endif
9+ endif
10+
411ifdef TBB_INC
512 PKG_CPPFLAGS = -I../inst/include -I$(TBB_INC)
613else
@@ -11,17 +18,13 @@ ifdef TBB_LIB
1118 PKG_LIBS = -Wl,-L,"$(TBB_LIB)" -Wl,-rpath,"$(TBB_LIB)" -ltbb -ltbbmalloc
1219endif
1320
14- ifeq ($(VERBOSE),)
15- SILENT = -s
16- endif
17-
1821ifeq ($(OS), Windows_NT)
1922
2023 USE_TBB=Windows
2124 TBB_COPY_PATTERN=tbb*.dll
2225
2326 MAKE = make
24- MAKEFLAGS = -e $(SILENT) -j1
27+ MAKEFLAGS = -e -j1
2528 MAKE_CMD = \
2629 MSYS2_ARG_CONV_EXCL="*" \
2730 CYGWIN=nodosfilewarning \
3639
3740 UNAME := $(shell uname)
3841 TBB_COPY_PATTERN=libtbb*.*
42+
3943 ifeq ($(UNAME), Darwin)
4044 USE_TBB=Mac
4145 endif
46+
4247 ifeq ($(UNAME), Linux)
4348 USE_TBB=Linux
4449 endif
50+
4551 ifeq ($(UNAME), SunOS)
4652 SUNOS_ARCH = $(shell uname -p)
4753 ifeq ($(SUNOS_ARCH), i386)
4854 USE_TBB=SunOS
4955 endif
5056 endif
5157
52- MAKEFLAGS += -e $(SILENT)
58+ MAKEFLAGS += -e
5359 MAKE_CMD = \
5460 CONLY="@CC@ $(PKG_CPPFLAGS) @CPPFLAGS@" \
5561 CPLUS="@CXX11@ $(PKG_CPPFLAGS) @CPPFLAGS@" \
@@ -71,7 +77,7 @@ ifeq ($(USE_TBB), Windows)
7177 # rtools: turn on hacks to compensate for make and shell differences rtools<=>MinGW
7278 # compiler: overwrite default (which is cl = MS compiler)
7379 MAKE_ARGS += rtools=true compiler=gcc
74- ifeq (" $(WIN)", "64" )
80+ ifeq ($(WIN), 64 )
7581 MAKE_ARGS += arch=intel64 runtime=mingw
7682 ARCH_DIR=x64/
7783 else
@@ -93,15 +99,9 @@ ifeq ($(USE_TBB), SunOS)
9399 endif
94100endif
95101
96- # Silence some compilation warnings. This is a dirty trick, but is necessary
97- # as TBB uses a number of #pragmas and compiler-specific switches depending
98- # on the compiler and machine being compiled for, and it selects and activates
99- # those switches only after confirming the specific compiler features it needs.
100- # Set VERBOSE=1 to have a more verbose install.
102+ # Write compilation output to file, and log it if installation fails.
101103ifneq ($(OS), Windows_NT)
102- ifeq ($(VERBOSE),)
103- MAKE_ARGS += >/dev/null 2>&1
104- endif
104+ MAKE_ARGS += > tbb.log 2>&1 || cat tbb.log; rm -f tbb.log
105105endif
106106
107107.PHONY: all tbb
113113ifdef TBB_LIB
114114 echo "Using system (Intel/OneAPI) TBB library ..."; \
115115 mkdir -p ../inst/lib/$(ARCH_DIR); \
116- cp $(TBB_LIB)/libtbb.so ../inst/lib/$(ARCH_DIR)/libtbb.so 2>/dev/null || :; \
117- cp $(TBB_LIB)/libtbbmalloc.so ../inst/lib/$(ARCH_DIR)/libtbbmalloc.so 2>/dev/null || :; \
116+ ln -nfs $(TBB_LIB)/libtbb.so ../inst/lib/$(ARCH_DIR)/libtbb.so 2>/dev/null || :; \
117+ ln -nfs $(TBB_LIB)/libtbbmalloc.so ../inst/lib/$(ARCH_DIR)/libtbbmalloc.so 2>/dev/null || :; \
118118 rm -Rf ../inst/include/serial/; \
119119 rm -Rf ../inst/include/tbb/; \
120120 rm -Rf ../inst/include/tbb_local/; \
0 commit comments