From 1fdbf7831a6c7a104fb6189079cc92ee572be03a Mon Sep 17 00:00:00 2001 From: Bob Polis Date: Wed, 11 Sep 2024 16:42:54 +0200 Subject: [PATCH] Replace Makefile with new version --- Makefile | 25 +++++++++++-------------- 1 file changed, 11 insertions(+), 14 deletions(-) diff --git a/Makefile b/Makefile index b37c1ba..5b49811 100644 --- a/Makefile +++ b/Makefile @@ -1,34 +1,31 @@ -LDLIBS := -lscterm -lm -lscscreensaver +LDLIBS := BIN := $(shell basename $$(pwd)) SRCS := $(wildcard *.cpp) OBJS := $(SRCS:.cpp=.o) -DEPS := $(SRCS:.cpp=.d) +DEPS := $(SRCS:.cpp=.dep) CXX ?= g++ -RM := /bin/rm -f -CXXFLAGS += -Wshadow -Wall -Wpedantic -Wextra -g -std=c++17 +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 -.PHONY: all clean +%.o: %.cpp + $(CXX) $(CXXFLAGS) -MMD -MP -MT $@ -MF $*.dep -c $< -all: $(BIN) +%.dep: ; -$(BIN): $(OBJS) $(DEPS) +$(BIN): $(OBJS) $(CXX) $(LDFLAGS) -o $(BIN) $(OBJS) $(LDLIBS) -%.o: %.cpp %.d - $(CXX) $(CXXFLAGS) -MMD -MP -MT $@ -MF $*.d -c $< - --include *.d - -%.d: ; +-include $(DEPS) +.PHONY: clean clean: - $(RM) $(OBJS) $(DEPS) $(BIN) + rm -f $(OBJS) $(DEPS) $(BIN)