-
-
Notifications
You must be signed in to change notification settings - Fork 172
Expand file tree
/
Copy pathmakefile.win
More file actions
65 lines (48 loc) · 1.81 KB
/
Copy pathmakefile.win
File metadata and controls
65 lines (48 loc) · 1.81 KB
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
# this Makefile is for a cross compile win64 dll on Linux
PRE=x86_64-w64-mingw32-
CFLAGS=-std=c++03 -O2 -DNDEBUG -fPIC # -fno-stack-protector -fno-threadsafe-statics
CFLAGS+=-Wall -Wextra -Wformat=2 -Wcast-qual -Wcast-align -Wwrite-strings -Wfloat-equal -Wpointer-arith -Wundef
CFLAGS+=-I ./include -I ./src
CFLAGS+=-DMCL_FP_BIT=384 -DMCL_FR_BIT=256
CFLAGS+=-DCYBOZU_DONT_USE_STRING -DCYBOZU_DONT_USE_EXCEPTION
# for dll
#CFLAGS+=-DMCL_DLL_EXPORT
DLL?=0
ifeq ($(DLL),0) # lib
TARGET+=lib/mcl.lib
LIB_OBJ=obj/fp.obj obj/msm_avx.obj obj/bint-x64.obj
else
TARGET+=bin/mclbn.dll
LIB_OBJ=obj/fpbn.obj obj/msm_avxbn.obj obj/bint-x64.obj
endif
VPATH=src test
.SUFFIXES: .cpp .exe .o
all: $(TARGET) bin/bn_c384_256_test.exe
src/bint-x64.asm: src/gen_bint_x64.py
python3 src/gen_bint_x64.py -win -m nasm > $@
obj/bint-x64.obj: src/bint-x64.asm
nasm -f win64 -o $@ $<
obj/%.obj: %.cpp
$(PRE)$(CXX) $(CFLAGS) -c $< -o $@
# lib
obj/msm_avx.obj: msm_avx.cpp
$(PRE)$(CXX) $(CFLAGS) -c $< -o $@ -mavx512f -mavx512ifma -std=c++11
lib/mcl.lib: $(LIB_OBJ)
$(PRE)$(AR) $(ARFLAGS) $@ $(LIB_OBJ)
bin/bn_c384_256_test.exe: obj/bn_c384_256_test.obj lib/mcl.lib
$(PRE)$(CXX) -o $@ obj/bn_c384_256_test.obj lib/mcl.lib -static -static-libgcc -static-libstdc++ #-Wl,-Bstatic
# dll
obj/fpbn.obj: fp.cpp
$(PRE)$(CXX) $(CFLAGS) -c $< -o $@
obj/msm_avxbn.obj: msm_avx.cpp
$(PRE)$(CXX) $(CFLAGS) -c $< -o $@ -mavx512f -mavx512ifma -std=c++11
lib/mclbn.lib: $(LIB_OBJ)
$(PRE)dlltool -l $@ -D mclbn.dll $(LIB_OBJ)
bin/mclbn.dll: lib/mclbn.lib
$(PRE)$(CXX) -shared -o $@ $(LIB_OBJ)
#bin/bn_c384_256_test.exe: obj/bn_c384_256_test.obj lib/mclbn.lib
# $(PRE)$(CXX) -static -static-libgcc -static-libstdc++ -o $@ obj/bn_c384_256_test.obj lib/mclbn.lib
#test: bin/bn_c384_256_test.exe bin/$(DLL_NAME).dll
# wine $<
clean:
$(RM) bin/*.dll lib/*.lib bin/*.exe obj/*.obj