From 7f6dabcd0c10f8dd0ab7828722543fa23478dba5 Mon Sep 17 00:00:00 2001 From: Laurent Bercot Date: Sun, 27 Apr 2025 19:00:05 +0000 Subject: Prepare for 0.5.6.0, add pkg-config support, etc. Signed-off-by: Laurent Bercot --- Makefile | 79 ++++++++++++++++++++++++++++++++++++++++++++++++++-------------- 1 file changed, 62 insertions(+), 17 deletions(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index b82361b..752b8ba 100644 --- a/Makefile +++ b/Makefile @@ -12,28 +12,65 @@ ifeq "" "$(strip $(filter $(make_need), $(firstword $(sort $(make_need) $(MAKE_V fail := $(error Your make ($(MAKE_VERSION)) is too old. You need $(make_need) or newer) endif +uniq = $(if $1,$(firstword $1) $(call uniq,$(filter-out $(firstword $1),$1))) + CC = $(error Please use ./configure first) STATIC_LIBS := SHARED_LIBS := INTERNAL_LIBS := EXTRA_TARGETS := +PC_TARGETS := LIB_DEFS := +BIN_SYMLINKS := +TEST_BINS := define library_definition -LIB$(firstword $(subst =, ,$(1))) := lib$(lastword $(subst =, ,$(1))).$(if $(DO_ALLSTATIC),a,so).xyzzy +LIB$(1) := lib$(2).$(if $(DO_ALLSTATIC),a,so).xyzzy ifdef DO_SHARED -SHARED_LIBS += lib$(lastword $(subst =, ,$(1))).so.xyzzy +SHARED_LIBS += lib$(2).so.xyzzy endif ifdef DO_STATIC -STATIC_LIBS += lib$(lastword $(subst =, ,$(1))).a.xyzzy +STATIC_LIBS += lib$(2).a.xyzzy +endif +ifdef DO_PKGCONFIG +PC_TARGETS += lib$(2).pc endif + +lib$(2).pc: + exec env \ + library="$(2)" \ + includedir="$(includedir)" \ + dynlibdir="$(dynlibdir)" \ + libdir="$(libdir)" \ + extra_includedirs="$(extra_includedirs)" \ + extra_libdirs="$(extra_libdirs)" \ + extra_libs="$$(strip $$(EXTRA_LIBS))" \ + description="$$($(1)_DESCRIPTION)" \ + url="$$($(1)_URL)" \ + ldlibs="$(LDLIBS)" \ + ./tools/gen-dotpc.sh > $$@.tmp + exec mv -f $$@.tmp $$@ + +endef + +define binary_installation_rule +$(DESTDIR)$(1)/$(2): ./$(2) package/modes + exec $(INSTALL) -D -m 600 $$< $$@ + grep -- ^$$(@F) < package/modes | { read name mode owner && \ + if [ x$$$$owner != x ] ; then chown -- $$$$owner $$@ ; fi && \ + chmod $$$$mode $$@ ; } +endef + +define symlink_installation_rule +$(DESTDIR)$(1)/$(2): $(DESTDIR)$(1)/$(SYMLINK_TARGET_$(2)) + exec $(INSTALL) -l $$(