From 192640552e2ba36474e4ae8b7168d79df351e968 Mon Sep 17 00:00:00 2001 From: Bob Polis Date: Thu, 9 Feb 2023 18:58:58 +0100 Subject: [PATCH] Modernized Makefile --- Makefile | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/Makefile b/Makefile index 1edb272..f7026f1 100644 --- a/Makefile +++ b/Makefile @@ -30,7 +30,6 @@ DOCDIR ?= $(DATADIR)/$(LIBNAME)/doc SRCS := $(notdir $(wildcard src/*.cpp)) OBJS := $(SRCS:.cpp=.o) -DEPS := $(SRCS:.cpp=.d) HDRS ?= $(wildcard src/*.hpp) CXX ?= g++ @@ -59,7 +58,7 @@ all: prebuild $(OUTDIR)$(REALNAME) $(OUTDIR)$(STATICLIB) prebuild: @mkdir -p $(BUILDDIR) $(OUTDIR) -$(OUTDIR)$(REALNAME): $(OBJS) $(DEPS) +$(OUTDIR)$(REALNAME): $(OBJS) ifeq ($(UNAME_S),Darwin) $(CXX) -dynamiclib -o $(OUTDIR)$(REALNAME) -current_version $(MAJOR) -compatibility_version $(MINOR) $(LDFLAGS) $(LDLIBS) $(addprefix $(BUILDDIR),$(OBJS)) endif @@ -70,13 +69,11 @@ ifeq ($(UNAME_S),Linux) $(CXX) -g -shared -Wl,-soname,$(SONAME) -o $(OUTDIR)$(REALNAME) $(LDFLAGS) $(LDLIBS) $(addprefix $(BUILDDIR),$(OBJS)) endif -%.o: %.cpp %.d +%.o %.d: %.cpp $(CXX) $(CXXFLAGS) -MMD -MP -MT $@ -MF $*.d -c $< @mv $@ $*.d $(BUILDDIR) --include $(BUILDDIR)*.d - -%.d: ; +-include $(BUILDDIR)$(SRCS:.cpp=.d) $(OUTDIR)$(STATICLIB): $(OBJS) ar r $(OUTDIR)$(STATICLIB) $(addprefix $(BUILDDIR),$(OBJS))