diff options
author | Laurent Bercot <ska-skaware@skarnet.org> | 2023-10-30 21:31:26 +0000 |
---|---|---|
committer | Laurent Bercot <ska@appnovation.com> | 2023-10-30 21:31:26 +0000 |
commit | 6f100ad87c56b0d93436f439628dd076aced2ae9 (patch) | |
tree | b66d02e6a5730571db40ef81d71c0938c18d0bbf /Makefile | |
parent | 813ab6fe79edab2af685bcb7e025966f163da672 (diff) | |
download | execline-6f100ad87c56b0d93436f439628dd076aced2ae9.tar.xz |
Fix multicall symlink installation
Signed-off-by: Laurent Bercot <ska@appnovation.com>
Diffstat (limited to 'Makefile')
-rw-r--r-- | Makefile | 27 |
1 files changed, 20 insertions, 7 deletions
@@ -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 $< $@ |