-
-
Notifications
You must be signed in to change notification settings - Fork 155
/
makefile.win
47 lines (34 loc) · 1.52 KB
/
makefile.win
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
# 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_MAX_BIT_SIZE=384
CFLAGS+=-DCYBOZU_DONT_USE_STRING -DCYBOZU_DONT_USE_EXCEPTION
# for dll
CFLAGS+=-DMCL_NO_AUTOLINK -DMCLBN_NO_AUTOLINK -DMCL_DLL_EXPORT
VPATH=src test
.SUFFIXES: .cpp .exe .o
DLL_NAME=mclbn384_256
all: bin/$(DLL_NAME).dll lib/mcl.lib bin/bn_c384_256_test.exe
DLL_OBJS=obj/bn_c384_256.obj
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/mcl.lib: obj/fp.obj obj/bint-x64.obj
$(PRE)$(AR) $(ARFLAGS) $@ obj/fp.obj obj/bint-x64.obj
lib/$(DLL_NAME).lib: $(DLL_OBJS)
$(PRE)dlltool -l $@ -D $(DLL_NAME).dll $(DLL_OBJS)
bin/$(DLL_NAME).dll: lib/$(DLL_NAME).lib lib/mcl.lib
$(PRE)$(CXX) -shared -o $@ $(DLL_OBJS) lib/mcl.lib
bin/bn_c384_256_test_single.exe: obj/bn_c384_256_test.obj $(DLL_OBJS) lib/mcl.lib
$(PRE)$(CXX) -o $@ obj/bn_c384_256_test.obj $(DLL_OBJS) -static -lstdc++
bin/bn_c384_256_test.exe: obj/bn_c384_256_test.obj lib/$(DLL_NAME).lib lib/mcl.lib
$(PRE)$(CXX) -o $@ obj/bn_c384_256_test.obj lib/$(DLL_NAME).lib lib/mcl.lib
#test: bin/bn_c384_256_test.exe bin/$(DLL_NAME).dll
# wine $<
clean:
$(RM) bin/*.dll lib/*.lib bin/*.exe obj/*.obj