-
Notifications
You must be signed in to change notification settings - Fork 51
Expand file tree
/
Copy pathMakefile
More file actions
108 lines (73 loc) · 2.85 KB
/
Makefile
File metadata and controls
108 lines (73 loc) · 2.85 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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
# Use "make DEBUG=1" for a debug build
# The build artifacts are put in the "build-release" subfolder (or "build-debug" for a debug build).
# On Windows invoke with "make exe" or "make all"
# Uncomment below as desired to set a particular compiler or force a debug build:
# CXX = g++-12
# DEBUG = 1
# or export those into environment, or pass on the command line e.g.
# make all DEBUG=1 CXX=g++-12
HOST_OS = $(shell uname -s)
ifeq ($(HOST_OS), Darwin)
# Real GCC (not clang), needed for 128-bit floats and std::filesystem::path
CXX = g++-14
else
CXX = g++
endif
ifneq ($(findstring MINGW, $(HOST_OS)), MINGW)
COMMON_FLAGS = -Wall -std=c++20 -static-libstdc++ -static-libgcc
else
# For mingw-64 use this:
COMMON_FLAGS = -Wall -std=c++20 -static-libstdc++ -static-libgcc -static
endif
# -fext-numeric-literals
ifeq ($(HOST_OS), Darwin)
OPENCL_LIBS = -framework OpenCL
else
OPENCL_LIBS = -lOpenCL
endif
ifeq ($(DEBUG), 1)
BIN=build-debug
CXXFLAGS = -g $(COMMON_FLAGS)
STRIP=
else
BIN=build-release
CXXFLAGS = -O2 -DNDEBUG $(COMMON_FLAGS)
STRIP=-s
endif
SRCS1 = fs.cpp Trig.cpp TuneEntry.cpp Primes.cpp tune.cpp CycleFile.cpp TrigBufCache.cpp Event.cpp Queue.cpp TimeInfo.cpp Profile.cpp bundle.cpp Saver.cpp KernelCompiler.cpp Kernel.cpp gpuid.cpp File.cpp Proof.cpp log.cpp Worktodo.cpp common.cpp main.cpp Gpu.cpp clwrap.cpp Task.cpp timeutil.cpp Args.cpp state.cpp Signal.cpp FFTConfig.cpp AllocTrac.cpp sha3.cpp md5.cpp version.cpp
SRCS2 = test.cpp
# SRCS=$(addprefix src/, $(SRCS1))
OBJS = $(SRCS1:%.cpp=$(BIN)/%.o)
DEPDIR := $(BIN)/.d
$(shell mkdir -p $(DEPDIR) >/dev/null)
DEPFLAGS = -MT $@ -MMD -MP -MF $(DEPDIR)/$*.Td
COMPILE.cc = $(CXX) $(DEPFLAGS) $(CXXFLAGS) $(CPPFLAGS) $(TARGET_ARCH) -c
POSTCOMPILE = @mv -f $(DEPDIR)/$*.Td $(DEPDIR)/$*.d && touch $@
all: prpll
prpll: $(BIN)/prpll
amd: $(BIN)/prpll-amd
#$(BIN)/test: $(BIN)/test.o
# $(CXX) $(CXXFLAGS) -o $@ $< $(LIBPATH) ${STRIP}
$(BIN)/prpll: ${OBJS}
$(CXX) $(CXXFLAGS) -o $@ ${OBJS} $(LIBPATH) $(OPENCL_LIBS) ${STRIP}
# Instead of linking with libOpenCL, link with libamdocl64
$(BIN)/prpll-amd: ${OBJS}
$(CXX) $(CXXFLAGS) -o $@ ${OBJS} $(LIBPATH) -lamdocl64 -L/opt/rocm/lib ${STRIP}
clean:
rm -rf build-debug build-release
$(BIN)/%.o : src/%.cpp $(DEPDIR)/%.d
$(COMPILE.cc) $(OUTPUT_OPTION) $<
$(POSTCOMPILE)
# src/bundle.cpp is just a wrapping of the OpenCL sources (*.cl) as a C string.
src/bundle.cpp: genbundle.sh src/cl/*.cl
./genbundle.sh $^ > src/bundle.cpp
$(DEPDIR)/%.d: ;
.PRECIOUS: $(DEPDIR)/%.d
src/version.cpp : src/version.inc
src/version.inc: FORCE
echo \"`basename \`git describe --tags --long --dirty --always --match v/prpll/*\``\" > $(BIN)/version.new
diff -q -N $(BIN)/version.new $@ >/dev/null || mv $(BIN)/version.new $@
echo Version: `cat $@`
FORCE:
include $(wildcard $(patsubst %,$(DEPDIR)/%.d,$(basename $(SRCS1))))
# include $(wildcard $(patsubst %,$(DEPDIR)/%.d,$(basename $(SRCS2))))