Replace tester Makefile with new version
This commit is contained in:
parent
8d14fac3de
commit
8feb1db40c
@ -1,45 +1,31 @@
|
||||
LDLIBS := -lsclogging -lscterm
|
||||
|
||||
BIN := $(shell basename $$(pwd))
|
||||
|
||||
SRCS := $(wildcard *.cpp)
|
||||
OBJS := $(subst .cpp,.o,$(SRCS))
|
||||
DEPS := $(subst .cpp,.d,$(SRCS))
|
||||
OBJS := $(SRCS:.cpp=.o)
|
||||
DEPS := $(SRCS:.cpp=.dep)
|
||||
|
||||
CXX ?= g++
|
||||
PKG_CONFIG ?= pkg-config
|
||||
|
||||
PREFIX ?= /usr/local
|
||||
BINDIR ?= $(PREFIX)/bin
|
||||
DATADIR ?= $(PREFIX)/share
|
||||
MANDIR ?= $(DATADIR)/man
|
||||
|
||||
RM := /bin/rm -f
|
||||
INSTALL := /usr/bin/install -c
|
||||
|
||||
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
|
||||
|
||||
LDLIBS := -lm -lpthread -lsclogging -lscterm
|
||||
%.o: %.cpp
|
||||
$(CXX) $(CXXFLAGS) -MMD -MP -MT $@ -MF $*.dep -c $<
|
||||
|
||||
all: $(BIN)
|
||||
%.dep: ;
|
||||
|
||||
$(BIN): $(OBJS) $(DEPS)
|
||||
$(CXX) $(OBJS) $(LDFLAGS) $(LDLIBS) -o $(BIN)
|
||||
$(BIN): $(OBJS)
|
||||
$(CXX) $(LDFLAGS) -o $(BIN) $(OBJS) $(LDLIBS)
|
||||
|
||||
%.o: %.cpp %.d Makefile
|
||||
$(CXX) $(CXXFLAGS) -MMD -MP -MT $@ -MF $*.d -c $<
|
||||
|
||||
-include *.d
|
||||
|
||||
%.d: ;
|
||||
|
||||
.PHONY: clean install
|
||||
-include $(DEPS)
|
||||
|
||||
.PHONY: clean
|
||||
clean:
|
||||
$(RM) $(OBJS) $(DEPS) $(BIN)
|
||||
|
||||
install: $(BIN)
|
||||
$(INSTALL) $(BIN) $(DESTDIR)$(BINDIR)
|
||||
rm -f $(OBJS) $(DEPS) $(BIN)
|
||||
|
Loading…
x
Reference in New Issue
Block a user