Revision 0e8a8e6d1f3f4304d66d3586fd3e4b130ce80e77 authored by Jonathan Protzenko on 11 June 2019, 18:38:57 UTC, committed by Jonathan Protzenko on 11 June 2019, 18:38:57 UTC
1 parent 8d88b79
Makefile
# This is the universal Makefile that will build any distribution of EverCrypt.
# - It is copied from hacl-star/providers/dist/Makefile
# - It relies on the KreMLin-generated Makefile.basic and Makefile.include
#
# This Makefile detects whether OpenSSL and BCrypt are enabled automatically. It
# does so by checking for the presence of EverCrypt_OpenSSL.h and
# EverCrypt_BCrypt.h ; as such, it assumes -bundle EverCrypt.OpenSSL and -bundle
# EverCrypt.BCrypt.
#
# This Makefile may (conservatively) link in some Vale assemblies that may end
# up un-needed in the final shared object.
#
# Additionally, this Makefile works out of the box on Linux, OSX and
# Cygwin/MinGW.
#
# The Makefile assumes KREMLIN_HOME and HACL_HOME to be suitably defined. When
# using OpenSSL, it also expects OPENSSL_HOME to be defined.
#
# The Makefile produces:
# - libevercrypt.so, a shared object where unused symbols have been removed
# - libevercrypt.a, a static archive that includes libhacl.a and libkremlib.a
# 1. The usual pseudo auto-configuration
UNAME = $(shell uname)
MARCH = x86_64
ifeq ($(UNAME),Darwin)
VARIANT = -darwin
SO = so
else ifeq ($(UNAME),Linux)
CFLAGS += -fPIC -fstack-check
VARIANT = -linux
SO = so
LDFLAGS += -Xlinker -z -Xlinker noexecstack -Xlinker --unresolved-symbols=report-all
else ifeq ($(OS),Windows_NT)
CFLAGS += -fno-asynchronous-unwind-tables
CC = $(MARCH)-w64-mingw32-gcc
AR = $(MARCH)-w64-mingw32-ar
VARIANT = -mingw
SO = dll
endif
# 2. Parameters we want to compile with, for the generated Makefile
# 3. Honor configurations
# Backwards-compat
ifneq (,$(MLCRYPTO_HOME))
OPENSSL_HOME = $(MLCRYPTO_HOME)/openssl
endif
# This is the "auto-detection". Since the parent Makefile runs with -bundle
# EverCrypt.OpenSSL, in case the static configuration doesn't call into
# OpenSSL, then EverCrypt_OpenSSL.h is not generated, meaning if the header
# doesn't exist we are not intend to compile against OpenSSL.
ifneq (,$(wildcard EverCrypt_OpenSSL.h))
CFLAGS += -I $(OPENSSL_HOME)/include
LDFLAGS += -L$(OPENSSL_HOME) -lcrypto
ifneq ($(OS),Windows_NT)
LDFLAGS += -ldl -lpthread
endif
SOURCES += evercrypt_openssl.c
endif
ifneq (,$(wildcard EverCrypt_BCrypt.h))
LDFLAGS += -lbcrypt
SOURCES += evercrypt_bcrypt.c
endif
OBJS += $(patsubst %.S,%.o,$(wildcard *-$(MARCH)$(VARIANT).S))
include Makefile.basic
CFLAGS += -Wno-parentheses -g -std=gnu11 -O3
Hacl_Poly1305_128.o: CFLAGS += -mavx
Hacl_Poly1305_256.o: CFLAGS += -mavx -mavx2
$(KREMLIB_A):
@echo "Please run make in the $(HACL_HOME)/code directory before invoking this Makefile" && false
KREMLIB_A = $(KREMLIN_HOME)/kremlib/dist/generic/libkremlib.a
all: libevercrypt.$(SO)
libevercrypt.$(SO): $(OBJS) $(KREMLIB_A)
$(CC) $(CFLAGS) -shared -o $@ $^ $(LDFLAGS)
![swh spinner](/static/img/swh-spinner.gif)
Computing file changes ...