blob: 31d7542e60c9de15ab9925e622dc555efa8cc8ca [file] [log] [blame]
From 409af8210f2256eed4d2c73083aa75975f03424b Mon Sep 17 00:00:00 2001
From: Fabrice Fontaine <fontaine.fabrice@gmail.com>
Date: Fri, 12 Jul 2019 12:20:38 +0200
Subject: [PATCH] Makefile: add targets to manage static building
Add static-lib, shared-lib, install-static-lib and install-shared-lib
targets to allow the user to build giflib when dynamic library support
is not available or enable on the toolchain
Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
[Dario: make the patch to be applied with fuzz factor 0]
Signed-off-by: Dario Binacchi <dario.binacchi@amarulasolutions.com>
Upstream: https://sourceforge.net/p/giflib/code/merge-requests/7
---
Makefile | 18 ++++++++++++++----
1 file changed, 14 insertions(+), 4 deletions(-)
diff --git a/Makefile b/Makefile
index 87966a96cd4f..4a93aace54b8 100644
--- a/Makefile
+++ b/Makefile
@@ -87,13 +87,20 @@ LIBUTILSO = libutil.$(SOEXTENSION)
LIBUTILSOMAJOR = libutil.$(LIBMAJOR).$(SOEXTENSION)
endif
-all: $(LIBGIFSO) libgif.a $(LIBUTILSO) libutil.a $(UTILS)
+SHARED_LIBS = $(LIBGIFSO) $(LIBUTILSO)
+STATIC_LIBS = libgif.a libutil.a
+
+all: shared-lib static-lib $(UTILS)
ifeq ($(UNAME), Darwin)
else
$(MAKE) -C doc
endif
-$(UTILS):: libgif.a libutil.a
+$(UTILS):: $(STATIC_LIBS)
+
+shared-lib: $(SHARED_LIBS)
+
+static-lib: $(STATIC_LIBS)
$(LIBGIFSO): $(OBJECTS) $(HEADERS)
ifeq ($(UNAME), Darwin)
@@ -116,7 +123,7 @@ libutil.a: $(UOBJECTS) $(UHEADERS)
$(AR) rcs libutil.a $(UOBJECTS)
clean:
- rm -f $(UTILS) $(TARGET) libgetarg.a libgif.a $(LIBGIFSO) libutil.a $(LIBUTILSO) *.o
+ rm -f $(UTILS) $(TARGET) libgetarg.a $(SHARED_LIBS) $(STATIC_LIBS) *.o
rm -f $(LIBGIFSOVER)
rm -f $(LIBGIFSOMAJOR)
rm -fr doc/*.1 *.html doc/staging
@@ -141,12 +148,15 @@ install-bin: $(INSTALLABLE)
install-include:
$(INSTALL) -d "$(DESTDIR)$(INCDIR)"
$(INSTALL) -m 644 gif_lib.h "$(DESTDIR)$(INCDIR)"
-install-lib:
+install-static-lib:
$(INSTALL) -d "$(DESTDIR)$(LIBDIR)"
$(INSTALL) -m 644 libgif.a "$(DESTDIR)$(LIBDIR)/libgif.a"
+install-shared-lib:
+ $(INSTALL) -d "$(DESTDIR)$(LIBDIR)"
$(INSTALL) -m 755 $(LIBGIFSO) "$(DESTDIR)$(LIBDIR)/$(LIBGIFSOVER)"
ln -sf $(LIBGIFSOVER) "$(DESTDIR)$(LIBDIR)/$(LIBGIFSOMAJOR)"
ln -sf $(LIBGIFSOMAJOR) "$(DESTDIR)$(LIBDIR)/$(LIBGIFSO)"
+install-lib: install-static-lib install-shared-lib
install-man:
$(INSTALL) -d "$(DESTDIR)$(MANDIR)/man1"
$(INSTALL) -m 644 $(MANUAL_PAGES) "$(DESTDIR)$(MANDIR)/man1"
--
2.43.0