Files
trivial_c_plus/Makefile
2026-05-06 23:47:46 -04:00

27 lines
493 B
Makefile

# Compiler and flags
CXX = g++
CXXFLAGS = -std=c++17 -Wall -g
LIBS = -lncurses -lm
# Source files
TRIVIAL_SRC = main.cpp $(wildcard src/*.cpp) $(wildcard src/network/*.cpp)
# Object files in build/
TRIVIAL_OBJ = $(patsubst %.cpp,build/%.o,$(TRIVIAL_SRC))
# Default target
all: trivial
# Link
trivial: $(TRIVIAL_OBJ)
$(CXX) $(CXXFLAGS) -o $@ $(TRIVIAL_OBJ) $(LIBS)
# Compile rule
build/%.o: %.cpp
@mkdir -p $(dir $@)
$(CXX) $(CXXFLAGS) -c $< -o $@
# Clean
clean:
rm -rf build trivial