Description: add static link to libbam.a
 The Debian libbam package only provides a static library to link to,
 adding this to the Makefile.
Author: Sascha Steinbiss <steinbiss@zbh.uni-hamburg.de>

--- a/Makefile
+++ b/Makefile
@@ -195,7 +195,7 @@
 # add necessary shared lib dependencies then not building them ourselves
 ifeq ($(useshared),yes)
   DEPLIBS:=-lbz2 -lz -lexpat -llua5.1-lpeg -llua5.1 -llua5.1-md5 \
-           -llua5.1-filesystem -llua5.1-des56 -lbam -ltre -lm -lpthread
+           -llua5.1-filesystem -llua5.1-des56 -ltre -lm -lpthread
 else
   DEPLIBS:=
 endif
@@ -564,6 +564,10 @@
 	@$(RANLIB) $@
 endif
 
+ifeq ($(useshared),yes)
+  ADDITIONAL_STATIC_DEPS:=/usr/lib/libbam.a
+endif
+
 lib/libgenometools.a: obj/gt_config.h  $(LIBGENOMETOOLS_OBJ)
 	@echo "[link $(@F)]"
 	@test -d $(@D) || mkdir -p $(@D)
@@ -582,13 +586,14 @@
                                           $(LIBGENOMETOOLS_OBJ) \
                                           $(ADDITIONAL_SO_DEPS) \
                                           $(ADDITIONAL_ZLIBS) \
+                                          $(ADDITIONAL_STATIC_DEPS) \
                                           $(VERSION_SCRIPT)
 	@echo "[link $(@F)]"
 	@test -d $(@D) || mkdir -p $(@D)
 	@$(CC) $(EXP_LDFLAGS) $(VERSION_SCRIPT_PARAM) \
 	  $(GT_LDFLAGS) $(ADDITIONAL_SO_DEPS) $(SHARED) \
 		-Wl,-soname,$(notdir $@)$(SONAME_VERSION) $(LIBGENOMETOOLS_OBJ) \
-		-o $@$(SONAME_VERSION) $(GTSHAREDLIB_LIBDEP)
+		-o $@$(SONAME_VERSION) $(GTSHAREDLIB_LIBDEP) $(ADDITIONAL_STATIC_DEPS)
 
 define PROGRAM_template
 $(1): $(2)
@@ -601,46 +606,55 @@
 
 $(eval $(call PROGRAM_template, bin/gt, $(GTMAIN_OBJ) $(TOOLS_OBJ) \
                                         lib/libgenometools.a \
+                                        $(ADDITIONAL_STATIC_DEPS) \
                                         $(ADDITIONAL_ZLIBS)))
 
 $(eval $(call PROGRAM_template, bin/examples/custom_stream, \
                                 obj/src/examples/custom_stream.o \
                                 lib/libgenometools.a\
+                                $(ADDITIONAL_STATIC_DEPS) \
                                 $(ADDITIONAL_ZLIBS)))
 
 $(eval $(call PROGRAM_template, bin/examples/gff3sort, \
                                 obj/src/examples/gff3sort.o \
                                 lib/libgenometools.a \
+                                $(ADDITIONAL_STATIC_DEPS) \
                                 $(ADDITIONAL_ZLIBS)))
 
 $(eval $(call PROGRAM_template, bin/examples/gff3validator, \
                                 obj/src/examples/gff3validator.o \
                                 lib/libgenometools.a \
+                                $(ADDITIONAL_STATIC_DEPS) \
                                 $(ADDITIONAL_ZLIBS)))
 
 $(eval $(call PROGRAM_template, bin/examples/noop, \
                                 obj/src/examples/noop.o \
                                 lib/libgenometools.a \
+                                $(ADDITIONAL_STATIC_DEPS) \
                                 $(ADDITIONAL_ZLIBS)))
 
 $(eval $(call PROGRAM_template, bin/examples/sketch_constructed, \
                                 obj/src/examples/sketch_constructed.o \
                                 lib/libgenometools.a \
+                                $(ADDITIONAL_STATIC_DEPS) \
                                 $(ADDITIONAL_ZLIBS)))
 
 $(eval $(call PROGRAM_template, bin/examples/sketch_parsed, \
                                 obj/src/examples/sketch_parsed.o \
                                 lib/libgenometools.a \
+                                $(ADDITIONAL_STATIC_DEPS) \
                                 $(ADDITIONAL_ZLIBS)))
 
 $(eval $(call PROGRAM_template, bin/examples/sketch_parsed_with_ctrack, \
                                 obj/src/examples/sketch_parsed_with_ctrack.o \
                                 lib/libgenometools.a \
+                                $(ADDITIONAL_STATIC_DEPS) \
                                 $(ADDITIONAL_ZLIBS)))
 
 $(eval $(call PROGRAM_template, bin/examples/sketch_parsed_with_ordering, \
                                 obj/src/examples/sketch_parsed_with_ordering.o \
                                 lib/libgenometools.a \
+                                $(ADDITIONAL_STATIC_DEPS) \
                                 $(ADDITIONAL_ZLIBS)))
 
 bin/lua: $(LUAMAIN_OBJ)
