Replace Makefile with new version
This commit is contained in:
parent
e33824355b
commit
1fdbf7831a
25
Makefile
25
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)
|
||||
|
Reference in New Issue
Block a user