aoc-2025/05/Makefile

36 lines
No EOL
679 B
Makefile

# Compiler
CXX = g++
# Compiler flags
CXXFLAGS = -Wall -g
# Target executable
TARGET = ./main
# For deleting the target
TARGET_DEL = ./main
# Source files
SRCS = src/main.cpp src/produce_database.cpp src/read_input.cpp src/merge_sort.cpp
# Object files
OBJS = $(SRCS:.cpp=.o)
# Default rule to build and run the executable
all: $(TARGET) run
# Rule to link object files into the target executable
$(TARGET): $(OBJS)
$(CXX) $(CXXFLAGS) -o $(TARGET) $(OBJS)
# Rule to compile .cpp files into .o files
%.o: %.cpp
$(CXX) $(CXXFLAGS) -c $< -o $@
# Rule to run the executable
run: $(TARGET)
$(TARGET)
# Clean rule to remove generated files
clean:
rm $(TARGET_DEL) $(OBJS)