-
Notifications
You must be signed in to change notification settings - Fork 85
Expand file tree
/
Copy pathMakefile.vdf-client
More file actions
92 lines (70 loc) · 2.58 KB
/
Makefile.vdf-client
File metadata and controls
92 lines (70 loc) · 2.58 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
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
UNAME := $(shell uname)
ifneq (,$(findstring clang, $(shell $(CXX) --version)))
NOPIE = -fno-PIE
else
NOPIE = -no-pie
endif
LDFLAGS += -flto $(NOPIE) -g
LDLIBS += -lgmpxx -lgmp -pthread
CXXFLAGS += -flto -std=c++1z -D VDF_MODE=0 -D FAST_MACHINE=1 -pthread $(NOPIE) -fvisibility=hidden
ifeq ($(UNAME),Darwin)
CXXFLAGS += -D CHIAOSX=1
# Homebrew (common on macOS) installs boost/gmp to /opt/homebrew or /usr/local
ifneq ($(wildcard /opt/homebrew/include/boost/asio.hpp),)
CXXFLAGS += -I/opt/homebrew/include
LDFLAGS += -L/opt/homebrew/lib
endif
ifneq ($(wildcard /usr/local/include/boost/asio.hpp),)
CXXFLAGS += -I/usr/local/include
LDFLAGS += -L/usr/local/lib
endif
endif
OPT_CFLAGS = -O3 -g
ifneq ($(ASAN),)
LDFLAGS += -fsanitize=address -fsanitize=undefined
CXXFLAGS += -g -fsanitize=address -fsanitize=undefined -fsanitize-undefined-trap-on-error
endif
ifneq ($(TSAN),)
LDFLAGS += -fsanitize=thread
CXXFLAGS += -g -fsanitize=thread
endif
.PHONY: all clean
ARCH := $(shell uname -m)
# aarch64 (Linux), arm64 (macOS Apple Silicon)
ifneq ($(filter $(ARCH),aarch64 arm64),)
# ARM: use C++ fallback for GCD (no x86 assembly); implementation is in each BIN via .inc
ASM_OBJS =
CXXFLAGS += -D ARCH_ARM
else
# x86: use hand-tuned assembly
ASM_OBJS = asm_compiled.o avx2_asm_compiled.o avx512_asm_compiled.o
endif
BINS = vdf_client prover_test 1weso_test 2weso_test vdf_bench
all: $(BINS)
clean:
rm -f *.o hw/*.o $(BINS) compile_asm emu_hw_test hw_test hw_vdf_client emu_hw_vdf_client
$(BINS) avx512_test: %: %.o lzcnt.o $(ASM_OBJS)
$(CXX) $(LDFLAGS) -o $@ $^ $(LDLIBS)
$(addsuffix .o,$(BINS)) avx512_test.o: CXXFLAGS += $(OPT_CFLAGS)
lzcnt.o: refcode/lzcnt.c
$(CC) -c refcode/lzcnt.c
asm_compiled.s: compile_asm
./compile_asm
avx2_asm_compiled.s: compile_asm
./compile_asm avx2
avx512_asm_compiled.s: compile_asm
./compile_asm avx512
compile_asm: compile_asm.o
$(CXX) $(LDFLAGS) -o $@ $^ $(LDLIBS)
HW_OBJS = $(addprefix hw/,hw_util.o hw_proof.o hw_interface.o chia_driver.o ftdi_driver.o vdf_driver.o pll_freqs.o) vdf_base.o lzcnt.o
EMU_OBJS = hw/emu_funcs.o hw/emu_runner.o
HW_LIB = hw/libft4222/build-x86_64/libft4222.so
hw_test: hw/hw_test.o $(HW_OBJS) $(HW_LIB) hw/real_hw.o
$(CXX) $(LDFLAGS) -o $@ $^ $(LDLIBS)
emu_hw_test: hw/hw_test.o $(HW_OBJS) $(EMU_OBJS)
$(CXX) $(LDFLAGS) -o $@ $^ $(LDLIBS)
hw_vdf_client: hw/hw_vdf_client.o $(HW_OBJS) $(HW_LIB) hw/real_hw.o
$(CXX) $(LDFLAGS) -o $@ $^ $(LDLIBS)
emu_hw_vdf_client: hw/hw_vdf_client.o $(HW_OBJS) $(EMU_OBJS)
$(CXX) $(LDFLAGS) -o $@ $^ $(LDLIBS)
hw/hw_test.o hw/hw_vdf_client.o $(HW_OBJS) $(EMU_OBJS): CXXFLAGS += -I. -Ihw -Ihw/libft4222 $(OPT_CFLAGS) -Wall