Replace Makefile with new version

This commit is contained in:
Bob Polis 2024-09-11 16:42:54 +02:00
parent e33824355b
commit 1fdbf7831a

View File

@ -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)