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
53 # Some utilities are only used internally for testing.
54 # There is a parallel list in doc/Makefile.
55 # These are all candidates for removal in future releases.
56 UTILS = $(INSTALLABLE) \
65 all: libgif.so libgif.a libutil.so libutil.a $(UTILS)
68 $(UTILS):: libgif.a libutil.a
70 libgif.so: $(OBJECTS) $(HEADERS)
71 $(CC) $(CFLAGS) -shared $(LDFLAGS) -Wl,-soname -Wl,libgif.so.$(LIBMAJOR) -o libgif.so $(OBJECTS)
73 libgif.a: $(OBJECTS) $(HEADERS)
74 $(AR) rcs libgif.a $(OBJECTS)
76 libutil.so: $(UOBJECTS) $(UHEADERS)
77 $(CC) $(CFLAGS) -shared $(LDFLAGS) -Wl,-soname -Wl,libutil.so.$(LIBMAJOR) -o libutil.so $(UOBJECTS)
79 libutil.a: $(UOBJECTS) $(UHEADERS)
80 $(AR) rcs libutil.a $(UOBJECTS)
83 rm -f $(UTILS) $(TARGET) libgetarg.a libgif.a libgif.so libutil.a libutil.so *.o
84 rm -f libgif.so.$(LIBMAJOR).$(LIBMINOR).$(LIBPOINT)
85 rm -f libgif.so.$(LIBMAJOR)
86 rm -fr doc/*.1 *.html doc/staging
91 # Installation/uninstallation
93 install: all install-bin install-include install-lib install-man
94 install-bin: $(INSTALLABLE)
95 $(INSTALL) -d "$(DESTDIR)$(BINDIR)"
96 $(INSTALL) $^ "$(DESTDIR)$(BINDIR)"
98 $(INSTALL) -d "$(DESTDIR)$(INCDIR)"
99 $(INSTALL) -m 644 gif_lib.h "$(DESTDIR)$(INCDIR)"
101 $(INSTALL) -d "$(DESTDIR)$(LIBDIR)"
102 # $(INSTALL) -m 644 libgif.a "$(DESTDIR)$(LIBDIR)/libgif.a"
103 $(INSTALL) -m 755 libgif.so "$(DESTDIR)$(LIBDIR)/libgif.so.$(LIBVER)"
104 ln -sf libgif.so.$(LIBVER) "$(DESTDIR)$(LIBDIR)/libgif.so.$(LIBMAJOR)"
105 ln -sf libgif.so.$(LIBMAJOR) "$(DESTDIR)$(LIBDIR)/libgif.so"
107 $(INSTALL) -d "$(DESTDIR)$(MANDIR)/man1"
108 $(INSTALL) -m 644 doc/*.1 "$(DESTDIR)$(MANDIR)/man1"
109 uninstall: uninstall-man uninstall-include uninstall-lib uninstall-bin
111 cd "$(DESTDIR)$(BINDIR)" && rm -f $(INSTALLABLE)
113 rm -f "$(DESTDIR)$(INCDIR)/gif_lib.h"
115 cd "$(DESTDIR)$(LIBDIR)" && \
116 rm -f libgif.a libgif.so libgif.so.$(LIBMAJOR) libgif.so.$(LIBVER)
118 cd "$(DESTDIR)$(MANDIR)/man1" && rm -f $(shell cd doc >/dev/null && echo *.1)
120 # Make distribution tarball
122 # We include all of the XML, and also generated manual pages
123 # 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