Skip to content

Commit 9c68e5b

Browse files
author
cherubrock-seb
committed
Release prmers
1 parent 9e930d7 commit 9c68e5b

1 file changed

Lines changed: 20 additions & 8 deletions

File tree

Makefile

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,33 @@
11
# Installation path
22
PREFIX ?= /usr/local
3+
TARGET = prmers
34
KERNEL_PATH ?= $(PREFIX)/share/$(TARGET)/
45

5-
# Compiler and compilation options
6+
# Source and kernel files
7+
SRC = prmers.cpp proof/common.cpp proof/proof.cpp proof/md5.cpp proof/sha3.cpp
8+
KERNELS = prmers.cl
9+
10+
# Compiler
611
CXX = g++
12+
13+
# Default flags
714
CXXFLAGS = -std=c++20 -O3 -Wall
8-
LDFLAGS = -lOpenCL
915

10-
# Target executable and source/kernel files
11-
TARGET = prmers
12-
SRC = prmers.cpp proof/common.cpp proof/proof.cpp proof/md5.cpp proof/sha3.cpp
13-
KERNELS = prmers.cl prmers_vload2.cl
16+
# Platform-specific OpenCL flags
17+
UNAME_S := $(shell uname -s)
18+
19+
ifeq ($(UNAME_S),Darwin) # macOS
20+
OPENCL_CFLAGS = -I/System/Library/Frameworks/OpenCL.framework/Headers
21+
OPENCL_LDFLAGS = -framework OpenCL
22+
else
23+
OPENCL_CFLAGS =
24+
OPENCL_LDFLAGS = -lOpenCL
25+
endif
1426

1527
all: $(TARGET)
1628

1729
$(TARGET): $(SRC)
18-
$(CXX) $(CXXFLAGS) -DKERNEL_PATH="\"$(KERNEL_PATH)\"" -o $(TARGET) $(SRC) $(LDFLAGS)
30+
$(CXX) $(CXXFLAGS) $(OPENCL_CFLAGS) -DKERNEL_PATH="\"$(KERNEL_PATH)\"" -o $(TARGET) $(SRC) $(OPENCL_LDFLAGS)
1931

2032
install: $(TARGET)
2133
@echo "Installing $(TARGET)..."
@@ -35,4 +47,4 @@ uninstall:
3547
clean:
3648
rm -f $(TARGET)
3749

38-
.PHONY: all install uninstall clean
50+
.PHONY: all install uninstall clean

0 commit comments

Comments
 (0)