aboutsummaryrefslogtreecommitdiff
path: root/aberth/Makefile
blob: c9e9f7a029669e4962005774add3ed9ddde4c7a3 (plain)
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
CXX = g++
CXXFLAGS = -Wall -Wextra -std=c++17 $(OPTFLAGS)
OPTFLAGS = -O3 -ffast-math -march=native -flto
LDFLAGS = -pthread
ifeq ($(shell uname),Darwin)
	LDFLAGS += -framework OpenCL
else
	LDFLAGS += -lOpenCL
endif

TARGETS = aberth

OBJECTS = $(patsubst %.cpp,%.o,$(wildcard *.cpp))

.PHONY: all clean remake

all: $(TARGETS)

clean:
	rm -f $(TARGETS) *.o aberth_kernel.h aberth_kernel.c

remake: clean
	$(MAKE) all


aberth: $(OBJECTS) aberth_kernel.o ../lodepng.o
	$(CXX) $(CXXFLAGS) -o $@ $^ $(LDFLAGS)

aberth_kernel.h: aberth_kernel.fut
	futhark opencl --library $^

aberth_kernel.o: aberth_kernel.h
	gcc -c $(OPTFLAGS) -o $@ aberth_kernel.c

$(OBJECTS): %.o: %.cpp $(wildcard *.h) aberth_kernel.h
	$(CXX) $(CXXFLAGS) -c -o $@ $<