OSDN Git Service

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