Date: Sat, 28 Apr 2012 19:09:02 UTC
Description: Fix build system to enable hardening flags
---- a/Makefile
-+++ b/Makefile
-@@ -1,5 +1,8 @@
- CC= gcc
--CFLAGS= -g -Wall -O2 -fPIC #-m64 #-arch ppc
+Index: tabix/Makefile
+===================================================================
+--- tabix.orig/Makefile 2012-12-21 16:51:42.000000000 -0800
++++ tabix/Makefile 2012-12-21 16:54:56.446027398 -0800
+@@ -1,5 +1,6 @@
+ CC= gcc
+-CFLAGS= -g -Wall -O2
+# Use flags when CFLAGS is not already defined in the environment.
+CFLAGS?= -g -Wall -O2
-+# But always append special flags we need.
-+CFLAGS+= -fPIC #-m64 #-arch ppc
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
-@@ -12,7 +15,7 @@
- .SUFFIXES:.c .o
+ LOBJS= bgzf.lo kstring.lo knetfile.lo index.lo bedidx.lo
+ AOBJS= main.lo
+@@ -30,18 +31,18 @@
+ .SUFFIXES:.c .o .lo
- .c.o:
-- $(CC) -c $(CFLAGS) $(DFLAGS) $(INCLUDES) $< -o $@
-+ $(CC) -c $(CPPFLAGS) $(CFLAGS) $(DFLAGS) $(INCLUDES) $< -o $@
+ .c.lo:
+- $(LIBTOOL) $(LTFLAGS) --mode=compile $(CC) -c $(CFLAGS) $(DFLAGS) $(INCLUDES) $<
++ $(LIBTOOL) $(LTFLAGS) --mode=compile $(CC) -c $(CPPFLAGS) $(CFLAGS) $(DFLAGS) $(INCLUDES) $<
- all-recur lib-recur clean-recur cleanlocal-recur install-recur:
- @target=`echo $@ | sed s/-recur//`; \
-@@ -29,19 +32,19 @@
- lib:libtabix.a
+ all:$(PROG) $(LIBNAME)
- libtabix.so.1:$(LOBJS)
-- $(CC) -shared -Wl,-soname,libtabix.so -o $@ $(LOBJS) -lc -lz
-+ $(CC) $(CFLAGS) $(LDFLAGS) -shared -Wl,-soname,libtabix.so -o $@ $(LOBJS) -lc -lz
+ $(LIBNAME):$(LOBJS)
+- $(LIBTOOL) $(LTFLAGS) --mode=link $(CC) $(CFLAGS) -version-info $(LIBVERSION) -rpath /usr/lib $(LOBJS) -o $@ -lc -lz
++ $(LIBTOOL) $(LTFLAGS) --mode=link $(CC) $(CFLAGS) $(LDFLAGS) -version-info $(LIBVERSION) -rpath /usr/lib $(LOBJS) -o $@ -lc -lz
- libtabix.1.dylib:$(LOBJS)
-- libtool -dynamic $(LOBJS) -o $@ -lc -lz
-+ libtool $(CFLAGS) $(LDFLAGS) -dynamic $(LOBJS) -o $@ -lc -lz
+ tabix:$(AOBJS) $(LIBNAME)
+- $(LIBTOOL) $(LTFLAGS) --mode=link $(CC) $(CFLAGS) -o $@ $(AOBJS) $(LIBNAME) -lm -lz
++ $(LIBTOOL) $(LTFLAGS) --mode=link $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(AOBJS) $(LIBNAME) -lm -lz
- libtabix.a:$(LOBJS)
- $(AR) -csru $@ $(LOBJS)
-
- tabix:lib $(AOBJS)
-- $(CC) $(CFLAGS) -o $@ $(AOBJS) -L. -ltabix -lm $(LIBPATH) -lz
-+ $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(AOBJS) -L. -ltabix -lm $(LIBPATH) -lz
-
- bgzip:bgzip.o bgzf.o knetfile.o
-- $(CC) $(CFLAGS) -o $@ bgzip.o bgzf.o knetfile.o -lz
-+ $(CC) $(CFLAGS) $(LDFLAGS) -o $@ bgzip.o bgzf.o knetfile.o -lz
+ bgzip:$(BOBJS)
+- $(LIBTOOL) $(LTFLAGS) --mode=link $(CC) $(CFLAGS) -o $@ $(BOBJS) $(LIBNAME) -lz
++ $(LIBTOOL) $(LTFLAGS) --mode=link $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(BOBJS) $(LIBNAME) -lz
TabixReader.class:TabixReader.java
javac -cp .:sam.jar TabixReader.java