Modify tabix to use libtool
authorDiane Trout <diane@caltech.edu>
Sat, 22 Dec 2012 00:17:49 +0000 (16:17 -0800)
committerDiane Trout <diane@caltech.edu>
Sat, 22 Dec 2012 00:17:49 +0000 (16:17 -0800)
I also modifed the make file to take an option to build the shared
library.

debian/patches/series
debian/patches/use-libtool [new file with mode: 0644]

index a7b179ab10676168c8830af05142f325759b3038..347a714f9accf6087738aefff063bd93b9d9e611 100644 (file)
@@ -1 +1,2 @@
+use-libtool
 use-dpkg-buildflags.patch
diff --git a/debian/patches/use-libtool b/debian/patches/use-libtool
new file mode 100644 (file)
index 0000000..eeed40f
--- /dev/null
@@ -0,0 +1,98 @@
+Index: tabix/Makefile
+===================================================================
+--- tabix.orig/Makefile        2012-12-21 16:05:38.710131804 -0800
++++ tabix/Makefile     2012-12-21 16:08:18.234126173 -0800
+@@ -1,47 +1,47 @@
+-CC=                   gcc
+-CFLAGS=               -g -Wall -O2 -fPIC #-m64 #-arch ppc
++CC=           gcc
++CFLAGS=               -g -Wall -O2
+ DFLAGS=               -D_FILE_OFFSET_BITS=64 -D_USE_KNETFILE -DBGZF_CACHE
+-LOBJS=                bgzf.o kstring.o knetfile.o index.o bedidx.o
+-AOBJS=                main.o
++LOBJS=                bgzf.lo kstring.lo knetfile.lo index.lo bedidx.lo
++AOBJS=                main.lo
++BOBJS=                bgzip.lo bgzf.lo
+ PROG=         tabix bgzip
+ INCLUDES=
+ SUBDIRS=      .
+ LIBPATH=
+-LIBCURSES=    
++LIBCURSES=
++LIBNAME=      libtabix.la
++LIBVERSION=   1
++
++# catch platform settings
++UNAME := $(shell uname)
++ifeq ($(UNAME), Darwin)
++LIBTOOL :=    glibtool
++else
++LIBTOOL :=    libtool
++endif
++LTFLAGS=      --tag=CC
++
++ifdef SHARED
++CFLAGS+=      -shared
++else
++CFLAGS+=      -static
++endif
++
++.SUFFIXES:.c .o .lo
++
++.c.lo:
++              $(LIBTOOL) $(LTFLAGS) --mode=compile $(CC) -c $(CFLAGS) $(DFLAGS) $(INCLUDES) $<
++
++all:$(PROG) $(LIBNAME)
+-.SUFFIXES:.c .o
++$(LIBNAME):$(LOBJS)
++      $(LIBTOOL) $(LTFLAGS) --mode=link $(CC) $(CFLAGS) -version-info $(LIBVERSION) -rpath /usr/lib $(LOBJS) -o $@ -lc -lz
+-.c.o:
+-              $(CC) -c $(CFLAGS) $(DFLAGS) $(INCLUDES) $< -o $@
++tabix:$(AOBJS) $(LIBNAME)
++      $(LIBTOOL) $(LTFLAGS) --mode=link $(CC) $(CFLAGS) -o $@ $(AOBJS) $(LIBNAME) -lm -lz
+-all-recur lib-recur clean-recur cleanlocal-recur install-recur:
+-              @target=`echo $@ | sed s/-recur//`; \
+-              wdir=`pwd`; \
+-              list='$(SUBDIRS)'; for subdir in $$list; do \
+-                      cd $$subdir; \
+-                      $(MAKE) CC="$(CC)" DFLAGS="$(DFLAGS)" CFLAGS="$(CFLAGS)" \
+-                              INCLUDES="$(INCLUDES)" LIBPATH="$(LIBPATH)" $$target || exit 1; \
+-                      cd $$wdir; \
+-              done;
+-
+-all:$(PROG)
+-
+-lib:libtabix.a
+-
+-libtabix.so.1:$(LOBJS)
+-              $(CC) -shared -Wl,-soname,libtabix.so -o $@ $(LOBJS) -lc -lz
+-
+-libtabix.1.dylib:$(LOBJS)
+-              libtool -dynamic $(LOBJS) -o $@ -lc -lz
+-
+-libtabix.a:$(LOBJS)
+-              $(AR) -csru $@ $(LOBJS)
+-
+-tabix:lib $(AOBJS)
+-              $(CC) $(CFLAGS) -o $@ $(AOBJS) -L. -ltabix -lm $(LIBPATH) -lz
+-
+-bgzip:bgzip.o bgzf.o knetfile.o
+-              $(CC) $(CFLAGS) -o $@ bgzip.o bgzf.o knetfile.o -lz
++bgzip:$(BOBJS)
++      $(LIBTOOL) $(LTFLAGS) --mode=link $(CC) $(CFLAGS) -o $@  $(BOBJS) $(LIBNAME) -lz
+ TabixReader.class:TabixReader.java
+               javac -cp .:sam.jar TabixReader.java
+@@ -57,7 +57,5 @@
+ tabix.pdf:tabix.tex
+               pdflatex tabix.tex
+-cleanlocal:
+-              rm -fr gmon.out *.o a.out *.dSYM $(PROG) *~ *.a tabix.aux tabix.log tabix.pdf *.class libtabix.*.dylib libtabix.so*
+-
+-clean:cleanlocal-recur
++clean:
++      $(LIBTOOL) --mode=clean rm -fr gmon.out $(LOBJS) $(AOBJS) $(BOBJS) a.out *.dSYM $(PROG) *~ tabix.aux tabix.log tabix.pdf *.class libtabix.la