32 lines
522 B
Makefile
32 lines
522 B
Makefile
|
LDLIBS :=
|
||
|
|
||
|
PROJ := $(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 += -DDEBUG -O0
|
||
|
else
|
||
|
CXXFLAGS += -DNDEBUG -O3
|
||
|
endif
|
||
|
|
||
|
%.o: %.cpp
|
||
|
$(CXX) $(CXXFLAGS) -MMD -MP -MT $@ -MF $*.dep -c $<
|
||
|
|
||
|
%.dep: ;
|
||
|
|
||
|
$(PROJ): $(OBJS)
|
||
|
$(CXX) $(LDFLAGS) -o $(PROJ) $(OBJS) $(LDLIBS)
|
||
|
|
||
|
-include $(DEPS)
|
||
|
|
||
|
.PHONY: clean
|
||
|
clean:
|
||
|
rm -f $(OBJS) $(DEPS) $(PROJ)
|