1 Build objects twice for shared and static libraries
3 The existing Makefile causes problems on MIPS because the same object
4 files (not compiled with -fPIC) are used in static and shared libraries.
5 MIPS will refuce to link non-pic objects in shared libraries.
6 We fix this problems by creating a new rule for the shared library
7 and build the shared objects as *.sho instead of *.o.
8 Then, we use these objects to create the shared library.
10 Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>
12 Index: 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
18 override CFLAGS += -fpic -fPIC -Wall
27 +OBJS= blocksort.sho \
36 $(CC) -shared -Wl,-soname -Wl,libbz2.so.1.0 -o libbz2.so.1.0.6 $(OBJS)
37 @@ -45,17 +45,5 @@ install:
39 rm -f $(OBJS) bzip2.o libbz2.so.1.0.6 libbz2.so.1.0 bzip2-shared
41 -blocksort.o: blocksort.c
42 - $(CC) $(CFLAGS) -c blocksort.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
54 - $(CC) $(CFLAGS) -c bzlib.c
56 + $(CC) $(CFLAGS) -o $@ -c $<