Build objects twice for shared and static libraries
The existing Makefile causes problems on MIPS because the same object
files (not compiled with -fPIC) are used in static and shared libraries.
MIPS will refuce to link non-pic objects in shared libraries.
We fix this problems by creating a new rule for the shared library
and build the shared objects as *.sho instead of *.o.
Then, we use these objects to create the shared library.
Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>
Index: bzip2-1.0.6/Makefile-libbz2_so
===================================================================
--- bzip2-1.0.6.orig/Makefile-libbz2_so
+++ bzip2-1.0.6/Makefile-libbz2_so
@@ -25,13 +25,13 @@ SHELL=/bin/sh
override CFLAGS += -fpic -fPIC -Wall
$(CC) -shared -Wl,-soname -Wl,libbz2.so.1.0 -o libbz2.so.1.0.6 $(OBJS)
@@ -45,17 +45,5 @@ install:
rm -f $(OBJS) bzip2.o libbz2.so.1.0.6 libbz2.so.1.0 bzip2-shared
-blocksort.o: blocksort.c
- $(CC) $(CFLAGS) -c blocksort.c
- $(CC) $(CFLAGS) -c huffman.c
- $(CC) $(CFLAGS) -c crctable.c
-randtable.o: randtable.c
- $(CC) $(CFLAGS) -c randtable.c
- $(CC) $(CFLAGS) -c compress.c
-decompress.o: decompress.c
- $(CC) $(CFLAGS) -c decompress.c
- $(CC) $(CFLAGS) -c bzlib.c
+ $(CC) $(CFLAGS) -o $@ -c $<