summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLaurent Bercot <ska-skaware@skarnet.org>2023-10-30 21:43:04 +0000
committerLaurent Bercot <ska@appnovation.com>2023-10-30 21:43:04 +0000
commitc81714aaecf508acfe125147c0b44587d0a5f0de (patch)
tree8d5e1a58adac1a48ecb196d7c2d61d8d35b8df2b
parent7b5f71fd0128ff3f848841b28ce53b0eb9bf3e5e (diff)
downloads6-linux-utils-c81714aaecf508acfe125147c0b44587d0a5f0de.tar.xz
Fix multicall symlinks installation
Signed-off-by: Laurent Bercot <ska@appnovation.com>
-rw-r--r--Makefile27
-rw-r--r--package/targets.mak2
2 files changed, 21 insertions, 8 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 $< $@
diff --git a/package/targets.mak b/package/targets.mak
index f0d2715..3ce021d 100644
--- a/package/targets.mak
+++ b/package/targets.mak
@@ -4,7 +4,7 @@ ifeq ($(MULTICALL),1)
BIN_TARGETS := $(package)
BIN_SYMLINKS := $(notdir $(wildcard src/$(package)/deps-exe/*))
-EXTRA_TEMP := src/multicall/$(package).c
+EXTRA_TARGETS += src/multicall/$(package).c
define symlink_definition
SYMLINK_TARGET_$(1) := $(package)