(Debian) added bzexe
[mirror-ossqm-bzip2.git] / Makefile
blobdfcaf20e7402fc48d88a71ee3ba73cd2ba35b8d7
1 # ------------------------------------------------------------------
2 # This file is part of bzip2/libbzip2, a program and library for
3 # lossless, block-sorting data compression.
5 # bzip2/libbzip2 version 1.0.5 of 10 December 2007
6 # Copyright (C) 1996-2007 Julian Seward <jseward@bzip.org>
8 # Please read the WARNING, DISCLAIMER and PATENTS sections in the
9 # README file.
11 # This program is released under the terms of the license contained
12 # in the file LICENSE.
13 # ------------------------------------------------------------------
15 SHELL=/bin/sh
17 # To assist in cross-compiling
18 CC?=gcc
19 AR?=ar
20 RANLIB?=ranlib
21 STRIP?=strip
22 LDFLAGS=
24 BIGFILES=-D_FILE_OFFSET_BITS=64
25 CFLAGS=-Wall -Winline -O2 -g $(BIGFILES)
26 CFLAGS_PIC=-fpic -fPIC
27 DESTDIR?=$(INSTALL_ROOT)
29 # Where you want it installed when you do 'make install'
30 PREFIX?=/usr/local
31 BINDIR?=$(PREFIX)/bin
32 LIBDIR?=$(PREFIX)/lib
33 DATADIR?=$(PREFIX)/share
34 MANDIR?=$(DATADIR)/man
35 MAN1DIR?=$(MANDIR)/man1
36 INCLUDEDIR?=$(PREFIX)/include
38 OBJS= blocksort.o \
39 huffman.o \
40 crctable.o \
41 randtable.o \
42 compress.o \
43 decompress.o \
44 bzlib.o
46 PIC_OBJS= blocksort.pic.o \
47 huffman.pic.o \
48 crctable.pic.o \
49 randtable.pic.o \
50 compress.pic.o \
51 decompress.pic.o \
52 bzlib.pic.o
54 LIBVERSION_MAJOR=1
55 LIBVERSION_MINOR=0
56 LIBVERSION_PATCHLEVEL=4
58 SHLIB=libbz2.so
59 SONAME=$(SHLIB).$(LIBVERSION_MAJOR)
60 LIBNAME=$(LIBNAME2).$(LIBVERSION_PATCHLEVEL)
61 LIBNAME2=$(SONAME).$(LIBVERSION_MINOR)
63 all: libbz2.a bzip2 bzip2recover libbz2.so $(SONAME) $(LIBNAME2) $(LIBNAME)
65 $(LIBNAME): $(PIC_OBJS)
66 $(CC) $(LDFLAGS) -shared -Wl,-soname -Wl,$(SONAME) -o $@ $(PIC_OBJS)
68 $(LIBNAME2): $(LIBNAME)
69 ln -sf $(LIBNAME) $@
71 $(SONAME): $(LIBNAME2)
72 ln -sf $(LIBNAME2) $@
74 $(SHLIB): $(SONAME)
75 ln -sf $(SONAME) $@
77 bzip2: libbz2.a bzip2.o
78 $(CC) $(CFLAGS) $(LDFLAGS) -o bzip2 bzip2.o -L. -lbz2
80 bzip2recover: bzip2recover.o
81 $(CC) $(CFLAGS) $(LDFLAGS) -o bzip2recover bzip2recover.o
83 libbz2.a: $(OBJS)
84 rm -f libbz2.a
85 $(AR) cq libbz2.a $(OBJS)
86 @if ( test -f $(RANLIB) -o -f /usr/bin/ranlib -o \
87 -f /bin/ranlib -o -f /usr/ccs/bin/ranlib ) ; then \
88 echo $(RANLIB) libbz2.a ; \
89 $(RANLIB) libbz2.a ; \
92 ## fixme: this wont work in cross-compile environments.
93 ## we should find some more general way for running constraint test
94 ## to allow an crosscompiling buildfarm to dock in (i.e. run the test
95 ## on the target platform)
96 check: test
97 test: bzip2
98 @cat words1
99 ./bzip2 -1 < sample1.ref > sample1.rb2
100 ./bzip2 -2 < sample2.ref > sample2.rb2
101 ./bzip2 -3 < sample3.ref > sample3.rb2
102 ./bzip2 -d < sample1.bz2 > sample1.tst
103 ./bzip2 -d < sample2.bz2 > sample2.tst
104 ./bzip2 -ds < sample3.bz2 > sample3.tst
105 cmp sample1.bz2 sample1.rb2
106 cmp sample2.bz2 sample2.rb2
107 cmp sample3.bz2 sample3.rb2
108 cmp sample1.tst sample1.ref
109 cmp sample2.tst sample2.ref
110 cmp sample3.tst sample3.ref
111 @cat words3
113 install-lib:
114 mkdir -p $(DESTDIR)$(LIBDIR) $(DESTDIR)$(INCLUDEDIR)
115 cp -f libbz2.a $(DESTDIR)$(LIBDIR)
116 chmod a+r $(DESTDIR)$(LIBDIR)/libbz2.a
117 cp -f bzlib.h $(DESTDIR)$(INCLUDEDIR)
118 chmod a+r $(DESTDIR)$(INCLUDEDIR)/bzlib.h
119 cp -f -P $(SHLIB) $(SONAME) $(LIBNAME) $(LIBNAME2) $(DESTDIR)$(LIBDIR)
121 MANPAGES=bzip2 bzgrep bzmore bzdiff bzexe
122 BINFILES=bzip2 bzgrep bzmore bzdiff bzexe bzip2recover
124 install-man:
125 mkdir -p $(DESTDIR)$(MAN1DIR)
126 for m in $(MANPAGES) ; do \
127 cp -f $$m.1 $(DESTDIR)$(MAN1DIR) ; \
128 chmod a+r $(DESTDIR)$(MAN1DIR)/$$m.1 ; \
129 done
130 echo ".so man1/bzgrep.1" > $(DESTDIR)$(MAN1DIR)/bzegrep.1
131 echo ".so man1/bzgrep.1" > $(DESTDIR)$(MAN1DIR)/bzfgrep.1
132 echo ".so man1/bzmore.1" > $(DESTDIR)$(MAN1DIR)/bzless.1
133 echo ".so man1/bzdiff.1" > $(DESTDIR)$(MAN1DIR)/bzcmp.1
134 echo ".so man1/bzip2.1" > $(DESTDIR)$(MAN1DIR)/bunzip2.1
135 echo ".so man1/bzip2.1" > $(DESTDIR)$(MAN1DIR)/bzcat.1
136 echo ".so man1/bzip2.1" > $(DESTDIR)$(MAN1DIR)/bzip2recover.1
138 install-bin:
139 mkdir -p $(DESTDIR)$(BINDIR)
140 for f in $(BINFILES) ; do \
141 cp -f $$f $(DESTDIR)$(BINDIR) ; \
142 chmod a+x $(DESTDIR)$(BINDIR)/$$f ; \
143 done
144 $(STRIP) --strip-unneeded $(DESTDIR)$(BINDIR)/bzip2
145 $(STRIP) --strip-unneeded $(DESTDIR)$(BINDIR)/bzip2recover
146 ln -sf bzip2 $(DESTDIR)$(BINDIR)/bunzip2
147 ln -sf bzip2 $(DESTDIR)$(BINDIR)/bzcat
148 ln -sf bzgrep $(DESTDIR)$(BINDIR)/bzegrep
149 ln -sf bzgrep $(DESTDIR)$(BINDIR)/bzfgrep
150 ln -sf bzmore $(DESTDIR)$(BINDIR)/bzless
151 ln -sf bzdiff $(DESTDIR)$(BINDIR)/bzcmp
153 install: bzip2 bzip2recover install-bin install-lib install-man
155 clean:
156 rm -f *.o libbz2.a bzip2 bzip2recover bzip2-shared \
157 sample1.rb2 sample2.rb2 sample3.rb2 \
158 sample1.tst sample2.tst sample3.tst $(SONAME) $(LIBNAME) $(LIBNAME2)
160 blocksort.o: blocksort.c
161 @cat words0
162 $(CC) $(CFLAGS) -c blocksort.c
163 huffman.o: huffman.c
164 $(CC) $(CFLAGS) -c huffman.c
165 crctable.o: crctable.c
166 $(CC) $(CFLAGS) -c crctable.c
167 randtable.o: randtable.c
168 $(CC) $(CFLAGS) -c randtable.c
169 compress.o: compress.c
170 $(CC) $(CFLAGS) -c compress.c
171 decompress.o: decompress.c
172 $(CC) $(CFLAGS) -c decompress.c
173 bzlib.o: bzlib.c
174 $(CC) $(CFLAGS) -c bzlib.c
175 bzip2.o: bzip2.c
176 $(CC) $(CFLAGS) -c bzip2.c
177 bzip2recover.o: bzip2recover.c
178 $(CC) $(CFLAGS) -c bzip2recover.c
180 blocksort.pic.o: blocksort.c
181 @cat words0
182 $(CC) $(CFLAGS) $(CFLAGS_PIC) -o $@ -c $<
183 huffman.pic.o: huffman.c
184 $(CC) $(CFLAGS) $(CFLAGS_PIC) -o $@ -c $<
185 crctable.pic.o: crctable.c
186 $(CC) $(CFLAGS) $(CFLAGS_PIC) -o $@ -c $<
187 randtable.pic.o: randtable.c
188 $(CC) $(CFLAGS) $(CFLAGS_PIC) -o $@ -c $<
189 compress.pic.o: compress.c
190 $(CC) $(CFLAGS) $(CFLAGS_PIC) -o $@ -c $<
191 decompress.pic.o: decompress.c
192 $(CC) $(CFLAGS) $(CFLAGS_PIC) -o $@ -c $<
193 bzlib.pic.o: bzlib.c
194 $(CC) $(CFLAGS) $(CFLAGS_PIC) -o $@ -c $<
195 bzip2.pic.o: bzip2.c
196 $(CC) $(CFLAGS) $(CFLAGS_PIC) -o $@ -c $<
197 bzip2recover.pic.o: bzip2recover.c
198 $(CC) $(CFLAGS) $(CFLAGS_PIC) -o $@ -c $<
200 distclean: clean
201 rm -f manual.ps manual.html manual.pdf
203 DISTNAME=bzip2-1.0.5
204 dist: check manual
205 rm -f $(DISTNAME)
206 ln -s -f . $(DISTNAME)
207 tar cvf $(DISTNAME).tar \
208 $(DISTNAME)/blocksort.c \
209 $(DISTNAME)/huffman.c \
210 $(DISTNAME)/crctable.c \
211 $(DISTNAME)/randtable.c \
212 $(DISTNAME)/compress.c \
213 $(DISTNAME)/decompress.c \
214 $(DISTNAME)/bzlib.c \
215 $(DISTNAME)/bzip2.c \
216 $(DISTNAME)/bzip2recover.c \
217 $(DISTNAME)/bzlib.h \
218 $(DISTNAME)/bzlib_private.h \
219 $(DISTNAME)/Makefile \
220 $(DISTNAME)/LICENSE \
221 $(DISTNAME)/bzip2.1 \
222 $(DISTNAME)/bzip2.1.preformatted \
223 $(DISTNAME)/bzip2.txt \
224 $(DISTNAME)/words0 \
225 $(DISTNAME)/words1 \
226 $(DISTNAME)/words2 \
227 $(DISTNAME)/words3 \
228 $(DISTNAME)/sample1.ref \
229 $(DISTNAME)/sample2.ref \
230 $(DISTNAME)/sample3.ref \
231 $(DISTNAME)/sample1.bz2 \
232 $(DISTNAME)/sample2.bz2 \
233 $(DISTNAME)/sample3.bz2 \
234 $(DISTNAME)/dlltest.c \
235 $(DISTNAME)/manual.html \
236 $(DISTNAME)/manual.pdf \
237 $(DISTNAME)/manual.ps \
238 $(DISTNAME)/README \
239 $(DISTNAME)/README.COMPILATION.PROBLEMS \
240 $(DISTNAME)/README.XML.STUFF \
241 $(DISTNAME)/CHANGES \
242 $(DISTNAME)/libbz2.def \
243 $(DISTNAME)/libbz2.dsp \
244 $(DISTNAME)/dlltest.dsp \
245 $(DISTNAME)/makefile.msc \
246 $(DISTNAME)/unzcrash.c \
247 $(DISTNAME)/spewG.c \
248 $(DISTNAME)/mk251.c \
249 $(DISTNAME)/bzdiff \
250 $(DISTNAME)/bzdiff.1 \
251 $(DISTNAME)/bzexe \
252 $(DISTNAME)/bzexe.1 \
253 $(DISTNAME)/bzmore \
254 $(DISTNAME)/bzmore.1 \
255 $(DISTNAME)/bzgrep \
256 $(DISTNAME)/bzgrep.1 \
257 $(DISTNAME)/Makefile-libbz2_so \
258 $(DISTNAME)/bz-common.xsl \
259 $(DISTNAME)/bz-fo.xsl \
260 $(DISTNAME)/bz-html.xsl \
261 $(DISTNAME)/bzip.css \
262 $(DISTNAME)/entities.xml \
263 $(DISTNAME)/manual.xml \
264 $(DISTNAME)/format.pl \
265 $(DISTNAME)/xmlproc.sh
266 gzip -v $(DISTNAME).tar
268 # For rebuilding the manual from sources on my SuSE 9.1 box
270 MANUAL_SRCS= bz-common.xsl bz-fo.xsl bz-html.xsl bzip.css \
271 entities.xml manual.xml
273 manual: manual.html manual.ps manual.pdf
275 manual.ps: $(MANUAL_SRCS)
276 ./xmlproc.sh -ps manual.xml
278 manual.pdf: $(MANUAL_SRCS)
279 ./xmlproc.sh -pdf manual.xml
281 manual.html: $(MANUAL_SRCS)
282 ./xmlproc.sh -html manual.xml
284 bzip2-shared: $(LIBNAME)
285 $(CC) $(LDFLAGS) $(CFLAGS) -o bzip2-shared bzip2.c $(LIBNAME)