Fix copyright.
[rsync/rsync.git] / zlib / Makefile
CommitLineData
d4286ec4 1# Makefile for zlib
be59d0ec 2# Copyright (C) 1995-2002 Jean-loup Gailly.
d4286ec4
PM
3# For conditions of distribution and use, see copyright notice in zlib.h
4
5# To compile and test, type:
6# ./configure; make test
7# The call of configure is optional if you don't have special requirements
8# If you wish to build zlib as a shared library, use: ./configure -s
9
10# To install /usr/local/lib/libz.* and /usr/local/include/zlib.h, type:
11# make install
12# To install in $HOME instead of /usr/local, use:
13# make install prefix=$HOME
14
15CC=cc
16
17CFLAGS=-O
18#CFLAGS=-O -DMAX_WBITS=14 -DMAX_MEM_LEVEL=7
19#CFLAGS=-g -DDEBUG
20#CFLAGS=-O3 -Wall -Wwrite-strings -Wpointer-arith -Wconversion \
21# -Wstrict-prototypes -Wmissing-prototypes
22
23LDFLAGS=-L. -lz
24LDSHARED=$(CC)
be60c7b9 25CPP=$(CC) -E
d4286ec4 26
be59d0ec 27VER=1.1.4
d4286ec4
PM
28LIBS=libz.a
29SHAREDLIB=libz.so
30
31AR=ar rc
32RANLIB=ranlib
33TAR=tar
34SHELL=/bin/sh
35
36prefix = /usr/local
37exec_prefix = ${prefix}
be60c7b9
MP
38libdir = ${exec_prefix}/lib
39includedir = ${prefix}/include
d4286ec4
PM
40
41OBJS = adler32.o compress.o crc32.o gzio.o uncompr.o deflate.o trees.o \
42 zutil.o inflate.o infblock.o inftrees.o infcodes.o infutil.o inffast.o
43
be60c7b9
MP
44OBJA =
45# to use the asm code: make OBJA=match.o
46
d4286ec4
PM
47TEST_OBJS = example.o minigzip.o
48
be60c7b9 49DISTFILES = README FAQ INDEX ChangeLog configure Make*[a-z0-9] *.[ch] *.mms \
be59d0ec
MP
50 algorithm.txt zlib.3 zlib.html \
51 msdos/Make*[a-z0-9] msdos/zlib.def msdos/zlib.rc \
be60c7b9
MP
52 nt/Make*[a-z0-9] nt/zlib.dnt amiga/Make*.??? os2/M*.os2 os2/zlib.def \
53 contrib/RE*.contrib contrib/*.txt contrib/asm386/*.asm contrib/asm386/*.c \
54 contrib/asm386/*.bat contrib/asm386/zlibvc.d?? contrib/asm[56]86/*.?86 \
55 contrib/asm[56]86/*.S contrib/iostream/*.cpp \
d4286ec4
PM
56 contrib/iostream/*.h contrib/iostream2/*.h contrib/iostream2/*.cpp \
57 contrib/untgz/Makefile contrib/untgz/*.c contrib/untgz/*.w32 \
be60c7b9
MP
58 contrib/minizip/[CM]*[pe] contrib/minizip/*.[ch] contrib/minizip/*.[td]?? \
59 contrib/delphi*/*.???
d4286ec4
PM
60
61all: example minigzip
62
63test: all
64 @LD_LIBRARY_PATH=.:$(LD_LIBRARY_PATH) ; export LD_LIBRARY_PATH; \
65 echo hello world | ./minigzip | ./minigzip -d || \
66 echo ' *** minigzip test FAILED ***' ; \
67 if ./example; then \
68 echo ' *** zlib test OK ***'; \
69 else \
70 echo ' *** zlib test FAILED ***'; \
71 fi
72
be60c7b9
MP
73libz.a: $(OBJS) $(OBJA)
74 $(AR) $@ $(OBJS) $(OBJA)
d4286ec4
PM
75 -@ ($(RANLIB) $@ || true) >/dev/null 2>&1
76
be60c7b9
MP
77match.o: match.S
78 $(CPP) match.S > _match.s
79 $(CC) -c _match.s
80 mv _match.o match.o
81 rm -f _match.s
82
d4286ec4
PM
83$(SHAREDLIB).$(VER): $(OBJS)
84 $(LDSHARED) -o $@ $(OBJS)
85 rm -f $(SHAREDLIB) $(SHAREDLIB).1
86 ln -s $@ $(SHAREDLIB)
87 ln -s $@ $(SHAREDLIB).1
88
89example: example.o $(LIBS)
90 $(CC) $(CFLAGS) -o $@ example.o $(LDFLAGS)
91
92minigzip: minigzip.o $(LIBS)
93 $(CC) $(CFLAGS) -o $@ minigzip.o $(LDFLAGS)
94
95install: $(LIBS)
be60c7b9
MP
96 -@if [ ! -d $(includedir) ]; then mkdir $(includedir); fi
97 -@if [ ! -d $(libdir) ]; then mkdir $(libdir); fi
98 cp zlib.h zconf.h $(includedir)
99 chmod 644 $(includedir)/zlib.h $(includedir)/zconf.h
100 cp $(LIBS) $(libdir)
101 cd $(libdir); chmod 755 $(LIBS)
102 -@(cd $(libdir); $(RANLIB) libz.a || true) >/dev/null 2>&1
103 cd $(libdir); if test -f $(SHAREDLIB).$(VER); then \
d4286ec4
PM
104 rm -f $(SHAREDLIB) $(SHAREDLIB).1; \
105 ln -s $(SHAREDLIB).$(VER) $(SHAREDLIB); \
106 ln -s $(SHAREDLIB).$(VER) $(SHAREDLIB).1; \
107 (ldconfig || true) >/dev/null 2>&1; \
108 fi
109# The ranlib in install is needed on NeXTSTEP which checks file times
110# ldconfig is for Linux
111
112uninstall:
be60c7b9 113 cd $(includedir); \
d4286ec4
PM
114 v=$(VER); \
115 if test -f zlib.h; then \
116 v=`sed -n '/VERSION "/s/.*"\(.*\)".*/\1/p' < zlib.h`; \
117 rm -f zlib.h zconf.h; \
118 fi; \
be60c7b9 119 cd $(libdir); rm -f libz.a; \
d4286ec4
PM
120 if test -f $(SHAREDLIB).$$v; then \
121 rm -f $(SHAREDLIB).$$v $(SHAREDLIB) $(SHAREDLIB).1; \
122 fi
123
124clean:
be60c7b9
MP
125 rm -f *.o *~ example minigzip libz.a libz.so* foo.gz so_locations \
126 _match.s maketree
d4286ec4
PM
127
128distclean: clean
129
130zip:
131 mv Makefile Makefile~; cp -p Makefile.in Makefile
132 rm -f test.c ztest*.c contrib/minizip/test.zip
133 v=`sed -n -e 's/\.//g' -e '/VERSION "/s/.*"\(.*\)".*/\1/p' < zlib.h`;\
134 zip -ul9 zlib$$v $(DISTFILES)
135 mv Makefile~ Makefile
136
137dist:
138 mv Makefile Makefile~; cp -p Makefile.in Makefile
139 rm -f test.c ztest*.c contrib/minizip/test.zip
140 d=zlib-`sed -n '/VERSION "/s/.*"\(.*\)".*/\1/p' < zlib.h`;\
141 rm -f $$d.tar.gz; \
142 if test ! -d ../$$d; then rm -f ../$$d; ln -s `pwd` ../$$d; fi; \
143 files=""; \
144 for f in $(DISTFILES); do files="$$files $$d/$$f"; done; \
145 cd ..; \
146 GZIP=-9 $(TAR) chofz $$d/$$d.tar.gz $$files; \
147 if test ! -d $$d; then rm -f $$d; fi
148 mv Makefile~ Makefile
149
150tags:
151 etags *.[ch]
152
153depend:
154 makedepend -- $(CFLAGS) -- *.[ch]
155
156# DO NOT DELETE THIS LINE -- make depend depends on it.
157
158adler32.o: zlib.h zconf.h
159compress.o: zlib.h zconf.h
160crc32.o: zlib.h zconf.h
161deflate.o: deflate.h zutil.h zlib.h zconf.h
162example.o: zlib.h zconf.h
163gzio.o: zutil.h zlib.h zconf.h
164infblock.o: infblock.h inftrees.h infcodes.h infutil.h zutil.h zlib.h zconf.h
165infcodes.o: zutil.h zlib.h zconf.h
166infcodes.o: inftrees.h infblock.h infcodes.h infutil.h inffast.h
167inffast.o: zutil.h zlib.h zconf.h inftrees.h
168inffast.o: infblock.h infcodes.h infutil.h inffast.h
169inflate.o: zutil.h zlib.h zconf.h infblock.h
170inftrees.o: zutil.h zlib.h zconf.h inftrees.h
171infutil.o: zutil.h zlib.h zconf.h infblock.h inftrees.h infcodes.h infutil.h
172minigzip.o: zlib.h zconf.h
173trees.o: deflate.h zutil.h zlib.h zconf.h trees.h
174uncompr.o: zlib.h zconf.h
175zutil.o: zutil.h zlib.h zconf.h