Replace tester Makefile with new version

This commit is contained in:
Bob Polis 2024-09-12 15:04:34 +02:00
parent 8d14fac3de
commit 8feb1db40c

View File

@ -1,45 +1,31 @@
LDLIBS := -lsclogging -lscterm
BIN := $(shell basename $$(pwd)) BIN := $(shell basename $$(pwd))
SRCS := $(wildcard *.cpp) SRCS := $(wildcard *.cpp)
OBJS := $(subst .cpp,.o,$(SRCS)) OBJS := $(SRCS:.cpp=.o)
DEPS := $(subst .cpp,.d,$(SRCS)) DEPS := $(SRCS:.cpp=.dep)
CXX ?= g++ CXX ?= g++
PKG_CONFIG ?= pkg-config
PREFIX ?= /usr/local CXXFLAGS += -Wshadow -Wall -Wpedantic -Wextra -Wno-unused-parameter
BINDIR ?= $(PREFIX)/bin CXXFLAGS += -g3 -std=c++20
DATADIR ?= $(PREFIX)/share
MANDIR ?= $(DATADIR)/man
RM := /bin/rm -f
INSTALL := /usr/bin/install -c
CXXFLAGS += -Wshadow -Wall -Wpedantic -Wextra -g -std=c++17
ifeq ($(DEBUG),1) ifeq ($(DEBUG),1)
CXXFLAGS += -D DEBUG -O0 CXXFLAGS += -D DEBUG -O0
else else
CXXFLAGS += -D NDEBUG -O3 CXXFLAGS += -D NDEBUG -O3
endif endif
LDLIBS := -lm -lpthread -lsclogging -lscterm %.o: %.cpp
$(CXX) $(CXXFLAGS) -MMD -MP -MT $@ -MF $*.dep -c $<
all: $(BIN) %.dep: ;
$(BIN): $(OBJS) $(DEPS) $(BIN): $(OBJS)
$(CXX) $(OBJS) $(LDFLAGS) $(LDLIBS) -o $(BIN) $(CXX) $(LDFLAGS) -o $(BIN) $(OBJS) $(LDLIBS)
%.o: %.cpp %.d Makefile -include $(DEPS)
$(CXX) $(CXXFLAGS) -MMD -MP -MT $@ -MF $*.d -c $<
-include *.d
%.d: ;
.PHONY: clean install
.PHONY: clean
clean: clean:
$(RM) $(OBJS) $(DEPS) $(BIN) rm -f $(OBJS) $(DEPS) $(BIN)
install: $(BIN)
$(INSTALL) $(BIN) $(DESTDIR)$(BINDIR)