Files
nextcloud-samba-sync/Makefile

32 lines
620 B
Makefile

# Compiler and flags
CXX := g++
CXXFLAGS := -std=c++17 -Wall -Wextra -O2
# Directories
SRC_DIR := src
OBJ_DIR := obj
BUILD_DIR := .
TARGET := $(BUILD_DIR)/ncsambawatcher
# Create list of source and object files
SRCS := $(wildcard $(SRC_DIR)/*.cpp)
OBJS := $(SRCS:$(SRC_DIR)/%.cpp=$(OBJ_DIR)/%.o)
# Default target
all: $(TARGET)
# Link object files into final binary
$(TARGET): $(OBJS)
$(CXX) $(CXXFLAGS) -o $@ $^
# Compile .cpp to .o into obj/
$(OBJ_DIR)/%.o: $(SRC_DIR)/%.cpp
@mkdir -p $(OBJ_DIR)
$(CXX) $(CXXFLAGS) -c $< -o $@
# Clean build artifacts
clean:
rm -f $(OBJ_DIR)/*.o $(TARGET)
.PHONY: all clean