imgboxer/Makefile
2024-09-21 19:32:31 -04:00

30 lines
845 B
Makefile

NAME = imgboxer
CXX = g++
CXXFLAGS = -Wall -std=c++11 `pkg-config --cflags opencv4`
LDFLAGS = `pkg-config --libs opencv4`
SRC_DIR = src
OBJ_DIR = obj
TARGET = $(NAME).out
SRC_FILES = $(wildcard $(SRC_DIR)/*.cpp)
OBJ_FILES = $(patsubst $(SRC_DIR)/%.cpp, $(OBJ_DIR)/%.o, $(SRC_FILES))
all: $(TARGET)
$(TARGET): $(OBJ_FILES)
@ echo -e "\x1b[32;1mLinking \x1b[0m\x1b[32m$(TARGET)\x1b[32;1m...\x1b[0m\x1b[37m $(CXX) -o $(TARGET) $(OBJ_FILES) $(LDFLAGS)\x1b[0m"
@ $(CXX) -o $(TARGET) $(OBJ_FILES) $(LDFLAGS)
$(OBJ_DIR)/%.o: $(SRC_DIR)/%.cpp $(SRC_DIR)/include/%.hpp
@ mkdir -p $(OBJ_DIR)
@ echo -e "\x1b[32;1mCompiling \x1b[0m\x1b[32m$<\x1b[32;1m... \x1b[0m\x1b[37m$(CXX) $(CXXFLAGS) -c $< -o $@\x1b[0m"
@ $(CXX) $(CXXFLAGS) -c $< -o $@
clean:
@ echo -e "\x1b[32;1mCleaning up...\x1b[0m"
@ rm -rf $(OBJ_DIR) $(TARGET)
.PHONY: all clean