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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
|
GCC_VER=$(shell $(PRE)$(CC) -dumpversion)
UNAME_S=$(shell uname -s)
ifeq ($(UNAME_S),Linux)
OS=Linux
endif
ifeq ($(UNAME_S),Darwin)
OS=mac
ARCH=x86_64
LIB_SUF=dylib
CFLAGS+=-I/usr/local/opt/openssl/include
LDFLAGS+=-L/usr/local/opt/openssl/lib
else
LIB_SUF=so
endif
ARCH?=$(shell uname -m)
DO_IT=0
ifeq ($(ARCH),x86_64)
DO_IT=1
endif
ifeq ($(ARCH),amd64)
DO_IT=1
endif
ifeq ($(DO_IT),1)
CPU=x86-64
INTEL=1
BIT=64
BIT_OPT=-m64
#LOW_ASM_SRC=src/asm/low_x86-64.asm
#ASM=nasm -felf64
endif
ifeq ($(ARCH),x86)
CPU=x86
INTEL=1
BIT=32
BIT_OPT=-m32
#LOW_ASM_SRC=src/asm/low_x86.asm
endif
ifeq ($(ARCH),armv7l)
CPU=arm
BIT=32
#LOW_ASM_SRC=src/asm/low_arm.s
endif
ifeq ($(ARCH),aarch64)
CPU=aarch64
BIT=64
endif
ifneq ($(UNAME_S),Darwin)
LDFLAGS+=-lrt
endif
CP=cp -f
AR=ar r
MKDIR=mkdir -p
RM=rm -rf
ifeq ($(DEBUG),1)
ifeq ($(INTEL),1)
CFLAGS+=-fsanitize=address
LDFLAGS+=-fsanitize=address
endif
else
CFLAGS_OPT+=-fomit-frame-pointer -DNDEBUG
ifeq ($(CXX),clang++)
CFLAGS_OPT+=-O3
else
ifeq ($(shell expr $(GCC_VER) \> 4.6.0),1)
CFLAGS_OPT+=-Ofast
else
CFLAGS_OPT+=-O3
endif
endif
ifeq ($(MARCH),)
ifeq ($(INTEL),1)
CFLAGS_OPT+=-march=native
endif
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
CFLAGS_OPT_USER?=$(CFLAGS_OPT)
ifeq ($(DEBUG),0)
CFLAGS+=$(CFLAGS_OPT_USER)
endif
MCL_USE_GMP?=1
MCL_USE_OPENSSL?=1
ifeq ($(MCL_USE_GMP),0)
CFLAGS+=-DMCL_USE_VINT
endif
ifneq ($(MCL_SIZEOF_UNIT),)
CFLAGS+=-DMCL_SIZEOF_UNIT=$(MCL_SIZEOF_UNIT)
endif
ifeq ($(MCL_USE_OPENSSL),0)
CFLAGS+=-DMCL_DONT_USE_OPENSSL
endif
ifeq ($(MCL_USE_GMP),1)
GMP_LIB=-lgmp -lgmpxx
endif
ifeq ($(MCL_USE_OPENSSL),1)
OPENSSL_LIB=-lcrypto
endif
LDFLAGS+=$(GMP_LIB) $(OPENSSL_LIB) $(BIT_OPT) $(LDFLAGS_USER)
CFLAGS+=-fPIC
|