Adapt to new plugin support in unified Makefiles

This commit is contained in:
Bob Polis 2024-09-19 16:44:21 +02:00
parent b745001633
commit 2e0be41f11
10 changed files with 180 additions and 197 deletions

View File

@ -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))

View File

@ -0,0 +1,6 @@
LDLIBS := -lcairo -lscscreensaver
UNAME_S := $(shell uname -s)
PROJ := $(shell basename $$(pwd))
PLUGIN := $(PROJ).saver
INSTALLDIRNAME := screensaver/plugins
EXTRAFILES :=

View File

@ -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))

View File

@ -0,0 +1,6 @@
LDLIBS := -lcairo -lscscreensaver
UNAME_S := $(shell uname -s)
PROJ := $(shell basename $$(pwd))
PLUGIN := $(PROJ).saver
INSTALLDIRNAME := screensaver/plugins
EXTRAFILES :=

View File

@ -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))

View File

@ -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

View File

@ -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))

View File

@ -0,0 +1,6 @@
LDLIBS := -lcairo -lscscreensaver
UNAME_S := $(shell uname -s)
PROJ := $(shell basename $$(pwd))
PLUGIN := $(PROJ).saver
INSTALLDIRNAME := screensaver/plugins
EXTRAFILES :=

View File

@ -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))

View File

@ -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