|
1 | 1 |
|
2 | 2 | PKG_CXXFLAGS = @CXX11STD@
|
3 | 3 |
|
| 4 | +# If TBB_ROOT is defined, use it. |
| 5 | +ifdef TBB_ROOT |
| 6 | + |
| 7 | + ifndef TBB_LIB |
| 8 | + TBB_LIB = $(TBB_ROOT)/lib |
| 9 | + endif |
| 10 | + |
| 11 | + ifndef TBB_INC |
| 12 | + TBB_INC = $(TBB_ROOT)/include |
| 13 | + endif |
| 14 | + |
| 15 | +endif |
| 16 | + |
4 | 17 | # If TBB_LIB is defined by TBB_INC is not, make a guess.
|
5 | 18 | ifdef TBB_LIB
|
6 | 19 | ifndef TBB_INC
|
|
69 | 82 | ifdef USE_TBB
|
70 | 83 |
|
71 | 84 | PKG_CXXFLAGS += -DRCPP_PARALLEL_USE_TBB=1
|
| 85 | +PKG_CXXFLAGS += -DTBB_SUPPRESS_DEPRECATED_MESSAGES=1 |
72 | 86 |
|
73 | 87 | MAKE_ARGS := tbb_release tbbmalloc_release tbb_build_prefix=lib
|
74 | 88 |
|
@@ -101,40 +115,38 @@ endif
|
101 | 115 |
|
102 | 116 | # Write compilation output to file, and log it if installation fails.
|
103 | 117 | ifneq ($(OS), Windows_NT)
|
104 |
| - MAKE_ARGS += > tbb.log 2>&1 || cat tbb.log; rm -f tbb.log |
| 118 | + MAKE_ARGS += > tbb.log 2>&1 && echo "(tbb) TBB successfully built and installed." || cat tbb.log; rm -f tbb.log |
105 | 119 | endif
|
106 | 120 |
|
107 |
| -.PHONY: all tbb |
| 121 | +.PHONY: all tbb tbb-clean |
108 | 122 |
|
109 | 123 | # Order is important in Windows' case. See PKG_LIBS above
|
110 | 124 | all: tbb $(SHLIB)
|
111 | 125 |
|
112 |
| -tbb: |
| 126 | +$(SHLIB): $(OBJECTS) tbb |
| 127 | + |
| 128 | +# NOTE: TBB libraries are installed via install.libs.R. |
| 129 | +# However, we need to copy headers here so that they are visible during compilation. |
| 130 | +tbb: tbb-clean |
113 | 131 | ifdef TBB_LIB
|
114 |
| - echo "Using system (Intel/OneAPI) TBB library ..."; \ |
115 |
| - mkdir -p ../inst/lib/$(ARCH_DIR); \ |
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 || :; \ |
118 |
| - rm -Rf ../inst/include/serial/; \ |
119 |
| - rm -Rf ../inst/include/tbb/; \ |
120 |
| - rm -Rf ../inst/include/tbb_local/; \ |
121 |
| - mkdir -p ../inst/include; \ |
122 |
| - cp -R $(TBB_INC)/serial ../inst/include/ 2>/dev/null || :; \ |
123 |
| - cp -R $(TBB_INC)/oneapi ../inst/include/ 2>/dev/null || :; \ |
124 |
| - cp -R $(TBB_INC)/tbb ../inst/include/ 2>/dev/null || : |
| 132 | + @echo "(tbb) Using system (Intel/OneAPI) TBB library ..." |
| 133 | + @echo "(tbb) TBB_LIB = $(TBB_LIB)" |
| 134 | + @echo "(tbb) TBB_INC = $(TBB_INC)" |
| 135 | + @mkdir -p ../inst/include |
| 136 | + @cp -R $(TBB_INC)/* ../inst/include/ |
125 | 137 | else
|
126 |
| - echo "Using bundled TBB library ..."; \ |
127 |
| - rm -Rf ../inst/include/serial/; \ |
128 |
| - rm -Rf ../inst/include/tbb/; \ |
129 |
| - rm -Rf ../inst/include/tbb_local/; \ |
130 |
| - cp -R tbb/include/* ../inst/include/; \ |
131 |
| - cd tbb/src; \ |
132 |
| - $(MAKE_CMD) stdver=@STDVER@ $(MAKE_ARGS); \ |
133 |
| - cd ../..; \ |
134 |
| - mkdir -p ../inst/lib/$(ARCH_DIR); \ |
135 |
| - cp tbb/build/lib_release/$(TBB_COPY_PATTERN) ../inst/lib/$(ARCH_DIR) |
| 138 | + @echo "(tbb) Using bundled TBB library ..." |
| 139 | + @mkdir -p ../inst/include |
| 140 | + @cp -R tbb/include/* ../inst/include/ |
| 141 | + @(cd tbb/src && $(MAKE_CMD) stdver=@STDVER@ $(MAKE_ARGS)) |
136 | 142 | endif
|
137 | 143 |
|
| 144 | +tbb-clean: |
| 145 | + @rm -rf ../inst/include/tbb |
| 146 | + @rm -rf ../inst/include/oneapi |
| 147 | + @rm -rf ../inst/include/tbb_local |
| 148 | + @rm -rf ../inst/include/serial |
| 149 | + |
138 | 150 | clean:
|
139 | 151 | ifdef TBB_LIB
|
140 | 152 | echo "Nothing to clean for TBB."
|
|
0 commit comments