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