-
Notifications
You must be signed in to change notification settings - Fork 8
/
Makefile
41 lines (33 loc) · 1.09 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
OPENCV := 0
ifeq ($(OPENCV), 1)
OPENCVOP = -DOPENCV `pkg-config --cflags opencv4` -Wno-deprecated-enum-enum-conversion
OPENCVLOP = `pkg-config --libs opencv4`
else
OPENCVOP =
OPENCVLOP =
endif
OP = -DPARALLEL
CXX = g++
CXXFLAGS = -std=c++20 -Wall -Wextra -fmax-errors=1 -Ofast -flto=auto -funroll-all-loops -pipe -march=native $(OP) $(OPENCVOP)
LFLAGS = -Ofast $(OPENCVLOP) -pthread -lstdc++fs -Wl,--gc-sections -flto
LINK = $(CXX)
####### Output directory
OBJECTS_DIR = .
BIN_DIR = .
LIB_DIR = .
LOG_DIR = .
all: test example
test: tests/test.cc ./matrix.hpp
$(CXX) -c $(CXXFLAGS) -o $(OBJECTS_DIR)/test.o tests/test.cc
$(LINK) -o $(BIN_DIR)/test_test $(OBJECTS_DIR)/test.o $(LFLAGS)
example: examples/example.cc ./matrix.hpp
$(CXX) -c $(CXXFLAGS) -o $(OBJECTS_DIR)/example.o examples/example.cc
$(LINK) -o $(BIN_DIR)/test_example $(OBJECTS_DIR)/example.o $(LFLAGS)
.PHONY: clean clean_obj clean_test clean_example
clean: clean_obj clean_test clean_example
clean_obj:
rm ./*.o
clean_test:
rm ./test_test
clean_example:
rm ./test_example