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)) include premake.make
MAJOR := 1
MINOR := 0.0
UNAME_S := $(shell uname -s) # some important install locations
PREFIX ?= /usr/local
ifeq ($(UNAME_S),Darwin) DATADIR ?= $(PREFIX)/share
LINKERNAME := $(LIBNAME).dylib INSTALLDIR ?= $(DATADIR)/$(INSTALLDIRNAME)
SONAME := $(LIBNAME).$(MAJOR).dylib
REALNAME := $(LINKERNAME)
else
LINKERNAME := $(LIBNAME).so
SONAME := $(LINKERNAME).$(MAJOR)
REALNAME := $(SONAME).$(MINOR)
endif
PREFIX ?= ../..
LIBDIR ?= $(PREFIX)/plugins
SRCS := $(wildcard *.cpp) SRCS := $(wildcard *.cpp)
OBJS := $(subst .cpp,.o,$(SRCS)) OBJS := $(SRCS:.cpp=.o)
DEPS := $(subst .cpp,.d,$(SRCS)) DEPS := $(SRCS:.cpp=.dep)
HDRS := $(filter-out $(LIBNAME).hpp,$(wildcard *.hpp))
CXX ?= g++ 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) ifeq ($(DEBUG),1)
CXXFLAGS += -D DEBUG -O0 CXXFLAGS += -D DEBUG -O0
else else
CXXFLAGS += -D NDEBUG -O3 CXXFLAGS += -D NDEBUG -O3
endif endif
LDLIBS := -lcairo -lscscreensaver %.o: %.cpp
$(CXX) $(CXXFLAGS) -o $@ -MMD -MP -MT $@ -MF $*.dep -c $<
RM := /bin/rm -f %.dep: ;
INSTALL := /usr/bin/install -c
.PHONY: all clean install .PHONY: all clean install uninstall
all: $(REALNAME) all: $(PLUGIN)
$(REALNAME): $(OBJS) $(DEPS) $(PLUGIN): $(OBJS)
ifeq ($(UNAME_S),Darwin) 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 else
$(CXX) -g -shared -Wl,-soname,$(SONAME) -o $(REALNAME) $(LDFLAGS) $(LDLIBS) $(OBJS) $(CXX) -g3 -shared -o $(PLUGIN) $(LDFLAGS) $(OBJS) $(LDLIBS)
endif endif
%.o: %.cpp %.d Makefile -include $(DEPS)
$(CXX) $(CXXFLAGS) -MMD -MP -MT $@ -MF $*.d -c $<
-include *.d
%.d: ;
clean: clean:
$(RM) $(OBJS) $(DEPS) $(REALNAME) rm -f $(OBJS) $(DEPS) $(PLUGIN)
install: $(REALNAME) $(INSTALLDIR):
$(INSTALL) -d $(LIBDIR) install -m 0755 -d $@
$(INSTALL) -m 644 $(REALNAME) $(LIBDIR)/$(LIBNAME).saver
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)) include premake.make
MAJOR := 1
MINOR := 0.0
UNAME_S := $(shell uname -s) # some important install locations
PREFIX ?= /usr/local
ifeq ($(UNAME_S),Darwin) DATADIR ?= $(PREFIX)/share
LINKERNAME := $(LIBNAME).dylib INSTALLDIR ?= $(DATADIR)/$(INSTALLDIRNAME)
SONAME := $(LIBNAME).$(MAJOR).dylib
REALNAME := $(LINKERNAME)
else
LINKERNAME := $(LIBNAME).so
SONAME := $(LINKERNAME).$(MAJOR)
REALNAME := $(SONAME).$(MINOR)
endif
PREFIX ?= ../..
LIBDIR ?= $(PREFIX)/plugins
SRCS := $(wildcard *.cpp) SRCS := $(wildcard *.cpp)
OBJS := $(subst .cpp,.o,$(SRCS)) OBJS := $(SRCS:.cpp=.o)
DEPS := $(subst .cpp,.d,$(SRCS)) DEPS := $(SRCS:.cpp=.dep)
HDRS := $(filter-out $(LIBNAME).hpp,$(wildcard *.hpp))
CXX ?= g++ 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) ifeq ($(DEBUG),1)
CXXFLAGS += -D DEBUG -O0 CXXFLAGS += -D DEBUG -O0
else else
CXXFLAGS += -D NDEBUG -O3 CXXFLAGS += -D NDEBUG -O3
endif endif
LDLIBS := -lcairo -lscscreensaver -lscnumerics %.o: %.cpp
$(CXX) $(CXXFLAGS) -o $@ -MMD -MP -MT $@ -MF $*.dep -c $<
RM := /bin/rm -f %.dep: ;
INSTALL := /usr/bin/install -c
.PHONY: all clean install .PHONY: all clean install uninstall
all: $(REALNAME) all: $(PLUGIN)
$(REALNAME): $(OBJS) $(DEPS) $(PLUGIN): $(OBJS)
ifeq ($(UNAME_S),Darwin) 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 else
$(CXX) -g -shared -Wl,-soname,$(SONAME) -o $(REALNAME) $(LDFLAGS) $(LDLIBS) $(OBJS) $(CXX) -g3 -shared -o $(PLUGIN) $(LDFLAGS) $(OBJS) $(LDLIBS)
endif endif
%.o: %.cpp %.d Makefile -include $(DEPS)
$(CXX) $(CXXFLAGS) -MMD -MP -MT $@ -MF $*.d -c $<
-include *.d
%.d: ;
clean: clean:
$(RM) $(OBJS) $(DEPS) $(REALNAME) rm -f $(OBJS) $(DEPS) $(PLUGIN)
install: $(REALNAME) $(INSTALLDIR):
$(INSTALL) -d $(LIBDIR) install -m 0755 -d $@
$(INSTALL) -m 644 $(REALNAME) $(LIBDIR)/$(LIBNAME).saver
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)) include premake.make
MAJOR := 1
MINOR := 0.0
UNAME_S := $(shell uname -s) # some important install locations
PREFIX ?= /usr/local
ifeq ($(UNAME_S),Darwin) DATADIR ?= $(PREFIX)/share
LINKERNAME := $(LIBNAME).dylib INSTALLDIR ?= $(DATADIR)/$(INSTALLDIRNAME)
SONAME := $(LIBNAME).$(MAJOR).dylib
REALNAME := $(LINKERNAME)
else
LINKERNAME := $(LIBNAME).so
SONAME := $(LINKERNAME).$(MAJOR)
REALNAME := $(SONAME).$(MINOR)
endif
PREFIX ?= ../..
LIBDIR ?= $(PREFIX)/plugins
SRCS := $(wildcard *.cpp) SRCS := $(wildcard *.cpp)
OBJS := $(subst .cpp,.o,$(SRCS)) OBJS := $(SRCS:.cpp=.o)
DEPS := $(subst .cpp,.d,$(SRCS)) DEPS := $(SRCS:.cpp=.dep)
HDRS := $(filter-out $(LIBNAME).hpp,$(wildcard *.hpp))
CXX ?= g++ 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) ifeq ($(DEBUG),1)
CXXFLAGS += -D DEBUG -O0 CXXFLAGS += -D DEBUG -O0
else else
CXXFLAGS += -D NDEBUG -O3 CXXFLAGS += -D NDEBUG -O3
endif endif
LDLIBS := -lcairo -lscscreensaver -lscnumerics %.o: %.cpp
$(CXX) $(CXXFLAGS) -o $@ -MMD -MP -MT $@ -MF $*.dep -c $<
RM := /bin/rm -f %.dep: ;
INSTALL := /usr/bin/install -c
.PHONY: all clean install .PHONY: all clean install uninstall
all: $(REALNAME) all: $(PLUGIN)
$(REALNAME): $(OBJS) $(DEPS) $(PLUGIN): $(OBJS)
ifeq ($(UNAME_S),Darwin) 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 else
$(CXX) -g -shared -Wl,-soname,$(SONAME) -o $(REALNAME) $(LDFLAGS) $(LDLIBS) $(OBJS) $(CXX) -g3 -shared -o $(PLUGIN) $(LDFLAGS) $(OBJS) $(LDLIBS)
endif endif
%.o: %.cpp %.d Makefile -include $(DEPS)
$(CXX) $(CXXFLAGS) -MMD -MP -MT $@ -MF $*.d -c $<
-include *.d
%.d: ;
clean: clean:
$(RM) $(OBJS) $(DEPS) $(REALNAME) rm -f $(OBJS) $(DEPS) $(PLUGIN)
install: $(REALNAME) $(INSTALLDIR):
$(INSTALL) -d $(LIBDIR) install -m 0755 -d $@
$(INSTALL) -m 644 $(REALNAME) $(LIBDIR)/$(LIBNAME).saver
$(INSTALL) -m 644 $(LIBNAME).json $(LIBDIR) 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)) include premake.make
MAJOR := 1
MINOR := 0.0
UNAME_S := $(shell uname -s) # some important install locations
PREFIX ?= /usr/local
ifeq ($(UNAME_S),Darwin) DATADIR ?= $(PREFIX)/share
LINKERNAME := $(LIBNAME).dylib INSTALLDIR ?= $(DATADIR)/$(INSTALLDIRNAME)
SONAME := $(LIBNAME).$(MAJOR).dylib
REALNAME := $(LINKERNAME)
else
LINKERNAME := $(LIBNAME).so
SONAME := $(LINKERNAME).$(MAJOR)
REALNAME := $(SONAME).$(MINOR)
endif
PREFIX ?= ../..
LIBDIR ?= $(PREFIX)/plugins
SRCS := $(wildcard *.cpp) SRCS := $(wildcard *.cpp)
OBJS := $(subst .cpp,.o,$(SRCS)) OBJS := $(SRCS:.cpp=.o)
DEPS := $(subst .cpp,.d,$(SRCS)) DEPS := $(SRCS:.cpp=.dep)
HDRS := $(filter-out $(LIBNAME).hpp,$(wildcard *.hpp))
CXX ?= g++ 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) ifeq ($(DEBUG),1)
CXXFLAGS += -D DEBUG -O0 CXXFLAGS += -D DEBUG -O0
else else
CXXFLAGS += -D NDEBUG -O3 CXXFLAGS += -D NDEBUG -O3
endif endif
LDLIBS := -lcairo -lscscreensaver %.o: %.cpp
$(CXX) $(CXXFLAGS) -o $@ -MMD -MP -MT $@ -MF $*.dep -c $<
RM := /bin/rm -f %.dep: ;
INSTALL := /usr/bin/install -c
.PHONY: all clean install .PHONY: all clean install uninstall
all: $(REALNAME) all: $(PLUGIN)
$(REALNAME): $(OBJS) $(DEPS) $(PLUGIN): $(OBJS)
ifeq ($(UNAME_S),Darwin) 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 else
$(CXX) -g -shared -Wl,-soname,$(SONAME) -o $(REALNAME) $(LDFLAGS) $(LDLIBS) $(OBJS) $(CXX) -g3 -shared -o $(PLUGIN) $(LDFLAGS) $(OBJS) $(LDLIBS)
endif endif
%.o: %.cpp %.d Makefile -include $(DEPS)
$(CXX) $(CXXFLAGS) -MMD -MP -MT $@ -MF $*.d -c $<
-include *.d
%.d: ;
clean: clean:
$(RM) $(OBJS) $(DEPS) $(REALNAME) rm -f $(OBJS) $(DEPS) $(PLUGIN)
install: $(REALNAME) $(INSTALLDIR):
$(INSTALL) -d $(LIBDIR) install -m 0755 -d $@
$(INSTALL) -m 644 $(REALNAME) $(LIBDIR)/$(LIBNAME).saver
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)) include premake.make
MAJOR := 1
MINOR := 0.0
UNAME_S := $(shell uname -s) # some important install locations
PREFIX ?= /usr/local
ifeq ($(UNAME_S),Darwin) DATADIR ?= $(PREFIX)/share
LINKERNAME := $(LIBNAME).dylib INSTALLDIR ?= $(DATADIR)/$(INSTALLDIRNAME)
SONAME := $(LIBNAME).$(MAJOR).dylib
REALNAME := $(LINKERNAME)
else
LINKERNAME := $(LIBNAME).so
SONAME := $(LINKERNAME).$(MAJOR)
REALNAME := $(SONAME).$(MINOR)
endif
PREFIX ?= ../..
LIBDIR ?= $(PREFIX)/plugins
SRCS := $(wildcard *.cpp) SRCS := $(wildcard *.cpp)
OBJS := $(subst .cpp,.o,$(SRCS)) OBJS := $(SRCS:.cpp=.o)
DEPS := $(subst .cpp,.d,$(SRCS)) DEPS := $(SRCS:.cpp=.dep)
HDRS := $(filter-out $(LIBNAME).hpp,$(wildcard *.hpp))
CXX ?= g++ 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) ifeq ($(DEBUG),1)
CXXFLAGS += -D DEBUG -O0 CXXFLAGS += -D DEBUG -O0
else else
CXXFLAGS += -D NDEBUG -O3 CXXFLAGS += -D NDEBUG -O3
endif endif
LDLIBS := -lm -lcairo -lscscreensaver %.o: %.cpp
$(CXX) $(CXXFLAGS) -o $@ -MMD -MP -MT $@ -MF $*.dep -c $<
RM := /bin/rm -f %.dep: ;
INSTALL := /usr/bin/install -c
.PHONY: all clean install .PHONY: all clean install uninstall
all: $(REALNAME) all: $(PLUGIN)
$(REALNAME): $(OBJS) $(DEPS) $(PLUGIN): $(OBJS)
ifeq ($(UNAME_S),Darwin) 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 else
$(CXX) -g -shared -Wl,-soname,$(SONAME) -o $(REALNAME) $(LDFLAGS) $(LDLIBS) $(OBJS) $(CXX) -g3 -shared -o $(PLUGIN) $(LDFLAGS) $(OBJS) $(LDLIBS)
endif endif
%.o: %.cpp %.d Makefile -include $(DEPS)
$(CXX) $(CXXFLAGS) -MMD -MP -MT $@ -MF $*.d -c $<
-include *.d
%.d: ;
clean: clean:
$(RM) $(OBJS) $(DEPS) $(REALNAME) rm -f $(OBJS) $(DEPS) $(PLUGIN)
install: $(REALNAME) $(INSTALLDIR):
$(INSTALL) -d $(LIBDIR) install -m 0755 -d $@
$(INSTALL) -m 644 $(REALNAME) $(LIBDIR)/$(LIBNAME).saver
$(INSTALL) -m 644 $(LIBNAME).json $(LIBDIR) 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