forked from pool/bzip2
153 lines
4.6 KiB
Diff
153 lines
4.6 KiB
Diff
--- Makefile
|
|
+++ Makefile
|
|
@@ -24,33 +24,50 @@
|
|
CFLAGS=-Wall -Winline -O2 -g $(BIGFILES)
|
|
|
|
# Where you want it installed when you do 'make install'
|
|
-PREFIX=/usr/local
|
|
+PREFIX=/usr
|
|
|
|
|
|
-OBJS= blocksort.o \
|
|
- huffman.o \
|
|
- crctable.o \
|
|
- randtable.o \
|
|
- compress.o \
|
|
- decompress.o \
|
|
- bzlib.o
|
|
+OBJS= blocksort.lo \
|
|
+ huffman.lo \
|
|
+ crctable.lo \
|
|
+ randtable.lo \
|
|
+ compress.lo \
|
|
+ decompress.lo \
|
|
+ bzlib.lo
|
|
+
|
|
+LIB= libbz2.la
|
|
+
|
|
+prefix= /usr
|
|
+bindir= $(prefix)/bin
|
|
+libdir= $(prefix)/lib
|
|
+mandir= $(prefix)/share/man
|
|
+includedir= $(prefix)/include
|
|
+
|
|
+all: $(LIB) bzip2 bzip2recover test
|
|
+
|
|
+install: all test
|
|
+ mkdir -p $(PREFIX)$(bindir)
|
|
+ libtool --mode=install install -m 0755 bzip2 bzip2recover $(PREFIX)$(bindir)
|
|
+ ln -sf bzip2 $(PREFIX)$(bindir)/bunzip2
|
|
+ ln -sf bzip2 $(PREFIX)$(bindir)/bzcat
|
|
+ mkdir -p $(PREFIX)$(mandir)/man1
|
|
+ install -c -m 0644 bzip2.1 $(PREFIX)$(mandir)/man1/bzip2.1
|
|
+ ln -sf bzip2.1 $(PREFIX)$(mandir)/man1/bunzip2.1
|
|
+ ln -sf bzip2.1 $(PREFIX)$(mandir)/man1/bzcat.1
|
|
+ mkdir -p $(PREFIX)$(libdir)
|
|
+ libtool --mode=install install $(LIB) $(PREFIX)$(libdir)
|
|
+ mkdir -p $(PREFIX)$(includedir)
|
|
+ install -c -m 0644 bzlib.h $(PREFIX)$(includedir)
|
|
|
|
-all: libbz2.a bzip2 bzip2recover test
|
|
-
|
|
-bzip2: libbz2.a bzip2.o
|
|
- $(CC) $(CFLAGS) $(LDFLAGS) -o bzip2 bzip2.o -L. -lbz2
|
|
+bzip2: bzip2.o $(LIB)
|
|
+ libtool --mode=link $(CC) $(CFLAGS) -o $@ bzip2.o $(LIB)
|
|
|
|
bzip2recover: bzip2recover.o
|
|
- $(CC) $(CFLAGS) $(LDFLAGS) -o bzip2recover bzip2recover.o
|
|
+ libtool --mode=link $(CC) $(CFLAGS) -o $@ bzip2recover.o
|
|
|
|
-libbz2.a: $(OBJS)
|
|
- rm -f libbz2.a
|
|
- $(AR) cq libbz2.a $(OBJS)
|
|
- @if ( test -f $(RANLIB) -o -f /usr/bin/ranlib -o \
|
|
- -f /bin/ranlib -o -f /usr/ccs/bin/ranlib ) ; then \
|
|
- echo $(RANLIB) libbz2.a ; \
|
|
- $(RANLIB) libbz2.a ; \
|
|
- fi
|
|
+$(LIB): $(OBJS)
|
|
+ libtool --mode=link $(CC) $(CFLAGS) -o $@ $(OBJS) -rpath $(libdir) \
|
|
+ -version-info 1:0:0
|
|
|
|
check: test
|
|
test: bzip2
|
|
@@ -69,70 +86,18 @@
|
|
cmp sample3.tst sample3.ref
|
|
@cat words3
|
|
|
|
-install: bzip2 bzip2recover
|
|
- if ( test ! -d $(PREFIX)/bin ) ; then mkdir -p $(PREFIX)/bin ; fi
|
|
- if ( test ! -d $(PREFIX)/lib ) ; then mkdir -p $(PREFIX)/lib ; fi
|
|
- if ( test ! -d $(PREFIX)/man ) ; then mkdir -p $(PREFIX)/man ; fi
|
|
- if ( test ! -d $(PREFIX)/man/man1 ) ; then mkdir -p $(PREFIX)/man/man1 ; fi
|
|
- if ( test ! -d $(PREFIX)/include ) ; then mkdir -p $(PREFIX)/include ; fi
|
|
- cp -f bzip2 $(PREFIX)/bin/bzip2
|
|
- cp -f bzip2 $(PREFIX)/bin/bunzip2
|
|
- cp -f bzip2 $(PREFIX)/bin/bzcat
|
|
- cp -f bzip2recover $(PREFIX)/bin/bzip2recover
|
|
- chmod a+x $(PREFIX)/bin/bzip2
|
|
- chmod a+x $(PREFIX)/bin/bunzip2
|
|
- chmod a+x $(PREFIX)/bin/bzcat
|
|
- chmod a+x $(PREFIX)/bin/bzip2recover
|
|
- cp -f bzip2.1 $(PREFIX)/man/man1
|
|
- 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 bzgrep $(PREFIX)/bin/bzgrep
|
|
- ln -s -f $(PREFIX)/bin/bzgrep $(PREFIX)/bin/bzegrep
|
|
- ln -s -f $(PREFIX)/bin/bzgrep $(PREFIX)/bin/bzfgrep
|
|
- chmod a+x $(PREFIX)/bin/bzgrep
|
|
- cp -f bzmore $(PREFIX)/bin/bzmore
|
|
- ln -s -f $(PREFIX)/bin/bzmore $(PREFIX)/bin/bzless
|
|
- chmod a+x $(PREFIX)/bin/bzmore
|
|
- cp -f bzdiff $(PREFIX)/bin/bzdiff
|
|
- ln -s -f $(PREFIX)/bin/bzdiff $(PREFIX)/bin/bzcmp
|
|
- chmod a+x $(PREFIX)/bin/bzdiff
|
|
- cp -f bzgrep.1 bzmore.1 bzdiff.1 $(PREFIX)/man/man1
|
|
- chmod a+r $(PREFIX)/man/man1/bzgrep.1
|
|
- chmod a+r $(PREFIX)/man/man1/bzmore.1
|
|
- chmod a+r $(PREFIX)/man/man1/bzdiff.1
|
|
- echo ".so man1/bzgrep.1" > $(PREFIX)/man/man1/bzegrep.1
|
|
- echo ".so man1/bzgrep.1" > $(PREFIX)/man/man1/bzfgrep.1
|
|
- echo ".so man1/bzmore.1" > $(PREFIX)/man/man1/bzless.1
|
|
- echo ".so man1/bzdiff.1" > $(PREFIX)/man/man1/bzcmp.1
|
|
-
|
|
clean:
|
|
- rm -f *.o libbz2.a bzip2 bzip2recover \
|
|
+ rm -f *.o *.a $(LIB) bzip2 bzip2recover \
|
|
sample1.rb2 sample2.rb2 sample3.rb2 \
|
|
sample1.tst sample2.tst sample3.tst
|
|
|
|
-blocksort.o: blocksort.c
|
|
- @cat words0
|
|
- $(CC) $(CFLAGS) -c blocksort.c
|
|
-huffman.o: huffman.c
|
|
- $(CC) $(CFLAGS) -c huffman.c
|
|
-crctable.o: crctable.c
|
|
- $(CC) $(CFLAGS) -c crctable.c
|
|
-randtable.o: randtable.c
|
|
- $(CC) $(CFLAGS) -c randtable.c
|
|
-compress.o: compress.c
|
|
- $(CC) $(CFLAGS) -c compress.c
|
|
-decompress.o: decompress.c
|
|
- $(CC) $(CFLAGS) -c decompress.c
|
|
-bzlib.o: bzlib.c
|
|
- $(CC) $(CFLAGS) -c bzlib.c
|
|
-bzip2.o: bzip2.c
|
|
- $(CC) $(CFLAGS) -c bzip2.c
|
|
-bzip2recover.o: bzip2recover.c
|
|
- $(CC) $(CFLAGS) -c bzip2recover.c
|
|
+.SUFFIXES: .c .o .lo
|
|
+
|
|
+%.o: %.c bzlib.h bzlib_private.h
|
|
+ $(CC) $(CFLAGS) -c $<
|
|
|
|
+%.lo: %.c bzlib.h bzlib_private.h
|
|
+ libtool --mode=compile $(CC) $(CFLAGS) -c $<
|
|
|
|
distclean: clean
|
|
rm -f manual.ps manual.html manual.pdf
|