Untitled

mail@pastecode.io avatar
unknown
plain_text
2 months ago
811 B
1
Indexable
Never
# Compiler
CXX := g++

# Compiler flags
CXXFLAGS := -std=c++11 -Wall

# Directories
SRCDIR := src
OBJDIR := obj
BINDIR := bin

# Libraries
LIBS := $(shell pkg-config --libs opencv4) $(shell pkg-config --libs portaudio-2.0)

# Includes
INCLUDES := $(shell pkg-config --cflags opencv4) $(shell pkg-config --cflags portaudio-2.0)

# Source files
SRCS := $(wildcard $(SRCDIR)/*.cpp) $(wildcard $(SRCDIR)/*/*.cpp)
OBJS := $(patsubst $(SRCDIR)/%.cpp,$(OBJDIR)/%.o,$(SRCS))

# Main executable
MAIN := main

.PHONY: all clean

all: $(BINDIR)/$(MAIN)

$(BINDIR)/$(MAIN): $(OBJS)
	@mkdir -p $(BINDIR)
	$(CXX) $(CXXFLAGS) $(INCLUDES) -o $@ $^ $(LIBS)

$(OBJDIR)/%.o: $(SRCDIR)/%.cpp
	@mkdir -p $(OBJDIR)
	$(CXX) $(CXXFLAGS) $(INCLUDES) -c -o $@ $<

clean:
	rm -rf $(OBJDIR) $(BINDIR)
Leave a Comment