[PATCH bzip2 3/6] shared Makefile: add install rule
~eschwartz
eschwartz@git.sr.ht
Thu Jun 9 04:50:19 GMT 2022
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
More information about the Bzip2-devel
mailing list