-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
29 lines (21 loc) · 715 Bytes
/
Makefile
File metadata and controls
29 lines (21 loc) · 715 Bytes
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
CC = g++
CFLAGS = -Wall -Wextra -I include -I /usr/local/include/opencv4/
BINDIR = bin
BUILDDIR = build
SRCDIR = src
SRCFILES = $(wildcard $(SRCDIR)/*.cpp)
OBJFILES = $(patsubst $(SRCDIR)/%.cpp, $(BUILDDIR)/%.o, $(SRCFILES))
OPENCV_LIBS = -L/usr/local/lib -lopencv_core -lopencv_imgproc -lopencv_highgui -lopencv_imgcodecs -lopencv_objdetect
TARGET = $(BINDIR)/main
all: $(TARGET)
# Compile source files to object files
$(BUILDDIR)/%.o: $(SRCDIR)/%.cpp
@mkdir -p $(BUILDDIR)
$(CC) $(CFLAGS) -c $< -o $@
# Link object files to create final executable
$(TARGET): $(OBJFILES)
@mkdir -p $(BINDIR)
$(CC) $(OBJFILES) -o $(TARGET) $(OPENCV_LIBS) -pthread
clean:
rm -rf $(BINDIR) $(BUILDDIR)
.PHONY: all clean