-
Notifications
You must be signed in to change notification settings - Fork 15
/
Makefile
34 lines (25 loc) · 1.11 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
CFLAGS := $(CFLAGS) -O2 -ffast-math -fstrict-aliasing -fPIE
CXXFLAGS := $(CXXFLAGS) -std=c++14 -Wall
LDFLAGS := $(LDFLAGS)
DEPS := include/array/array.h include/array/ein_reduce.h include/array/image.h include/array/matrix.h include/array/z_order.h
TEST_SRC := $(filter-out test/errors.cpp, $(wildcard test/*.cpp))
TEST_OBJ := $(TEST_SRC:%.cpp=obj/%.o)
# Note that .cu files are automatically compiled by clang as CUDA.
# Other extensions will need "-x cuda".
CUDA_TEST_SRC := $(wildcard test/*.cu)
obj/%.o: %.cpp $(DEPS)
mkdir -p $(@D)
$(CXX) -Iinclude -c -o $@ $< $(CFLAGS) $(CXXFLAGS)
bin/test: $(TEST_OBJ)
mkdir -p $(@D)
$(CXX) -o $@ $^ $(LDFLAGS) -lstdc++ -lm
cuda_build_test: $(CUDA_TEST_SRC) $(DEPS)
$(CXX) -Iinclude -c $< $(CFLAGS) $(CXXFLAGS) --cuda-gpu-arch=sm_52 -nocudalib -nocudainc -emit-llvm
# TODO: Figure out how to run this build test to produce outputs in bin/ or obj/
rm *.bc
.PHONY: all clean test
clean:
rm -rf obj/* bin/*
test: bin/test
@! $(CXX) -Iinclude -c test/errors.cpp -std=c++14 -Wall -ferror-limit=0 2>&1 | grep "error:" | grep array.h && echo "Errors test success"
bin/test $(FILTER)