Current section
Files
Jump to
Current section
Files
Makefile
CFLAGS = -std=c++11 -g -O3
SRC_PATH = $(realpath c_src)
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 += -Ic_src
CFLANG += -I$(SRC_PATH)
LIB_NAME = priv/cryptxc.so
ifneq ($(CROSSCOMPILE),)
# crosscompiling
CFLAGS += -fPIC
else
# not crosscompiling
ifneq ($(OS),Windows_NT)
CFLAGS += -fPIC
ifeq ($(shell uname),Darwin)
LDFLAGS += -dynamiclib -undefined dynamic_lookup
else
LDFLAGS += -shared
endif
endif
endif
NIF_SRC=\
c_src/cryptxc.cpp
.PHONY: all clean
all: $(LIB_NAME)
$(LIB_NAME): $(NIF_SRC)
mkdir -p priv
$(CXX) $(CFLAGS) $(LDFLAGS) $^ -o $@
clean:
rm -f $(LIB_NAME)