-
Notifications
You must be signed in to change notification settings - Fork 12
Expand file tree
/
Copy pathMakefile
More file actions
43 lines (35 loc) · 777 Bytes
/
Makefile
File metadata and controls
43 lines (35 loc) · 777 Bytes
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
# rserver makefile
UNAME_S := $(shell uname -s)
ifeq ($(UNAME_S),Linux)
OSFLAG = l
endif
ifeq ($(UNAME_S),Darwin)
OSFLAG = m
endif
MS=$(shell getconf LONG_BIT) # 32/64
QARCH=$(OSFLAG)$(MS)
Q=${QHOME}/$(QARCH)
CFLAGS=-g -O0 -fPIC -m$(MS)
ifeq ($(OSFLAG),m)
CFLAGS+=-dynamiclib -undefined dynamic_lookup
endif
ifeq ($(OSFLAG),l)
CFLAGS+=-shared
endif
R_HOME=$(shell R RHOME)
R_INCLUDES=$(shell R CMD config --cppflags)
LIBS=-lpthread -L$(R_HOME)/lib -lR
ifeq ($(OSFLAG),l)
LIBS+=-lrt
endif
SRC=embedr.c
TGT=$(addsuffix /embedr.so,$(QARCH))
all:
mkdir -p $(QARCH)
R CMD gcc -o $(TGT) $(CFLAGS) $(R_INCLUDES) $(SRC) $(LIBS) -Wall
install:
install $(TGT) $(Q)
clean:
rm -rf $(TGT)
fmt:
clang-format -style=file embedr.c src/rserver.c src/qserver.c src/common.c -i