]> git.lizzy.rs Git - zlib.git/blob - Makefile.in
zlib 1.2.0.7
[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 LIBS=libz.a
32 SHAREDLIB=libz.so
33 SHAREDLIBV=libz.so.1.2.0.7
34 SHAREDLIBM=libz.so.1
35
36 AR=ar rc
37 RANLIB=ranlib
38 TAR=tar
39 SHELL=/bin/sh
40
41 prefix = /usr/local
42 exec_prefix = ${prefix}
43 libdir = ${exec_prefix}/lib
44 includedir = ${prefix}/include
45 mandir = ${prefix}/share/man
46 man3dir = ${mandir}/man3
47
48 OBJS = adler32.o compress.o crc32.o gzio.o uncompr.o deflate.o trees.o \
49        zutil.o inflate.o infback.o inftrees.o inffast.o
50
51 OBJA =
52 # to use the asm code: make OBJA=match.o
53
54 TEST_OBJS = example.o minigzip.o
55
56 all: example minigzip
57
58 check: test
59 test: all
60         @LD_LIBRARY_PATH=.:$(LD_LIBRARY_PATH) ; export LD_LIBRARY_PATH; \
61         echo hello world | ./minigzip | ./minigzip -d || \
62           echo '                *** minigzip test FAILED ***' ; \
63         if ./example; then \
64           echo '                *** zlib test OK ***'; \
65         else \
66           echo '                *** zlib test FAILED ***'; \
67         fi
68
69 libz.a: $(OBJS) $(OBJA)
70         $(AR) $@ $(OBJS) $(OBJA)
71         -@ ($(RANLIB) $@ || true) >/dev/null 2>&1
72
73 match.o: match.S
74         $(CPP) match.S > _match.s
75         $(CC) -c _match.s
76         mv _match.o match.o
77         rm -f _match.s
78
79 $(SHAREDLIBV): $(OBJS)
80         $(LDSHARED) -o $@ $(OBJS)
81         rm -f $(SHAREDLIB) $(SHAREDLIBM)
82         ln -s $@ $(SHAREDLIB)
83         ln -s $@ $(SHAREDLIBM)
84
85 example: example.o $(LIBS)
86         $(CC) $(CFLAGS) -o $@ example.o $(LDFLAGS)
87
88 minigzip: minigzip.o $(LIBS)
89         $(CC) $(CFLAGS) -o $@ minigzip.o $(LDFLAGS)
90
91 install: $(LIBS)
92         -@if [ ! -d $(exec_prefix) ]; then mkdir $(exec_prefix); fi
93         -@if [ ! -d $(includedir)  ]; then mkdir $(includedir); fi
94         -@if [ ! -d $(libdir)      ]; then mkdir $(libdir); fi
95         -@if [ ! -d $(man3dir)     ]; then mkdir $(man3dir); fi
96         cp zlib.h zconf.h $(includedir)
97         chmod 644 $(includedir)/zlib.h $(includedir)/zconf.h
98         cp $(LIBS) $(libdir)
99         cd $(libdir); chmod 755 $(LIBS)
100         -@(cd $(libdir); $(RANLIB) libz.a || true) >/dev/null 2>&1
101         cd $(libdir); if test -f $(SHAREDLIBV); then \
102           rm -f $(SHAREDLIB) $(SHAREDLIBM); \
103           ln -s $(SHAREDLIBV) $(SHAREDLIB); \
104           ln -s $(SHAREDLIBV) $(SHAREDLIBM); \
105           (ldconfig || true)  >/dev/null 2>&1; \
106         fi
107         cp zlib.3 $(man3dir)
108         chmod 644 $(man3dir)/zlib.3
109 # The ranlib in install is needed on NeXTSTEP which checks file times
110 # ldconfig is for Linux
111
112 uninstall:
113         cd $(includedir); \
114         cd $(libdir); rm -f libz.a; \
115         if test -f $(SHAREDLIBV); then \
116           rm -f $(SHAREDLIBV) $(SHAREDLIB) $(SHAREDLIBM); \
117         fi
118         cd $(man3dir); rm -f zlib.3
119
120 mostlyclean: clean
121 clean:
122         rm -f *.o *~ example minigzip libz.* foo.gz so_locations \
123            _match.s maketree contrib/infback9/*.o
124
125 maintainer-clean: distclean
126 distclean: clean
127         cp -p Makefile.in Makefile
128         cp -p zconf.in.h zconf.h
129         rm -f .DS_Store
130
131 tags:
132         etags *.[ch]
133
134 depend:
135         makedepend -- $(CFLAGS) -- *.[ch]
136
137 # DO NOT DELETE THIS LINE -- make depend depends on it.
138
139 adler32.o: zlib.h zconf.h
140 compress.o: zlib.h zconf.h
141 crc32.o: crc32.h zlib.h zconf.h
142 deflate.o: deflate.h zutil.h zlib.h zconf.h
143 example.o: zlib.h zconf.h
144 gzio.o: zutil.h zlib.h zconf.h
145 inffast.o: zutil.h zlib.h zconf.h inftrees.h inflate.h inffast.h
146 inflate.o: zutil.h zlib.h zconf.h inftrees.h inflate.h inffast.h
147 infback.o: zutil.h zlib.h zconf.h inftrees.h inflate.h inffast.h
148 inftrees.o: zutil.h zlib.h zconf.h inftrees.h
149 minigzip.o: zlib.h zconf.h
150 trees.o: deflate.h zutil.h zlib.h zconf.h trees.h
151 uncompr.o: zlib.h zconf.h
152 zutil.o: zutil.h zlib.h zconf.h