summary refs log tree commit diff
diff options
context:
space:
mode:
authorLaurent Bercot <ska-skaware@skarnet.org>2023-10-30 21:31:26 +0000
committerLaurent Bercot <ska@appnovation.com>2023-10-30 21:31:26 +0000
commit6f100ad87c56b0d93436f439628dd076aced2ae9 (patch)
treeb66d02e6a5730571db40ef81d71c0938c18d0bbf
parent813ab6fe79edab2af685bcb7e025966f163da672 (diff)
downloadexecline-6f100ad87c56b0d93436f439628dd076aced2ae9.tar.gz
execline-6f100ad87c56b0d93436f439628dd076aced2ae9.tar.xz
execline-6f100ad87c56b0d93436f439628dd076aced2ae9.zip
Fix multicall symlink installation
Signed-off-by: Laurent Bercot <ska@appnovation.com>
-rw-r--r--Makefile27
1 files changed, 20 insertions, 7 deletions
diff --git a/Makefile b/Makefile
index b82361b..f158e82 100644
--- a/Makefile
+++ b/Makefile
@@ -19,6 +19,7 @@ SHARED_LIBS :=
 INTERNAL_LIBS :=
 EXTRA_TARGETS :=
 LIB_DEFS :=
+BIN_SYMLINKS :=
 
 define library_definition
 LIB$(firstword $(subst =, ,$(1))) := lib$(lastword $(subst =, ,$(1))).$(if $(DO_ALLSTATIC),a,so).xyzzy
@@ -30,6 +31,19 @@ STATIC_LIBS += lib$(lastword $(subst =, ,$(1))).a.xyzzy
 endif
 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 $$(<F) $$@
+endef
+
 -include config.mak
 include package/targets.mak
 
@@ -53,6 +67,10 @@ RANLIB := $(CROSS_COMPILE)ranlib
 STRIP := $(CROSS_COMPILE)strip
 INSTALL := ./tools/install.sh
 
+$(foreach var,$(BIN_TARGETS),$(eval $(call binary_installation_rule,$(bindir),$(var))))
+$(foreach var,$(LIBEXEC_TARGETS),$(eval $(call binary_installation_rule,$(libexecdir),$(var))))
+$(foreach var,$(BIN_SYMLINKS),$(eval $(call symlink_installation_rule,$(bindir),$(var))))
+
 ALL_BINS := $(LIBEXEC_TARGETS) $(BIN_TARGETS)
 ALL_LIBS := $(SHARED_LIBS) $(STATIC_LIBS) $(INTERNAL_LIBS)
 ALL_INCLUDES := $(wildcard src/include/$(package)/*.h)
@@ -81,10 +99,11 @@ ifneq ($(strip $(ALL_BINS)$(SHARED_LIBS)),)
 	exec $(STRIP) -R .note -R .comment $(ALL_BINS) $(SHARED_LIBS)
 endif
 
-install: install-dynlib install-libexec install-bin install-lib install-include
+install: install-dynlib install-libexec install-bin install-symlinks install-lib install-include
 install-dynlib: $(SHARED_LIBS:lib%.so.xyzzy=$(DESTDIR)$(dynlibdir)/lib%.so)
 install-libexec: $(LIBEXEC_TARGETS:%=$(DESTDIR)$(libexecdir)/%)
 install-bin: $(BIN_TARGETS:%=$(DESTDIR)$(bindir)/%)
+install-symlinks: $(BIN_SYMLINKS:%=$(DESTDIR)$(bindir)/%)
 install-lib: $(STATIC_LIBS:lib%.a.xyzzy=$(DESTDIR)$(libdir)/lib%.a)
 install-include: $(ALL_INCLUDES:src/include/$(package)/%.h=$(DESTDIR)$(includedir)/$(package)/%.h) $(EXTRA_INCLUDES:src/include/%.h=$(DESTDIR)$(includedir)/%.h)
 
@@ -112,12 +131,6 @@ $(DESTDIR)$(dynlibdir)/lib%.so $(DESTDIR)$(dynlibdir)/lib%.so.$(version_M): lib%
 	$(INSTALL) -l $(@F).$(version) $@.$(version_M) && \
 	exec $(INSTALL) -l $(@F).$(version_M) $@
 
-$(DESTDIR)$(libexecdir)/% $(DESTDIR)$(bindir)/%: % 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 $@ ; }
-
 $(DESTDIR)$(libdir)/lib%.a: lib%.a.xyzzy
 	exec $(INSTALL) -D -m 644 $< $@