Files
algo2025/sort_closet/code-sorting/Makefile
2025-12-18 16:00:22 +08:00

37 lines
637 B
Makefile

# Compiler and flags
CXX := g++
CXXFLAGS := -std=c++11 -Wall -O2
# Executable name
TARGET := sorting_experiment
# Source files
# Automatically find all .cpp files in the current directory
SRCS := $(wildcard *.cpp)
# Object files
# Replace .cpp extension with .o
OBJS := $(SRCS:.cpp=.o)
# Default target
all: $(TARGET)
# Link the program
$(TARGET): $(OBJS)
$(CXX) $(CXXFLAGS) -o $(TARGET) $(OBJS)
# Compile source files into object files
%.o: %.cpp
$(CXX) $(CXXFLAGS) -c $< -o $@
# Target to run the experiment
run: all
@./$(TARGET)
# Clean up build files
clean:
rm -f $(TARGET) $(OBJS)
# Phony targets
.PHONY: all clean run