--- Makefile.org 2008-02-14 07:39:18.000000000 -0500 +++ Makefile 2008-11-12 18:30:48.000000000 -0500 @@ -15,16 +15,19 @@ SHELL=/bin/sh # To assist in cross-compiling -CC=gcc -AR=ar -RANLIB=ranlib -LDFLAGS= +CC=mipsel-linux-gcc +AR=mipsel-linux-ar +RANLIB=mipsel-linux-ranlib +# Change to -Bstatic for non-shared link. +LDFLAGS=-Bdynamic +# Change .so.1.0.5 to .a for non-shared link. +LIB=libbz2.so.1.0.5 BIGFILES=-D_FILE_OFFSET_BITS=64 CFLAGS=-Wall -Winline -O2 -g $(BIGFILES) # Where you want it installed when you do 'make install' -PREFIX=/usr/local +PREFIX=/mnt OBJS= blocksort.o \ @@ -35,14 +38,19 @@ decompress.o \ bzlib.o -all: libbz2.a bzip2 bzip2recover test +all: $(LIB) bzip2 bzip2recover -bzip2: libbz2.a bzip2.o - $(CC) $(CFLAGS) $(LDFLAGS) -o bzip2 bzip2.o -L. -lbz2 +bzip2: $(LIB) bzip2.o + $(CC) $(CFLAGS) $(LDFLAGS) -o bzip2 bzip2.o $(LIB) bzip2recover: bzip2recover.o $(CC) $(CFLAGS) $(LDFLAGS) -o bzip2recover bzip2recover.o +libbz2.so.1.0.5: $(OBJS) + $(CC) -shared -Wl,-soname -Wl,libbz2.so.1.0 -o libbz2.so.1.0.5 $(OBJS) + rm -f libbz2.so.1.0 + ln -s libbz2.so.1.0.5 libbz2.so.1.0 + libbz2.a: $(OBJS) rm -f libbz2.a $(AR) cq libbz2.a $(OBJS) @@ -87,8 +95,11 @@ chmod a+r $(PREFIX)/man/man1/bzip2.1 cp -f bzlib.h $(PREFIX)/include chmod a+r $(PREFIX)/include/bzlib.h - cp -f libbz2.a $(PREFIX)/lib - chmod a+r $(PREFIX)/lib/libbz2.a + cp -f $(LIB) $(PREFIX)/lib + chmod a+r $(PREFIX)/lib/$(LIB) + if ( test -f $(PREFIX)/lib/libbz2.so.1.0.5 ) ; \ + then rm -f $(PREFIX)/lib/libbz2.so.1.0 ; \ + ln -s $(PREFIX)/lib/libbz2.so.1.0.5 $(PREFIX)/lib/libbz2.so.1.0 ; fi cp -f bzgrep $(PREFIX)/bin/bzgrep ln -s -f $(PREFIX)/bin/bzgrep $(PREFIX)/bin/bzegrep ln -s -f $(PREFIX)/bin/bzgrep $(PREFIX)/bin/bzfgrep @@ -109,9 +120,8 @@ echo ".so man1/bzdiff.1" > $(PREFIX)/man/man1/bzcmp.1 clean: - rm -f *.o libbz2.a bzip2 bzip2recover \ - sample1.rb2 sample2.rb2 sample3.rb2 \ - sample1.tst sample2.tst sample3.tst + rm -f *.o libbz2.so.1.0.5 libbz2.so.1.0 libbz2.a bzip2 bzip2recover \ + sample1.rb2 sample2.rb2 sample3.rb2 sample1.tst sample2.tst sample3.tst blocksort.o: blocksort.c @cat words0