--- bzip2-1.0.6/Makefile-libbz2_so.mdkconf~ 2012-12-14 11:05:55.017674909 +0100 +++ bzip2-1.0.6/Makefile-libbz2_so 2012-12-14 11:07:25.803497360 +0100 @@ -20,7 +20,13 @@ # in the file LICENSE. # ------------------------------------------------------------------ -include config.in +top_sourcedir = . +include $(top_sourcedir)/config.in + +prefix = /usr +root_libdir= /$(lib) +libdir = $(prefix)/$(lib) + SHELL=/bin/sh CC=gcc @@ -36,26 +42,27 @@ OBJS= blocksort.o \ decompress.o \ bzlib.o -all: $(OBJS) - $(CC) $(CFLAGS) -shared -Wl,-soname -Wl,libbz2.so.1.0 $(LDFLAGS) -o libbz2.so.1.0.8 $(OBJS) - $(CC) $(CFLAGS) $(LDFLAGS) -o bzip2-shared bzip2.c libbz2.so.1.0.8 +LIBRARY = libbz2.so.1.0.8 + +all: $(LIBRARY) + + +$(LIBRARY): $(OBJS) + $(CC) $(CFLAGS) -shared -Wl,-soname -Wl,libbz2.so.1 $(LDFLAGS) -o $(LIBRARY) $(OBJS) + $(CC) $(CFLAGS) $(LDFLAGS) -o bzip2-shared $(top_sourcedir)/bzip2.c $(LIBRARY) rm -f libbz2.so.1.0 - ln -s libbz2.so.1.0.8 libbz2.so.1.0 + ln -s $(LIBRARY) libbz2.so.1.0 + +install: all + mkdir -p $(DESTDIR)$(root_libdir) + install -m755 $(LIBRARY) $(DESTDIR)$(root_libdir) + ln -sf $(LIBRARY) $(DESTDIR)$(root_libdir)/libbz2.so.1.0 + mkdir -p $(DESTDIR)$(libdir) + rm -f $(DESTDIR)$(libdir)/libbz2.so + ln -sr $(DESTDIR)$(root_libdir)/$(LIBRARY) $(DESTDIR)$(libdir)/libbz2.so clean: - rm -f $(OBJS) bzip2.o libbz2.so.1.0.8 libbz2.so.1.0 bzip2-shared + rm -f $(OBJS) bzip2.o $(LIBRARY) libbz2.so.1.0 bzip2-shared -blocksort.o: blocksort.c - $(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 +%.o: $(top_sourcedir)/%.c $(top_sourcedir)/bzlib.h $(top_sourcedir)/bzlib_private.h + $(CC) $(CFLAGS) -c $< --- bzip2-1.0.6/Makefile.mdkconf~ 2012-12-14 11:05:55.017674909 +0100 +++ bzip2-1.0.6/Makefile 2012-12-14 11:05:55.021674769 +0100 @@ -12,7 +12,8 @@ # in the file LICENSE. # ------------------------------------------------------------------ -include config.in +top_sourcedir=. +include $(top_sourcedir)/config.in # define libdir name lib ?= lib @@ -51,54 +52,59 @@ mandir=$(prefix)/share/man includedir=$(prefix)/include DESTDIR= -all: $(LIB) bzip2 bzip2recover test +all: $(LIB) bzip2 bzip2recover -install: all test +install: all install-bin install-dev install-lib + +install-bin: bzip2 bzip2recover mkdir -p $(DESTDIR)$(bindir) - libtool --mode=install install -s -m 0755 bzip2 $(DESTDIR)$(bindir)/ - libtool --mode=install install -s -m 0755 bzip2recover $(DESTDIR)$(bindir)/ - libtool --mode=install install -m 0755 bzdiff $(DESTDIR)$(bindir)/ - libtool --mode=install install -m 0755 bzmore $(DESTDIR)$(bindir)/ + libtool --mode=install install -m 0755 bzip2 $(DESTDIR)$(bindir)/ + libtool --mode=install install -m 0755 bzip2recover $(DESTDIR)$(bindir)/ + libtool --mode=install install -m 0755 $(top_sourcedir)/bzdiff $(DESTDIR)$(bindir)/ + libtool --mode=install install -m 0755 $(top_sourcedir)/bzmore $(DESTDIR)$(bindir)/ ln -sf bzip2 $(DESTDIR)$(bindir)/bunzip2 ln -sf bzip2 $(DESTDIR)$(bindir)/bzcat mkdir -p $(DESTDIR)$(mandir)/man1 - install -c -m 0644 bzip2.1 $(DESTDIR)$(mandir)/man1/ - install -c -m 0644 bzdiff.1 $(DESTDIR)$(mandir)/man1/ - install -c -m 0644 bzmore.1 $(DESTDIR)$(mandir)/man1/ + install -c -m 0644 $(top_sourcedir)/bzip2.1 $(DESTDIR)$(mandir)/man1/ + install -c -m 0644 $(top_sourcedir)/bzdiff.1 $(DESTDIR)$(mandir)/man1/ + install -c -m 0644 $(top_sourcedir)/bzmore.1 $(DESTDIR)$(mandir)/man1/ ln -sf bzip2.1 $(DESTDIR)$(mandir)/man1/bunzip2.1 ln -sf bzip2.1 $(DESTDIR)$(mandir)/man1/bzcat.1 ln -sf bzip2.1 $(DESTDIR)$(mandir)/man1/bzip2recover.1 + +install-dev: + mkdir -p $(DESTDIR)$(includedir) + install -c -m 0644 $(top_sourcedir)/bzlib.h $(DESTDIR)$(includedir) + +install-lib: $(LIB) mkdir -p $(DESTDIR)$(libdir) libtool --mode=install install $(LIB) $(DESTDIR)$(libdir) - mkdir -p $(DESTDIR)$(includedir) - install -c -m 0644 bzlib.h $(DESTDIR)$(includedir) -bzip2: bzip2.c $(LIB) - libtool --tag=CC --mode=link $(CC) $(CFLAGS) $(LDFLAGS) -o $@ bzip2.c $(LIB) +bzip2: $(top_sourcedir)/bzip2.c $(LIB) + libtool --tag=CC --mode=link $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(top_sourcedir)/bzip2.c $(LIB) -bzip2recover: bzip2recover.c - libtool --tag=CC --mode=link $(CC) $(CFLAGS) $(LDFLAGS) -o $@ bzip2recover.c +bzip2recover: $(top_sourcedir)/bzip2recover.c + libtool --tag=CC --mode=link $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(top_sourcedir)/bzip2recover.c $(LIB): $(OBJS) - libtool --tag=CC --mode=link $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(OBJS) -rpath $(libdir) \ - -version-info 1:0:0 + libtool --tag=CC --mode=link $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(OBJS) -version-info 1:0:6 check: test test: bzip2 - @cat words1 - ./bzip2 -1 < sample1.ref > sample1.rb2 - ./bzip2 -2 < sample2.ref > sample2.rb2 - ./bzip2 -3 < sample3.ref > sample3.rb2 - ./bzip2 -d < sample1.bz2 > sample1.tst - ./bzip2 -d < sample2.bz2 > sample2.tst - ./bzip2 -ds < sample3.bz2 > sample3.tst - cmp sample1.bz2 sample1.rb2 - cmp sample2.bz2 sample2.rb2 - cmp sample3.bz2 sample3.rb2 - cmp sample1.tst sample1.ref - cmp sample2.tst sample2.ref - cmp sample3.tst sample3.ref - @cat words3 + @cat $(top_sourcedir)/words1 + ./bzip2 -1 < $(top_sourcedir)/sample1.ref > sample1.rb2 + ./bzip2 -2 < $(top_sourcedir)/sample2.ref > sample2.rb2 + ./bzip2 -3 < $(top_sourcedir)/sample3.ref > sample3.rb2 + ./bzip2 -d < $(top_sourcedir)/sample1.bz2 > sample1.tst + ./bzip2 -d < $(top_sourcedir)/sample2.bz2 > sample2.tst + ./bzip2 -ds < $(top_sourcedir)/sample3.bz2 > sample3.tst + cmp $(top_sourcedir)/sample1.bz2 sample1.rb2 + cmp $(top_sourcedir)/sample2.bz2 sample2.rb2 + cmp $(top_sourcedir)/sample3.bz2 sample3.rb2 + cmp sample1.tst $(top_sourcedir)/sample1.ref + cmp sample2.tst $(top_sourcedir)/sample2.ref + cmp sample3.tst $(top_sourcedir)/sample3.ref + @cat $(top_sourcedir)/words3 clean: rm -f *.o *.lo *.a $(LIB) bzip2 bzip2recover \ @@ -107,10 +113,10 @@ clean: .SUFFIXES: .c .o .lo -%.o: %.c bzlib.h bzlib_private.h +%.o: $(top_sourcedir)/%.c $(top_sourcedir)/bzlib.h $(top_sourcedir)/bzlib_private.h $(CC) $(CFLAGS) -c $< -%.lo: %.c bzlib.h bzlib_private.h +%.lo: $(top_sourcedir)/%.c $(top_sourcedir)/bzlib.h $(top_sourcedir)/bzlib_private.h libtool --tag=CC --mode=compile $(CC) $(CFLAGS) -c $< distclean: clean @@ -187,10 +193,10 @@ MANUAL_SRCS= bz-common.xsl bz-fo.xsl bz manual: manual.html manual.ps manual.pdf manual.ps: $(MANUAL_SRCS) - ./xmlproc.sh -ps manual.xml + $(top_sourcedir)/xmlproc.sh -ps $(top_sourcedir)/manual.xml manual.pdf: $(MANUAL_SRCS) - ./xmlproc.sh -pdf manual.xml + $(top_sourcedir)/xmlproc.sh -pdf $(top_sourcedir)/manual.xml manual.html: $(MANUAL_SRCS) - ./xmlproc.sh -html manual.xml + $(top_sourcedir)/xmlproc.sh -html $(top_sourcedir)/manual.xml