-
Notifications
You must be signed in to change notification settings - Fork 59
Expand file tree
/
Copy pathMakevars.in
More file actions
89 lines (68 loc) · 2.18 KB
/
Makevars.in
File metadata and controls
89 lines (68 loc) · 2.18 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
PKG_CPPFLAGS += @CXX11STD@ -I../inst/include/
ifeq ($(OS), Windows_NT)
USE_TBB=Windows
TBB_COPY_PATTERN=tbb*.dll
MAKEFLAGS = -j1
MAKE = make -e
MAKE_CMD = CYGWIN=nodosfilewarning CONLY="@CC@" CPLUS="@CXX11@" PIC_KEY="@CXX11PICFLAGS@" WARNING_SUPPRESS="" $(MAKE)
else
UNAME := $(shell uname)
TBB_COPY_PATTERN=libtbb*.*
ifeq ($(UNAME), Darwin)
USE_TBB=Mac
endif
ifeq ($(UNAME), Linux)
USE_TBB=Linux
endif
ifeq ($(UNAME), SunOS)
SUNOS_ARCH = $(shell uname -p)
ifeq ($(SUNOS_ARCH), i386)
USE_TBB=SunOS
endif
endif
MAKE += -e
MAKE_CMD = CONLY="@CC@" CPLUS="@CXX11@" PIC_KEY="@CXX11PICFLAGS@" WARNING_SUPPRESS="" $(MAKE)
endif
ifdef USE_TBB
PKG_CPPFLAGS += -DRCPP_PARALLEL_USE_TBB=1
MAKE_ARGS := CXXFLAGS=-DTBB_NO_LEGACY=1 tbb_release tbbmalloc_release tbb_build_prefix=lib
ifeq ($(USE_TBB), Windows)
# rtools: turn on hacks to compensate for make and shell differences rtools<=>MinGW
# compiler: overwrite default (which is cl = MS compiler)
MAKE_ARGS += rtools=true compiler=gcc
ifeq ("$(WIN)", "64")
MAKE_ARGS += arch=intel64
ARCH_DIR=x64/
else
MAKE_ARGS += arch=ia32
ARCH_DIR=i386/
endif
# Linker needs access to the tbb dll; otherwise you get errors such as:
# "undefined reference to `tbb::task_scheduler_init::terminate()'"
PKG_LIBS += -L../inst/lib/$(ARCH_DIR) -ltbb -ltbbmalloc
endif
# For Solaris detect if this is 32-bit R on x86 and if so forward that to TBB
ifeq ($(USE_TBB), SunOS)
R_32BIT = $(shell ${R_HOME}/bin/Rscript -e 'cat(.Machine$$sizeof.pointer == 4)')
ifeq ($(R_32BIT), TRUE)
MAKE_ARGS += arch=ia32
endif
endif
.PHONY: all tbb
# Order is important in Windows' case. See PKG_LIBS above
all: tbb $(SHLIB)
tbb:
mkdir -p ../inst/lib/$(ARCH_DIR); \
cd tbb/src; \
if [ -n "$(shell echo $(CC) | grep clang)" ]; then \
$(MAKE_CMD) stdver=@STDVER@ compiler=clang $(MAKE_ARGS); \
elif [ -n "$(shell echo $(CC) | grep gcc)" ]; then \
$(MAKE_CMD) stdver=@STDVER@ compiler=gcc $(MAKE_ARGS); \
else \
$(MAKE_CMD) stdver=@STDVER@ $(MAKE_ARGS); \
fi; \
cd ../..; \
cp tbb/build/lib_release/$(TBB_COPY_PATTERN) ../inst/lib/$(ARCH_DIR)
clean:
(cd tbb/src; make clean)
endif