forked from mbrix/libsecp256k1
-
Notifications
You must be signed in to change notification settings - Fork 23
/
Makefile
37 lines (27 loc) · 903 Bytes
/
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
MIX = mix
ERLANG_PATH = $(shell erl -eval 'io:format("~s", [lists:concat([code:root_dir(), "/erts-", erlang:system_info(version), "/include"])])' -s init stop -noshell)
CFLAGS += -I$(ERLANG_PATH)
CFLAGS += -I c_src/secp256k1 -I c_src/secp256k1/src -I c_src/secp256k1/include
ifeq ($(wildcard deps/libsecp256k1),)
LIB_PATH = ../libsecp256k1
else
LIB_PATH = deps/libsecp256k1
endif
CFLAGS += -I$(LIB_PATH)/src
ifneq ($(OS),Windows_NT)
CFLAGS += -fPIC
ifeq ($(shell uname),Darwin)
LDFLAGS += -dynamiclib -undefined dynamic_lookup
endif
endif
LDFLAGS += c_src/secp256k1/.libs/libsecp256k1.a -lgmp
.PHONY: clean
all: priv/libsecp256k1_nif.so
priv/libsecp256k1_nif.so: c_src/libsecp256k1_nif.c
c_src/build_deps.sh
$(CC) $(CFLAGS) -shared -o $@ c_src/libsecp256k1_nif.c $(LDFLAGS)
clean:
$(MIX) clean
c_src/build_deps.sh clean
$(MAKE) -C $(LIB_PATH) clean
$(RM) priv/libsecp256k1_nif.so