From 2e0be41f11ef776c30613db17ae86fbd78f80a8b Mon Sep 17 00:00:00 2001 From: Bob Polis Date: Thu, 19 Sep 2024 16:44:21 +0200 Subject: [PATCH] Adapt to new plugin support in unified Makefiles --- modules/Default/Makefile | 69 ++++++++++++++----------------- modules/Default/premake.make | 6 +++ modules/FadingRects/Makefile | 69 ++++++++++++++----------------- modules/FadingRects/premake.make | 6 +++ modules/Grid/Makefile | 70 ++++++++++++++------------------ modules/Grid/premake.make | 6 +++ modules/Huey/Makefile | 69 ++++++++++++++----------------- modules/Huey/premake.make | 6 +++ modules/Whirling/Makefile | 70 ++++++++++++++------------------ modules/Whirling/premake.make | 6 +++ 10 files changed, 180 insertions(+), 197 deletions(-) create mode 100644 modules/Default/premake.make create mode 100644 modules/FadingRects/premake.make create mode 100644 modules/Grid/premake.make create mode 100644 modules/Huey/premake.make create mode 100644 modules/Whirling/premake.make diff --git a/modules/Default/Makefile b/modules/Default/Makefile index cd973c8..c22234e 100644 --- a/modules/Default/Makefile +++ b/modules/Default/Makefile @@ -1,62 +1,53 @@ -LIBNAME := $(shell basename $$(pwd)) -MAJOR := 1 -MINOR := 0.0 +include premake.make -UNAME_S := $(shell uname -s) - -ifeq ($(UNAME_S),Darwin) - LINKERNAME := $(LIBNAME).dylib - SONAME := $(LIBNAME).$(MAJOR).dylib - REALNAME := $(LINKERNAME) -else - LINKERNAME := $(LIBNAME).so - SONAME := $(LINKERNAME).$(MAJOR) - REALNAME := $(SONAME).$(MINOR) -endif - -PREFIX ?= ../.. -LIBDIR ?= $(PREFIX)/plugins +# some important install locations +PREFIX ?= /usr/local +DATADIR ?= $(PREFIX)/share +INSTALLDIR ?= $(DATADIR)/$(INSTALLDIRNAME) SRCS := $(wildcard *.cpp) -OBJS := $(subst .cpp,.o,$(SRCS)) -DEPS := $(subst .cpp,.d,$(SRCS)) -HDRS := $(filter-out $(LIBNAME).hpp,$(wildcard *.hpp)) +OBJS := $(SRCS:.cpp=.o) +DEPS := $(SRCS:.cpp=.dep) CXX ?= g++ -CXXFLAGS += -Wshadow -Wall -Wpedantic -Wextra -g -std=c++17 -fPIC +CXXFLAGS += -Wshadow -Wall -Wpedantic -Wextra -Wno-unused-parameter +CXXFLAGS += -g3 -std=c++20 -fPIC ifeq ($(DEBUG),1) CXXFLAGS += -D DEBUG -O0 else CXXFLAGS += -D NDEBUG -O3 endif -LDLIBS := -lcairo -lscscreensaver +%.o: %.cpp + $(CXX) $(CXXFLAGS) -o $@ -MMD -MP -MT $@ -MF $*.dep -c $< -RM := /bin/rm -f -INSTALL := /usr/bin/install -c +%.dep: ; -.PHONY: all clean install +.PHONY: all clean install uninstall -all: $(REALNAME) +all: $(PLUGIN) -$(REALNAME): $(OBJS) $(DEPS) +$(PLUGIN): $(OBJS) ifeq ($(UNAME_S),Darwin) - $(CXX) -dynamiclib -o $(REALNAME) -current_version $(MAJOR) -compatibility_version $(MINOR) $(LDFLAGS) $(LDLIBS) $(OBJS) + $(CXX) -g3 -dynamiclib -o $(PLUGIN) $(LDFLAGS) $(OBJS) $(LDLIBS) else - $(CXX) -g -shared -Wl,-soname,$(SONAME) -o $(REALNAME) $(LDFLAGS) $(LDLIBS) $(OBJS) + $(CXX) -g3 -shared -o $(PLUGIN) $(LDFLAGS) $(OBJS) $(LDLIBS) endif -%.o: %.cpp %.d Makefile - $(CXX) $(CXXFLAGS) -MMD -MP -MT $@ -MF $*.d -c $< - --include *.d - -%.d: ; +-include $(DEPS) clean: - $(RM) $(OBJS) $(DEPS) $(REALNAME) + rm -f $(OBJS) $(DEPS) $(PLUGIN) -install: $(REALNAME) - $(INSTALL) -d $(LIBDIR) - $(INSTALL) -m 644 $(REALNAME) $(LIBDIR)/$(LIBNAME).saver +$(INSTALLDIR): + install -m 0755 -d $@ + +install: $(INSTALLDIR) + install -m 0644 $(PLUGIN) $(INSTALLDIR) +ifdef EXTRAFILES + install -m 0644 $(EXTRAFILES) $(INSTALLDIR) +endif + +uninstall: + rm -f $(INSTALLDIR)/$(PLUGIN) $(addprefix $(INSTALLDIR)/, $(EXTRAFILES)) diff --git a/modules/Default/premake.make b/modules/Default/premake.make new file mode 100644 index 0000000..ec5846f --- /dev/null +++ b/modules/Default/premake.make @@ -0,0 +1,6 @@ +LDLIBS := -lcairo -lscscreensaver +UNAME_S := $(shell uname -s) +PROJ := $(shell basename $$(pwd)) +PLUGIN := $(PROJ).saver +INSTALLDIRNAME := screensaver/plugins +EXTRAFILES := diff --git a/modules/FadingRects/Makefile b/modules/FadingRects/Makefile index 9d10008..c22234e 100644 --- a/modules/FadingRects/Makefile +++ b/modules/FadingRects/Makefile @@ -1,62 +1,53 @@ -LIBNAME := $(shell basename $$(pwd)) -MAJOR := 1 -MINOR := 0.0 +include premake.make -UNAME_S := $(shell uname -s) - -ifeq ($(UNAME_S),Darwin) - LINKERNAME := $(LIBNAME).dylib - SONAME := $(LIBNAME).$(MAJOR).dylib - REALNAME := $(LINKERNAME) -else - LINKERNAME := $(LIBNAME).so - SONAME := $(LINKERNAME).$(MAJOR) - REALNAME := $(SONAME).$(MINOR) -endif - -PREFIX ?= ../.. -LIBDIR ?= $(PREFIX)/plugins +# some important install locations +PREFIX ?= /usr/local +DATADIR ?= $(PREFIX)/share +INSTALLDIR ?= $(DATADIR)/$(INSTALLDIRNAME) SRCS := $(wildcard *.cpp) -OBJS := $(subst .cpp,.o,$(SRCS)) -DEPS := $(subst .cpp,.d,$(SRCS)) -HDRS := $(filter-out $(LIBNAME).hpp,$(wildcard *.hpp)) +OBJS := $(SRCS:.cpp=.o) +DEPS := $(SRCS:.cpp=.dep) CXX ?= g++ -CXXFLAGS += -Wshadow -Wall -Wpedantic -Wextra -g -std=c++17 -fPIC +CXXFLAGS += -Wshadow -Wall -Wpedantic -Wextra -Wno-unused-parameter +CXXFLAGS += -g3 -std=c++20 -fPIC ifeq ($(DEBUG),1) CXXFLAGS += -D DEBUG -O0 else CXXFLAGS += -D NDEBUG -O3 endif -LDLIBS := -lcairo -lscscreensaver -lscnumerics +%.o: %.cpp + $(CXX) $(CXXFLAGS) -o $@ -MMD -MP -MT $@ -MF $*.dep -c $< -RM := /bin/rm -f -INSTALL := /usr/bin/install -c +%.dep: ; -.PHONY: all clean install +.PHONY: all clean install uninstall -all: $(REALNAME) +all: $(PLUGIN) -$(REALNAME): $(OBJS) $(DEPS) +$(PLUGIN): $(OBJS) ifeq ($(UNAME_S),Darwin) - $(CXX) -dynamiclib -o $(REALNAME) -current_version $(MAJOR) -compatibility_version $(MINOR) $(LDFLAGS) $(LDLIBS) $(OBJS) + $(CXX) -g3 -dynamiclib -o $(PLUGIN) $(LDFLAGS) $(OBJS) $(LDLIBS) else - $(CXX) -g -shared -Wl,-soname,$(SONAME) -o $(REALNAME) $(LDFLAGS) $(LDLIBS) $(OBJS) + $(CXX) -g3 -shared -o $(PLUGIN) $(LDFLAGS) $(OBJS) $(LDLIBS) endif -%.o: %.cpp %.d Makefile - $(CXX) $(CXXFLAGS) -MMD -MP -MT $@ -MF $*.d -c $< - --include *.d - -%.d: ; +-include $(DEPS) clean: - $(RM) $(OBJS) $(DEPS) $(REALNAME) + rm -f $(OBJS) $(DEPS) $(PLUGIN) -install: $(REALNAME) - $(INSTALL) -d $(LIBDIR) - $(INSTALL) -m 644 $(REALNAME) $(LIBDIR)/$(LIBNAME).saver +$(INSTALLDIR): + install -m 0755 -d $@ + +install: $(INSTALLDIR) + install -m 0644 $(PLUGIN) $(INSTALLDIR) +ifdef EXTRAFILES + install -m 0644 $(EXTRAFILES) $(INSTALLDIR) +endif + +uninstall: + rm -f $(INSTALLDIR)/$(PLUGIN) $(addprefix $(INSTALLDIR)/, $(EXTRAFILES)) diff --git a/modules/FadingRects/premake.make b/modules/FadingRects/premake.make new file mode 100644 index 0000000..ec5846f --- /dev/null +++ b/modules/FadingRects/premake.make @@ -0,0 +1,6 @@ +LDLIBS := -lcairo -lscscreensaver +UNAME_S := $(shell uname -s) +PROJ := $(shell basename $$(pwd)) +PLUGIN := $(PROJ).saver +INSTALLDIRNAME := screensaver/plugins +EXTRAFILES := diff --git a/modules/Grid/Makefile b/modules/Grid/Makefile index 5b549fd..c22234e 100644 --- a/modules/Grid/Makefile +++ b/modules/Grid/Makefile @@ -1,63 +1,53 @@ -LIBNAME := $(shell basename $$(pwd)) -MAJOR := 1 -MINOR := 0.0 +include premake.make -UNAME_S := $(shell uname -s) - -ifeq ($(UNAME_S),Darwin) - LINKERNAME := $(LIBNAME).dylib - SONAME := $(LIBNAME).$(MAJOR).dylib - REALNAME := $(LINKERNAME) -else - LINKERNAME := $(LIBNAME).so - SONAME := $(LINKERNAME).$(MAJOR) - REALNAME := $(SONAME).$(MINOR) -endif - -PREFIX ?= ../.. -LIBDIR ?= $(PREFIX)/plugins +# some important install locations +PREFIX ?= /usr/local +DATADIR ?= $(PREFIX)/share +INSTALLDIR ?= $(DATADIR)/$(INSTALLDIRNAME) SRCS := $(wildcard *.cpp) -OBJS := $(subst .cpp,.o,$(SRCS)) -DEPS := $(subst .cpp,.d,$(SRCS)) -HDRS := $(filter-out $(LIBNAME).hpp,$(wildcard *.hpp)) +OBJS := $(SRCS:.cpp=.o) +DEPS := $(SRCS:.cpp=.dep) CXX ?= g++ -CXXFLAGS += -Wshadow -Wall -Wpedantic -Wextra -g -std=c++17 -fPIC +CXXFLAGS += -Wshadow -Wall -Wpedantic -Wextra -Wno-unused-parameter +CXXFLAGS += -g3 -std=c++20 -fPIC ifeq ($(DEBUG),1) CXXFLAGS += -D DEBUG -O0 else CXXFLAGS += -D NDEBUG -O3 endif -LDLIBS := -lcairo -lscscreensaver -lscnumerics +%.o: %.cpp + $(CXX) $(CXXFLAGS) -o $@ -MMD -MP -MT $@ -MF $*.dep -c $< -RM := /bin/rm -f -INSTALL := /usr/bin/install -c +%.dep: ; -.PHONY: all clean install +.PHONY: all clean install uninstall -all: $(REALNAME) +all: $(PLUGIN) -$(REALNAME): $(OBJS) $(DEPS) +$(PLUGIN): $(OBJS) ifeq ($(UNAME_S),Darwin) - $(CXX) -dynamiclib -o $(REALNAME) -current_version $(MAJOR) -compatibility_version $(MINOR) $(LDFLAGS) $(LDLIBS) $(OBJS) + $(CXX) -g3 -dynamiclib -o $(PLUGIN) $(LDFLAGS) $(OBJS) $(LDLIBS) else - $(CXX) -g -shared -Wl,-soname,$(SONAME) -o $(REALNAME) $(LDFLAGS) $(LDLIBS) $(OBJS) + $(CXX) -g3 -shared -o $(PLUGIN) $(LDFLAGS) $(OBJS) $(LDLIBS) endif -%.o: %.cpp %.d Makefile - $(CXX) $(CXXFLAGS) -MMD -MP -MT $@ -MF $*.d -c $< - --include *.d - -%.d: ; +-include $(DEPS) clean: - $(RM) $(OBJS) $(DEPS) $(REALNAME) + rm -f $(OBJS) $(DEPS) $(PLUGIN) -install: $(REALNAME) - $(INSTALL) -d $(LIBDIR) - $(INSTALL) -m 644 $(REALNAME) $(LIBDIR)/$(LIBNAME).saver - $(INSTALL) -m 644 $(LIBNAME).json $(LIBDIR) +$(INSTALLDIR): + install -m 0755 -d $@ + +install: $(INSTALLDIR) + install -m 0644 $(PLUGIN) $(INSTALLDIR) +ifdef EXTRAFILES + install -m 0644 $(EXTRAFILES) $(INSTALLDIR) +endif + +uninstall: + rm -f $(INSTALLDIR)/$(PLUGIN) $(addprefix $(INSTALLDIR)/, $(EXTRAFILES)) diff --git a/modules/Grid/premake.make b/modules/Grid/premake.make new file mode 100644 index 0000000..24b9222 --- /dev/null +++ b/modules/Grid/premake.make @@ -0,0 +1,6 @@ +LDLIBS := -lcairo -lscscreensaver +UNAME_S := $(shell uname -s) +PROJ := $(shell basename $$(pwd)) +PLUGIN := $(PROJ).saver +INSTALLDIRNAME := screensaver/plugins +EXTRAFILES := $(PROJ).json diff --git a/modules/Huey/Makefile b/modules/Huey/Makefile index cd973c8..c22234e 100644 --- a/modules/Huey/Makefile +++ b/modules/Huey/Makefile @@ -1,62 +1,53 @@ -LIBNAME := $(shell basename $$(pwd)) -MAJOR := 1 -MINOR := 0.0 +include premake.make -UNAME_S := $(shell uname -s) - -ifeq ($(UNAME_S),Darwin) - LINKERNAME := $(LIBNAME).dylib - SONAME := $(LIBNAME).$(MAJOR).dylib - REALNAME := $(LINKERNAME) -else - LINKERNAME := $(LIBNAME).so - SONAME := $(LINKERNAME).$(MAJOR) - REALNAME := $(SONAME).$(MINOR) -endif - -PREFIX ?= ../.. -LIBDIR ?= $(PREFIX)/plugins +# some important install locations +PREFIX ?= /usr/local +DATADIR ?= $(PREFIX)/share +INSTALLDIR ?= $(DATADIR)/$(INSTALLDIRNAME) SRCS := $(wildcard *.cpp) -OBJS := $(subst .cpp,.o,$(SRCS)) -DEPS := $(subst .cpp,.d,$(SRCS)) -HDRS := $(filter-out $(LIBNAME).hpp,$(wildcard *.hpp)) +OBJS := $(SRCS:.cpp=.o) +DEPS := $(SRCS:.cpp=.dep) CXX ?= g++ -CXXFLAGS += -Wshadow -Wall -Wpedantic -Wextra -g -std=c++17 -fPIC +CXXFLAGS += -Wshadow -Wall -Wpedantic -Wextra -Wno-unused-parameter +CXXFLAGS += -g3 -std=c++20 -fPIC ifeq ($(DEBUG),1) CXXFLAGS += -D DEBUG -O0 else CXXFLAGS += -D NDEBUG -O3 endif -LDLIBS := -lcairo -lscscreensaver +%.o: %.cpp + $(CXX) $(CXXFLAGS) -o $@ -MMD -MP -MT $@ -MF $*.dep -c $< -RM := /bin/rm -f -INSTALL := /usr/bin/install -c +%.dep: ; -.PHONY: all clean install +.PHONY: all clean install uninstall -all: $(REALNAME) +all: $(PLUGIN) -$(REALNAME): $(OBJS) $(DEPS) +$(PLUGIN): $(OBJS) ifeq ($(UNAME_S),Darwin) - $(CXX) -dynamiclib -o $(REALNAME) -current_version $(MAJOR) -compatibility_version $(MINOR) $(LDFLAGS) $(LDLIBS) $(OBJS) + $(CXX) -g3 -dynamiclib -o $(PLUGIN) $(LDFLAGS) $(OBJS) $(LDLIBS) else - $(CXX) -g -shared -Wl,-soname,$(SONAME) -o $(REALNAME) $(LDFLAGS) $(LDLIBS) $(OBJS) + $(CXX) -g3 -shared -o $(PLUGIN) $(LDFLAGS) $(OBJS) $(LDLIBS) endif -%.o: %.cpp %.d Makefile - $(CXX) $(CXXFLAGS) -MMD -MP -MT $@ -MF $*.d -c $< - --include *.d - -%.d: ; +-include $(DEPS) clean: - $(RM) $(OBJS) $(DEPS) $(REALNAME) + rm -f $(OBJS) $(DEPS) $(PLUGIN) -install: $(REALNAME) - $(INSTALL) -d $(LIBDIR) - $(INSTALL) -m 644 $(REALNAME) $(LIBDIR)/$(LIBNAME).saver +$(INSTALLDIR): + install -m 0755 -d $@ + +install: $(INSTALLDIR) + install -m 0644 $(PLUGIN) $(INSTALLDIR) +ifdef EXTRAFILES + install -m 0644 $(EXTRAFILES) $(INSTALLDIR) +endif + +uninstall: + rm -f $(INSTALLDIR)/$(PLUGIN) $(addprefix $(INSTALLDIR)/, $(EXTRAFILES)) diff --git a/modules/Huey/premake.make b/modules/Huey/premake.make new file mode 100644 index 0000000..ec5846f --- /dev/null +++ b/modules/Huey/premake.make @@ -0,0 +1,6 @@ +LDLIBS := -lcairo -lscscreensaver +UNAME_S := $(shell uname -s) +PROJ := $(shell basename $$(pwd)) +PLUGIN := $(PROJ).saver +INSTALLDIRNAME := screensaver/plugins +EXTRAFILES := diff --git a/modules/Whirling/Makefile b/modules/Whirling/Makefile index 666e67b..c22234e 100644 --- a/modules/Whirling/Makefile +++ b/modules/Whirling/Makefile @@ -1,63 +1,53 @@ -LIBNAME := $(shell basename $$(pwd)) -MAJOR := 1 -MINOR := 0.0 +include premake.make -UNAME_S := $(shell uname -s) - -ifeq ($(UNAME_S),Darwin) - LINKERNAME := $(LIBNAME).dylib - SONAME := $(LIBNAME).$(MAJOR).dylib - REALNAME := $(LINKERNAME) -else - LINKERNAME := $(LIBNAME).so - SONAME := $(LINKERNAME).$(MAJOR) - REALNAME := $(SONAME).$(MINOR) -endif - -PREFIX ?= ../.. -LIBDIR ?= $(PREFIX)/plugins +# some important install locations +PREFIX ?= /usr/local +DATADIR ?= $(PREFIX)/share +INSTALLDIR ?= $(DATADIR)/$(INSTALLDIRNAME) SRCS := $(wildcard *.cpp) -OBJS := $(subst .cpp,.o,$(SRCS)) -DEPS := $(subst .cpp,.d,$(SRCS)) -HDRS := $(filter-out $(LIBNAME).hpp,$(wildcard *.hpp)) +OBJS := $(SRCS:.cpp=.o) +DEPS := $(SRCS:.cpp=.dep) CXX ?= g++ -CXXFLAGS += -Wshadow -Wall -Wpedantic -Wextra -g -std=c++17 -fPIC +CXXFLAGS += -Wshadow -Wall -Wpedantic -Wextra -Wno-unused-parameter +CXXFLAGS += -g3 -std=c++20 -fPIC ifeq ($(DEBUG),1) CXXFLAGS += -D DEBUG -O0 else CXXFLAGS += -D NDEBUG -O3 endif -LDLIBS := -lm -lcairo -lscscreensaver +%.o: %.cpp + $(CXX) $(CXXFLAGS) -o $@ -MMD -MP -MT $@ -MF $*.dep -c $< -RM := /bin/rm -f -INSTALL := /usr/bin/install -c +%.dep: ; -.PHONY: all clean install +.PHONY: all clean install uninstall -all: $(REALNAME) +all: $(PLUGIN) -$(REALNAME): $(OBJS) $(DEPS) +$(PLUGIN): $(OBJS) ifeq ($(UNAME_S),Darwin) - $(CXX) -dynamiclib -o $(REALNAME) -current_version $(MAJOR) -compatibility_version $(MINOR) $(LDFLAGS) $(LDLIBS) $(OBJS) + $(CXX) -g3 -dynamiclib -o $(PLUGIN) $(LDFLAGS) $(OBJS) $(LDLIBS) else - $(CXX) -g -shared -Wl,-soname,$(SONAME) -o $(REALNAME) $(LDFLAGS) $(LDLIBS) $(OBJS) + $(CXX) -g3 -shared -o $(PLUGIN) $(LDFLAGS) $(OBJS) $(LDLIBS) endif -%.o: %.cpp %.d Makefile - $(CXX) $(CXXFLAGS) -MMD -MP -MT $@ -MF $*.d -c $< - --include *.d - -%.d: ; +-include $(DEPS) clean: - $(RM) $(OBJS) $(DEPS) $(REALNAME) + rm -f $(OBJS) $(DEPS) $(PLUGIN) -install: $(REALNAME) - $(INSTALL) -d $(LIBDIR) - $(INSTALL) -m 644 $(REALNAME) $(LIBDIR)/$(LIBNAME).saver - $(INSTALL) -m 644 $(LIBNAME).json $(LIBDIR) +$(INSTALLDIR): + install -m 0755 -d $@ + +install: $(INSTALLDIR) + install -m 0644 $(PLUGIN) $(INSTALLDIR) +ifdef EXTRAFILES + install -m 0644 $(EXTRAFILES) $(INSTALLDIR) +endif + +uninstall: + rm -f $(INSTALLDIR)/$(PLUGIN) $(addprefix $(INSTALLDIR)/, $(EXTRAFILES)) diff --git a/modules/Whirling/premake.make b/modules/Whirling/premake.make new file mode 100644 index 0000000..24b9222 --- /dev/null +++ b/modules/Whirling/premake.make @@ -0,0 +1,6 @@ +LDLIBS := -lcairo -lscscreensaver +UNAME_S := $(shell uname -s) +PROJ := $(shell basename $$(pwd)) +PLUGIN := $(PROJ).saver +INSTALLDIRNAME := screensaver/plugins +EXTRAFILES := $(PROJ).json