Packages
argon2_elixir
0.10.1
4.1.3
4.1.2
4.1.1
4.1.0
4.0.0
3.2.1
3.2.0
3.1.0
3.0.0
2.4.1
2.4.0
2.3.0
2.2.1
2.2.0
2.1.2
2.1.1
2.1.0
2.0.5
2.0.4
2.0.3
2.0.2
2.0.1
2.0.0
1.3.3
1.3.1
1.3.0
1.2.14
1.2.13
1.2.12
1.2.11
1.2.10
1.2.9
1.2.8
1.2.7
1.2.6
1.2.5
1.2.4
1.2.2
1.2.1
1.2.0
1.1.0
1.0.0
0.12.0
0.11.4
0.11.3
0.11.2
0.11.0
0.10.1
0.10.0
0.9.1
0.9.0
0.8.0
Argon2 password hashing algorithm for Elixir
Current section
Files
Jump to
Current section
Files
argon2_elixir
Makefile
Makefile
# Argon2 password hashing algorithm for use with Elixir
# Makefile
#
# Copyright 2016 David Whitlock
#
# This is licensed under the Apache Public License 2.0
#
# The license and copyright information for the reference implementation
# is detailed below:
#
# Argon2 reference source code package - reference C implementations
#
# Copyright 2015
# Daniel Dinu, Dmitry Khovratovich, Jean-Philippe Aumasson, and Samuel Neves
#
# You may use this work under the terms of a Creative Commons CC0 1.0
# License/Waiver or the Apache Public License 2.0, at your option. The terms of
# these licenses can be found at:
#
# - CC0 1.0 Universal : http://creativecommons.org/publicdomain/zero/1.0
# - Apache 2.0 : http://www.apache.org/licenses/LICENSE-2.0
#
# You should have received a copy of both of these licenses along with this
# software. If not, they may be obtained at the above URLs.
#
SRC_INC = argon2/include
SRC_DIR = argon2/src
SRC = $(SRC_DIR)/argon2.c $(SRC_DIR)/core.c $(SRC_DIR)/blake2/blake2b.c \
$(SRC_DIR)/thread.c $(SRC_DIR)/encoding.c c_src/argon2_nif.c
ERLANG_PATH = $(shell erl -eval 'io:format("~s", [lists:concat([code:root_dir(), "/erts-", erlang:system_info(version), "/include"])])' -s init stop -noshell)
CFLAGS += -std=c89 -pthread -O3 -Wall -g -I$(SRC_INC) -I$(SRC_DIR) -Ic_src -I$(ERLANG_PATH)
OPTTARGET ?= native
OPTTEST := $(shell $(CC) -I$(SRC_INC) -I$(SRC_DIR) -march=$(OPTTARGET) $(SRC_DIR)/opt.c -c \
-o /dev/null 2>/dev/null; echo $$?)
ifneq ($(OPTTEST), 0)
SRC += $(SRC_DIR)/ref.c
else
CFLAGS += -march=$(OPTTARGET)
SRC += $(SRC_DIR)/opt.c
endif
BUILD_PATH := $(shell pwd)
KERNEL_NAME := $(shell uname -s)
LIB_NAME = priv/argon2_nif
ifneq ($(CROSSCOMPILE),)
LIB_EXT := so
LIB_CFLAGS := -shared -fPIC -fvisibility=hidden -DA2_VISCTL=1
SO_LDFLAGS := -Wl,-soname,libargon2.so.0
else
ifeq ($(KERNEL_NAME), Linux)
LIB_EXT := so
LIB_CFLAGS := -shared -fPIC -fvisibility=hidden -DA2_VISCTL=1
SO_LDFLAGS := -Wl,-soname,libargon2.so.0
endif
ifeq ($(KERNEL_NAME), Darwin)
LIB_EXT := dylib
LIB_CFLAGS := -dynamiclib -install_name @rpath/lib$(LIB_NAME).$(LIB_EXT)
endif
ifeq ($(KERNEL_NAME), $(filter $(KERNEL_NAME),OpenBSD FreeBSD NetBSD))
LIB_EXT := so
LIB_CFLAGS := -shared -fPIC
endif
endif
LIB_SH := $(LIB_NAME).$(LIB_EXT)
all: $(LIB_SH)
$(LIB_SH): $(SRC)
mkdir -p priv
$(CC) $(CFLAGS) $(LIB_CFLAGS) $(LDFLAGS) $(SO_LDFLAGS) $^ -o $@
clean:
rm -f $(LIB_SH)
.PHONY: all clean