-
Notifications
You must be signed in to change notification settings - Fork 2
/
Makefile
58 lines (49 loc) · 1.31 KB
/
Makefile
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
ifeq ($(ERTS_INCLUDE_DIR),)
$(warning ERTS_INCLUDE_DIR not set. Invoke via mix)
else
ERTS_CFLAGS ?= -I$(ERTS_INCLUDE_DIR)
endif
ifeq ($(ERL_INTERFACE_INCLUDE_DIR),)
$(warning ERL_INTERFACE_INCLUDE_DIR not set. Invoke via mix)
else
ERL_CFLAGS ?= -I$(ERL_INTERFACE_INCLUDE_DIR)
endif
ifeq ($(ERL_INTERFACE_LIB_DIR),)
$(warning ERL_INTERFACE_LIB_DIR not set. Invoke via mix)
else
ERL_LDFLAGS ?= -L$(ERL_INTERFACE_LIB_DIR)
endif
ifeq ($(MIX_APP_PATH),)
$(warning MIX_APP_PATH not set. Invoke via mix)
endif
ifeq ($(MIX_DEPS_PATH),)
$(warning MIX_APP_PATH not set. Invoke via mix)
endif
CPP_PATH=$(MIX_DEPS_PATH)/pulsar/pulsar-client-cpp
ifeq ($(shell uname),Darwin) # Mac OS X
PLATFORM_OPTIONS=-undefined dynamic_lookup -L/usr/local/opt/libpulsar/lib -lpulsar -rpath /usr/local/opt/libpulsar/lib
else
PLATFORM_OPTIONS=/usr/lib/libpulsar.so
endif
default_target: all
all: get_deps priv priv/neutron_nif.so
get_deps:
@./build_deps.sh
priv:
mkdir -p $(MIX_APP_PATH)/priv/
priv/neutron_nif.so: ./c_src/neutron_nif.c
$(CC) $^ \
-shared \
-pedantic \
-fPIC \
-O3 \
-finline-functions \
-o $(MIX_APP_PATH)/priv/neutron_nif.so \
$(PLATFORM_OPTIONS) \
-I/usr/local/ssl/include \
$(ERL_CFLAGS) \
$(ERTS_CFLAGS) \
$(ERL_LDFLAGS)
clean:
$(RM) $(MIX_APP_PATH)/priv/neutron_nif.so
.PHONY: get_deps default_target all clean