Replace Makefile with current simple Makefile
This commit is contained in:
parent
3ee79437fe
commit
73a844d64a
47
Makefile
47
Makefile
@ -1,46 +1,31 @@
|
||||
BIN := $(shell basename $$(pwd))
|
||||
LDLIBS := -lscstring
|
||||
|
||||
PROJ := $(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 += -DDEBUG -O0
|
||||
else
|
||||
CXXFLAGS += -O3
|
||||
CXXFLAGS += -DNDEBUG -O3
|
||||
endif
|
||||
|
||||
LDLIBS := -lm -lpthread -lscstring
|
||||
LDFLAGS :=
|
||||
%.o: %.cpp
|
||||
$(CXX) $(CXXFLAGS) -MMD -MP -MT $@ -MF $*.dep -c $<
|
||||
|
||||
all: $(BIN)
|
||||
%.dep: ;
|
||||
|
||||
$(BIN): $(OBJS) $(DEPS)
|
||||
$(CXX) $(OBJS) $(LDFLAGS) -o $(BIN) $(LDLIBS)
|
||||
$(PROJ): $(OBJS)
|
||||
$(CXX) $(LDFLAGS) -o $(PROJ) $(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) $(PROJ)
|
||||
|
Loading…
x
Reference in New Issue
Block a user