--- giflib-5.1.6/Makefile
+++ giflib-5.1.6/Makefile
@@ -61,12 +61,11 @@
 LDLIBS=libgif.a -lm
 
 all: libgif.so libgif.a $(UTILS)
-	$(MAKE) -C doc
 
 $(UTILS):: libgif.a
 
 libgif.so: $(OBJECTS) $(HEADERS)
-	$(CC) $(CFLAGS) -shared $(OFLAGS) -o libgif.so $(OBJECTS)
+	$(CC) $(CFLAGS) -shared $(LDFLAGS) -Wl,-soname,libgif.so.$(LIBMAJOR) -o libgif.so $(OBJECTS)
 
 libgif.a: $(OBJECTS) $(HEADERS)
 	ar rcs libgif.a $(OBJECTS)
