a portable and fast pairing-based cryptography library
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
mcl/common.mk

65 lines
1.2 KiB

GCC_VER=$(shell $(PRE)$(CC) -dumpversion)
UNAME_S=$(shell uname -s)
ifeq ($(UNAME_S),Linux)
OS=Linux
endif
9 years ago
ARCH?=$(shell arch)
ifeq ($(ARCH),x86_64)
9 years ago
CPU=x86-64
9 years ago
BIT=64
BIT_OPT=-m64
LOW_ASM_SRC=src/asm/low_x86-64.asm
endif
9 years ago
ifeq ($(ARCH),x86)
CPU=x86
BIT=32
BIT_OPT=-m32
LOW_ASM_SRC=src/asm/low_x86.asm
endif
9 years ago
ifeq ($(ARCH),armv71)
CPU=armv71
BIT=32
LOW_ASM_SRC=src/asm/low_arm.s
9 years ago
endif
ifneq ($(UNAME_S),Darwin)
LDFLAGS+=-lrt
endif
CP=cp -f
AR=ar r
MKDIR=mkdir -p
RM=rm -rf
9 years ago
ifneq ($(DEBUG),1)
CFLAGS_OPT+=-fomit-frame-pointer -DNDEBUG
ifeq ($(CXX),clang++)
CFLAGS_OPT+=-O3
9 years ago
else
ifeq ($(shell expr $(GCC_VER) \> 4.6.0),1)
CFLAGS_OPT+=-Ofast
else
CFLAGS_OPT+=-O3
endif
endif
ifeq ($(MARCH),)
ifeq (x86,$(findstring x86,$(CPU)))
CFLAGS_OPT+=-march=native
endif
9 years ago
else
CFLAGS_OPT+=$(MARCH)
endif
endif
CFLAGS_WARN=-Wall -Wextra -Wformat=2 -Wcast-qual -Wcast-align -Wwrite-strings -Wfloat-equal -Wpointer-arith
CFLAGS+=-g3
INC_OPT=-I include -I test -I ../xbyak -I ../cybozulib/include
CFLAGS+=$(CFLAGS_WARN) $(BIT_OPT) $(INC_OPT) $(CFLAGS_USER)
DEBUG=0
ifeq ($(DEBUG),0)
CFLAGS+=$(CFLAGS_OPT)
endif
LDFLAGS+=-lgmp -lgmpxx -lcrypto $(BIT_OPT) $(LDFLAGS_USER)
CFLAGS+=-fPIC