public inbox for bzip2-devel@sourceware.org
 help / color / mirror / Atom feed
From: ~eschwartz <eschwartz@git.sr.ht>
To: bzip2-devel@sourceware.org
Cc: eschwartz93@gmail.com
Subject: [PATCH bzip2 3/6] shared Makefile: add install rule
Date: Thu, 09 Jun 2022 00:50:19 -0400	[thread overview]
Message-ID: <165475384722.17277.18269615533597437835-2@git.sr.ht> (raw)
In-Reply-To: <165475384722.17277.18269615533597437835-0@git.sr.ht>

From: Eli Schwartz <eschwartz93@gmail.com>

This will install the shared components (possibly overwriting these
components installed by the static Makefile).

As a prerequisite, the build rules must be refactored to use file-based
targets.
---
 Makefile-libbz2_so.in | 20 ++++++++++++++++++--
 1 file changed, 18 insertions(+), 2 deletions(-)

diff --git a/Makefile-libbz2_so.in b/Makefile-libbz2_so.in
index 0d2cf8d..21fbe7c 100644
--- a/Makefile-libbz2_so.in
+++ b/Makefile-libbz2_so.in
@@ -26,6 +26,11 @@ CC=@CC@
 BIGFILES=-D_FILE_OFFSET_BITS=64
 CFLAGS=-fpic -fPIC -Wall -Winline @CFLAGS@ $(BIGFILES)
 
+prefix = @prefix@
+exec_prefix = @exec_prefix@
+bindir = @bindir@
+libdir = @libdir@
+
 OBJS= blocksort.o  \
       huffman.o    \
       crctable.o   \
@@ -34,12 +39,23 @@ OBJS= blocksort.o  \
       decompress.o \
       bzlib.o
 
-all: $(OBJS)
+all: libbz2.so.@PACKAGE_VERSION@ bzip2-shared
+
+libbz2.so.@PACKAGE_VERSION@: $(OBJS)
 	$(CC) -shared -Wl,-soname -Wl,libbz2.so.1.0 -o libbz2.so.@PACKAGE_VERSION@ $(OBJS)
-	$(CC) $(CFLAGS) -o bzip2-shared bzip2.c libbz2.so.@PACKAGE_VERSION@
 	rm -f libbz2.so.1.0
 	ln -s libbz2.so.@PACKAGE_VERSION@ libbz2.so.1.0
 
+bzip2-shared: libbz2.so.@PACKAGE_VERSION@
+	$(CC) $(CFLAGS) -o bzip2-shared bzip2.c libbz2.so.@PACKAGE_VERSION@
+
+install: all
+	if ( test ! -d $(DESTDIR)$(bindir) ) ; then mkdir -p $(DESTDIR)$(bindir) ; fi
+	if ( test ! -d $(DESTDIR)$(libdir) ) ; then mkdir -p $(DESTDIR)$(libdir) ; fi
+	cp -f bzip2-shared $(DESTDIR)$(bindir)/bzip2
+	cp -f libbz2.so.@PACKAGE_VERSION@ $(DESTDIR)$(libdir)
+	ln -s -f libbz2.so.@PACKAGE_VERSION@ $(DESTDIR)$(libdir)/libbz2.so.1.0
+
 clean:
 	rm -f $(OBJS) bzip2.o libbz2.so.@PACKAGE_VERSION@ libbz2.so.1.0 bzip2-shared
 
-- 
2.34.2


      parent reply	other threads:[~2022-06-09  5:50 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-03  3:45 [PATCH bzip2 1/6] install relative symlinks ~eschwartz
2022-06-03  4:20 ` [PATCH bzip2 2/6] port the build configuration to autoconf ~eschwartz
2022-06-09  5:56   ` Eli Schwartz
2022-06-03  4:48 ` [PATCH bzip2 4/6] make a couple program aliases symlinks instead of copies ~eschwartz
2022-06-03  4:54 ` [PATCH bzip2 5/6] install man page symlinks for a couple more symlinked commands ~eschwartz
2022-06-03  5:09 ` [PATCH bzip2 6/6] install a pkg-config file with instructions for linking to libbz2 ~eschwartz
2022-06-09  5:52   ` Eli Schwartz
2022-10-23 16:03     ` Sam James
2022-06-09  4:50 ` ~eschwartz [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=165475384722.17277.18269615533597437835-2@git.sr.ht \
    --to=eschwartz@git.sr.ht \
    --cc=bzip2-devel@sourceware.org \
    --cc=eschwartz93@gmail.com \
    --cc=eschwartz@archlinux.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).