1Build objects twice for shared and static libraries 2 3The existing Makefile causes problems on MIPS because the same object 4files (not compiled with -fPIC) are used in static and shared libraries. 5MIPS will refuce to link non-pic objects in shared libraries. 6We fix this problems by creating a new rule for the shared library 7and build the shared objects as *.sho instead of *.o. 8Then, we use these objects to create the shared library. 9 10Signed-off-by: Markos Chandras <markos.chandras@imgtec.com> 11 12Index: bzip2-1.0.6/Makefile-libbz2_so 13=================================================================== 14--- bzip2-1.0.6.orig/Makefile-libbz2_so 15+++ bzip2-1.0.6/Makefile-libbz2_so 16@@ -25,13 +25,13 @@ SHELL=/bin/sh 17 CC=gcc 18 override CFLAGS += -fpic -fPIC -Wall 19 20-OBJS= blocksort.o \ 21- huffman.o \ 22- crctable.o \ 23- randtable.o \ 24- compress.o \ 25- decompress.o \ 26- bzlib.o 27+OBJS= blocksort.sho \ 28+ huffman.sho \ 29+ crctable.sho \ 30+ randtable.sho \ 31+ compress.sho \ 32+ decompress.sho \ 33+ bzlib.sho 34 35 all: $(OBJS) 36 $(CC) -shared -Wl,-soname -Wl,libbz2.so.1.0 -o libbz2.so.1.0.6 $(OBJS) 37@@ -45,17 +45,5 @@ install: 38 clean: 39 rm -f $(OBJS) bzip2.o libbz2.so.1.0.6 libbz2.so.1.0 bzip2-shared 40 41-blocksort.o: blocksort.c 42- $(CC) $(CFLAGS) -c blocksort.c 43-huffman.o: huffman.c 44- $(CC) $(CFLAGS) -c huffman.c 45-crctable.o: crctable.c 46- $(CC) $(CFLAGS) -c crctable.c 47-randtable.o: randtable.c 48- $(CC) $(CFLAGS) -c randtable.c 49-compress.o: compress.c 50- $(CC) $(CFLAGS) -c compress.c 51-decompress.o: decompress.c 52- $(CC) $(CFLAGS) -c decompress.c 53-bzlib.o: bzlib.c 54- $(CC) $(CFLAGS) -c bzlib.c 55+%.sho: %.c 56+ $(CC) $(CFLAGS) -o $@ -c $< 57