LDLIBS := BIN := $(shell basename $$(pwd)) SRCS := $(wildcard *.cpp) OBJS := $(SRCS:.cpp=.o) DEPS := $(SRCS:.cpp=.dep) CXX ?= g++ CXXFLAGS += -Wshadow -Wall -Wpedantic -Wextra -Wno-unused-parameter CXXFLAGS += -g3 -std=c++20 ifeq ($(DEBUG),1) CXXFLAGS += -D DEBUG -O0 else CXXFLAGS += -D NDEBUG -O3 endif %.o: %.cpp $(CXX) $(CXXFLAGS) -MMD -MP -MT $@ -MF $*.dep -c $< %.dep: ; $(BIN): $(OBJS) $(CXX) $(LDFLAGS) -o $(BIN) $(OBJS) $(LDLIBS) -include $(DEPS) .PHONY: clean clean: rm -f $(OBJS) $(DEPS) $(BIN)