forked from JeanLucPons/Kangaroo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
104 lines (78 loc) · 2.9 KB
/
Makefile
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
#---------------------------------------------------------------------
# Makefile for BSGS
#
# Author : Jean-Luc PONS
ifdef gpu
SRC = SECPK1/IntGroup.cpp main.cpp SECPK1/Random.cpp \
Timer.cpp SECPK1/Int.cpp SECPK1/IntMod.cpp \
SECPK1/Point.cpp SECPK1/SECP256K1.cpp \
GPU/GPUEngine.o Kangaroo.cpp HashTable.cpp \
Backup.cpp Thread.cpp Check.cpp Network.cpp Merge.cpp PartMerge.cpp
OBJDIR = obj
OBJET = $(addprefix $(OBJDIR)/, \
SECPK1/IntGroup.o main.o SECPK1/Random.o \
Timer.o SECPK1/Int.o SECPK1/IntMod.o \
SECPK1/Point.o SECPK1/SECP256K1.o \
GPU/GPUEngine.o Kangaroo.o HashTable.o Thread.o \
Backup.o Check.o Network.o Merge.o PartMerge.o)
else
SRC = SECPK1/IntGroup.cpp main.cpp SECPK1/Random.cpp \
Timer.cpp SECPK1/Int.cpp SECPK1/IntMod.cpp \
SECPK1/Point.cpp SECPK1/SECP256K1.cpp \
Kangaroo.cpp HashTable.cpp Thread.cpp Check.cpp \
Backup.cpp Network.cpp Merge.cpp PartMerge.cpp
OBJDIR = obj
OBJET = $(addprefix $(OBJDIR)/, \
SECPK1/IntGroup.o main.o SECPK1/Random.o \
Timer.o SECPK1/Int.o SECPK1/IntMod.o \
SECPK1/Point.o SECPK1/SECP256K1.o \
Kangaroo.o HashTable.o Thread.o Check.o Backup.o \
Network.o Merge.o PartMerge.o)
endif
CXX = g++
CUDA = /usr/local/cuda-8.0
CXXCUDA = /usr/bin/g++-4.8
NVCC = $(CUDA)/bin/nvcc
ifdef gpu
ifdef debug
CXXFLAGS = -DWITHGPU -m64 -mssse3 -Wno-unused-result -Wno-write-strings -g -I. -I$(CUDA)/include
else
CXXFLAGS = -DWITHGPU -m64 -mssse3 -Wno-unused-result -Wno-write-strings -O2 -I. -I$(CUDA)/include
endif
LFLAGS = -lpthread -L$(CUDA)/lib64 -lcudart
else
ifdef debug
CXXFLAGS = -m64 -mssse3 -Wno-unused-result -Wno-write-strings -g -I. -I$(CUDA)/include
else
CXXFLAGS = -m64 -mssse3 -Wno-unused-result -Wno-write-strings -O2 -I. -I$(CUDA)/include
endif
LFLAGS = -lpthread
endif
#--------------------------------------------------------------------
ifdef gpu
ifdef debug
$(OBJDIR)/GPU/GPUEngine.o: GPU/GPUEngine.cu
$(NVCC) -G -maxrregcount=0 --ptxas-options=-v --compile --compiler-options -fPIC -ccbin $(CXXCUDA) -m64 -g -I$(CUDA)/include -gencode=arch=compute_$(ccap),code=sm_$(ccap) -o $(OBJDIR)/GPU/GPUEngine.o -c GPU/GPUEngine.cu
else
$(OBJDIR)/GPU/GPUEngine.o: GPU/GPUEngine.cu
$(NVCC) -maxrregcount=0 --ptxas-options=-v --compile --compiler-options -fPIC -ccbin $(CXXCUDA) -m64 -O2 -I$(CUDA)/include -gencode=arch=compute_$(ccap),code=sm_$(ccap) -o $(OBJDIR)/GPU/GPUEngine.o -c GPU/GPUEngine.cu
endif
endif
$(OBJDIR)/%.o : %.cpp
$(CXX) $(CXXFLAGS) -o $@ -c $<
all: bsgs
bsgs: $(OBJET)
@echo Making Kangaroo...
$(CXX) $(OBJET) $(LFLAGS) -o kangaroo
$(OBJET): | $(OBJDIR) $(OBJDIR)/SECPK1 $(OBJDIR)/GPU
$(OBJDIR):
mkdir -p $(OBJDIR)
$(OBJDIR)/GPU: $(OBJDIR)
cd $(OBJDIR) && mkdir -p GPU
$(OBJDIR)/SECPK1: $(OBJDIR)
cd $(OBJDIR) && mkdir -p SECPK1
clean:
@echo Cleaning...
@rm -f obj/*.o
@rm -f obj/GPU/*.o
@rm -f obj/SECPK1/*.o