-
Notifications
You must be signed in to change notification settings - Fork 3
/
Makefile
64 lines (50 loc) · 1.67 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
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
THE_OS := $(shell uname -s)
default:
@echo "Detected OS: ${THE_OS}"
$(MAKE) CC=gcc CXX=g++ \
CXXFLAGS='$(CXXFLAGS) -Wall -Wextra -Wno-ignored-attributes -pipe -O3 -g -ffast-math -flto -march=native -std=c++14 ' \
LDFLAGS='$(LDFLAGS) -flto -g' hgemmtest
debug:
@echo "Detected OS: ${THE_OS}"
$(MAKE) CC=gcc CXX=g++ \
CXXFLAGS='$(CXXFLAGS) -Wall -Wextra -Wno-ignored-attributes -pipe -Og -g -std=c++14' \
LDFLAGS='$(LDFLAGS) -g' \
hgemmtest
clang:
@echo "Detected OS: ${THE_OS}"
$(MAKE) CC=clang CXX=clang++ \
CXXFLAGS='$(CXXFLAGS) -Wall -Wextra -Wno-missing-braces -Wno-mismatched-tags -O3 -ffast-math -flto -march=native -std=c++14 -DNDEBUG' \
LDFLAGS='$(LDFLAGS) -flto -fuse-linker-plugin' \
hgemmtest
DYNAMIC_LIBS = -lboost_system -lboost_filesystem -lboost_program_options -lpthread -lz
LIBS =
ifeq ($(THE_OS),Linux)
# for Linux with OpenBLAS
CXXFLAGS += -I/usr/include/openblas -I./Eigen
DYNAMIC_LIBS += -lopenblas
DYNAMIC_LIBS += -lOpenCL
endif
ifeq ($(THE_OS),Darwin)
# for macOS (comment out the Linux part)
LIBS += -framework Accelerate
LIBS += -framework OpenCL
CXXFLAGS += -I./Eigen
CXXFLAGS += -I/System/Library/Frameworks/Accelerate.framework/Versions/Current/Headers
endif
# for MKL instead of OpenBLAS
#DYNAMIC_LIBS += -lmkl_rt
#CXXFLAGS += -I/opt/intel/mkl/include
#LDFLAGS += -L/opt/intel/mkl/lib/intel64/
CXXFLAGS += -I.
CPPFLAGS += -MD -MP
sources = hgemmtest.cpp
objects = $(sources:.cpp=.o)
deps = $(sources:%.cpp=%.d)
-include $(deps)
%.o: %.cpp
$(CXX) $(CXXFLAGS) $(CPPFLAGS) -c -o $@ $<
hgemmtest: $(objects)
$(CXX) $(LDFLAGS) -o $@ $^ $(LIBS) $(DYNAMIC_LIBS)
clean:
-$(RM) hgemmtest $(objects) $(deps)
.PHONY: clean default debug clang