1 # Top-level Unix makefile for the GIFLIB package
2 # Should work for all Unix versions
4 # If your platform has the OpenBSD reallocarray(3) call, you may
5 # add -DHAVE_REALLOCARRAY to CFLAGS to use that, saving a bit
6 # of code space in the shared library.
11 CFLAGS = -std=gnu99 -fPIC -Wall -Wno-format-truncation $(OFLAGS)
18 BINDIR = $(PREFIX)/bin
19 INCDIR = $(PREFIX)/include
20 #LIBDIR = $(PREFIX)/lib
21 MANDIR = $(PREFIX)/share/man
23 # No user-serviceable parts below this line
25 VERSION:=$(shell ./getversion)
29 LIBVER=$(LIBMAJOR).$(LIBMINOR).$(LIBPOINT)
31 SOURCES = dgif_lib.c egif_lib.c gifalloc.c gif_err.c gif_font.c \
32 gif_hash.c openbsd-reallocarray.c
33 HEADERS = gif_hash.h gif_lib.h gif_lib_private.h
34 OBJECTS = $(SOURCES:.c=.o)
36 USOURCES = qprintf.c quantize.c getarg.c
38 UOBJECTS = $(USOURCES:.c=.o)
40 # Some utilities are installed
49 # Some utilities are only used internally for testing.
50 # There is a parallel list in doc/Makefile.
51 # These are all candidates for removal in future releases.
52 UTILS = $(INSTALLABLE) \
64 all: libgif.so libgif.a libutil.so libutil.a $(UTILS)
67 $(UTILS):: libgif.a libutil.a
69 libgif.so: $(OBJECTS) $(HEADERS)
70 $(CC) $(CFLAGS) -shared $(LDFLAGS) -Wl,-soname -Wl,libgif.so.$(LIBMAJOR) -o libgif.so $(OBJECTS)
72 libgif.a: $(OBJECTS) $(HEADERS)
73 $(AR) rcs libgif.a $(OBJECTS)
75 libutil.so: $(UOBJECTS) $(UHEADERS)
76 $(CC) $(CFLAGS) -shared $(LDFLAGS) -Wl,-soname -Wl,libutil.so.$(LIBMAJOR) -o libutil.so $(UOBJECTS)
78 libutil.a: $(UOBJECTS) $(UHEADERS)
79 $(AR) rcs libutil.a $(UOBJECTS)
82 rm -f $(UTILS) $(TARGET) libgetarg.a libgif.a libgif.so libutil.a libutil.so *.o
83 rm -f libgif.so.$(LIBMAJOR).$(LIBMINOR).$(LIBPOINT)
84 rm -f libgif.so.$(LIBMAJOR)
85 rm -fr doc/*.1 *.html doc/staging
90 # Installation/uninstallation
92 install: all install-bin install-include install-lib install-man
93 install-bin: $(INSTALLABLE)
94 $(INSTALL) -d "$(DESTDIR)$(BINDIR)"
95 $(INSTALL) $^ "$(DESTDIR)$(BINDIR)"
97 $(INSTALL) -d "$(DESTDIR)$(INCDIR)"
98 $(INSTALL) -m 644 gif_lib.h "$(DESTDIR)$(INCDIR)"
100 $(INSTALL) -d "$(DESTDIR)$(LIBDIR)"
101 # $(INSTALL) -m 644 libgif.a "$(DESTDIR)$(LIBDIR)/libgif.a"
102 $(INSTALL) -m 755 libgif.so "$(DESTDIR)$(LIBDIR)/libgif.so.$(LIBVER)"
103 ln -sf libgif.so.$(LIBVER) "$(DESTDIR)$(LIBDIR)/libgif.so.$(LIBMAJOR)"
104 ln -sf libgif.so.$(LIBMAJOR) "$(DESTDIR)$(LIBDIR)/libgif.so"
106 $(INSTALL) -d "$(DESTDIR)$(MANDIR)/man1"
107 $(INSTALL) -m 644 doc/*.1 "$(DESTDIR)$(MANDIR)/man1"
108 uninstall: uninstall-man uninstall-include uninstall-lib uninstall-bin
110 cd "$(DESTDIR)$(BINDIR)" && rm -f $(INSTALLABLE)
112 rm -f "$(DESTDIR)$(INCDIR)/gif_lib.h"
114 cd "$(DESTDIR)$(LIBDIR)" && \
115 rm -f libgif.a libgif.so libgif.so.$(LIBMAJOR) libgif.so.$(LIBVER)
117 cd "$(DESTDIR)$(MANDIR)/man1" && rm -f $(shell cd doc >/dev/null && echo *.1)
119 # Make distribution tarball
121 # We include all of the XML, and also generated manual pages
122 # so people working from the distribution tarball won't need xmlto.
136 DSOURCES = Makefile *.[ch]
137 DOCS = doc/*.xml doc/*.1 doc/*.html doc/index.html.in doc/00README doc/Makefile
138 ALL = $(DSOURCES) $(DOCS) tests pic $(EXTRAS)
139 giflib-$(VERSION).tar.gz: $(ALL)
140 $(TAR) --transform='s:^:giflib-$(VERSION)/:' -czf giflib-$(VERSION).tar.gz $(ALL)
141 giflib-$(VERSION).tar.bz2: $(ALL)
142 $(TAR) --transform='s:^:giflib-$(VERSION)/:' -cjf giflib-$(VERSION).tar.bz2 $(ALL)
144 dist: giflib-$(VERSION).tar.gz giflib-$(VERSION).tar.bz2
148 # Check that getversion hasn't gone pear-shaped.
152 # cppcheck should run clean
154 cppcheck --inline-suppr --template gcc --enable=all --suppress=unusedFunction --force *.[ch]
158 $(MAKE) giflib-$(VERSION).tar.gz
159 tar xzvf giflib-$(VERSION).tar.gz
160 $(MAKE) -C giflib-$(VERSION)
161 rm -fr giflib-$(VERSION)
163 # release using the shipper tool
164 release: all distcheck
165 $(MAKE) -C doc website
166 shipper --no-stale version=$(VERSION) | sh -e -x
169 # Refresh the website
171 $(MAKE) -C doc website
172 shipper --no-stale -w version=$(VERSION) | sh -e -x