35 lines
531 B
Makefile
35 lines
531 B
Makefile
|
LDLIBS := -lscterm
|
||
|
|
||
|
BIN := $(shell basename $$(pwd))
|
||
|
|
||
|
SRCS := $(wildcard *.cpp)
|
||
|
OBJS := $(SRCS:.cpp=.o)
|
||
|
DEPS := $(SRCS:.cpp=.d)
|
||
|
|
||
|
CXX ?= g++
|
||
|
RM := /bin/rm -f
|
||
|
|
||
|
CXXFLAGS += -Wshadow -Wall -Wpedantic -Wextra -g -std=c++17
|
||
|
ifeq ($(DEBUG),1)
|
||
|
CXXFLAGS += -D DEBUG -O0
|
||
|
else
|
||
|
CXXFLAGS += -D NDEBUG -O3
|
||
|
endif
|
||
|
|
||
|
.PHONY: all clean
|
||
|
|
||
|
all: $(BIN)
|
||
|
|
||
|
$(BIN): $(OBJS) $(DEPS)
|
||
|
$(CXX) $(LDFLAGS) $(LDLIBS) -o $(BIN) $(OBJS)
|
||
|
|
||
|
%.o: %.cpp %.d
|
||
|
$(CXX) $(CXXFLAGS) -MMD -MP -MT $@ -MF $*.d -c $<
|
||
|
|
||
|
-include *.d
|
||
|
|
||
|
%.d: ;
|
||
|
|
||
|
clean:
|
||
|
$(RM) $(OBJS) $(DEPS) $(BIN)
|