summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile120
1 files changed, 85 insertions, 35 deletions
diff --git a/Makefile b/Makefile
index 45c96e4..3b41059 100644
--- a/Makefile
+++ b/Makefile
@@ -2,78 +2,128 @@
2# Copyright (C) 1995-1996 Jean-loup Gailly. 2# Copyright (C) 1995-1996 Jean-loup Gailly.
3# For conditions of distribution and use, see copyright notice in zlib.h 3# For conditions of distribution and use, see copyright notice in zlib.h
4 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
9# To install /usr/local/lib/libz.* and /usr/local/include/zlib.h, type:
10# make install
11# To install in $HOME instead of /usr/local, use:
12# make install prefix=$HOME
13
5CC=cc 14CC=cc
15
6CFLAGS=-O 16CFLAGS=-O
7#use -O3 for gcc 17#CFLAGS=-O -DMAX_WBITS=14 -DMAX_MEM_LEVEL=7
8#CFLAGS="-O -DMAX_WBITS=14 -DMAX_MEM_LEVEL=7"
9#CFLAGS=-g -DDEBUG 18#CFLAGS=-g -DDEBUG
19#CFLAGS=-O3 -Wall -Wwrite-strings -Wpointer-arith -Wconversion \
20# -Wstrict-prototypes -Wmissing-prototypes
21
10LDFLAGS=-L. -lz 22LDFLAGS=-L. -lz
23LDSHARED=$(CC)
11 24
25VER=1.0.1
26LIBS=libz.a
27
28AR=ar rc
12RANLIB=ranlib 29RANLIB=ranlib
30TAR=tar
13 31
14prefix=/usr/local 32prefix=/usr/local
15exec_prefix = ${prefix} 33exec_prefix = $(prefix)
16 34
17OBJS = adler32.o compress.o crc32.o gzio.o uncompr.o deflate.o trees.o \ 35OBJS = adler32.o compress.o crc32.o gzio.o uncompr.o deflate.o trees.o \
18 zutil.o inflate.o infblock.o inftrees.o infcodes.o infutil.o inffast.o 36 zutil.o inflate.o infblock.o inftrees.o infcodes.o infutil.o inffast.o
19 37
20TEST_OBJS = example.o minigzip.o 38TEST_OBJS = example.o minigzip.o
21 39
40DISTFILES = README INDEX ChangeLog configure Make*[a-z0-9] descrip.mms *.[ch]
41
22all: example minigzip 42all: example minigzip
23 43
24test: all 44test: all
25 ./example 45 ./example
26 echo hello world | ./minigzip | ./minigzip -d 46 echo hello world | ./minigzip | ./minigzip -d
27 47
28install: libz.a
29 -@mkdir $(prefix)/include
30 -@mkdir $(exec_prefix)/lib
31 cp zlib.h zconf.h $(prefix)/include
32 chmod 644 $(prefix)/include/zlib.h $(prefix)/include/zconf.h
33 cp libz.a $(exec_prefix)/lib
34 chmod 644 $(exec_prefix)/lib/libz.a
35 -@$(RANLIB) $(prefix)/lib/libz.a
36# This second ranlib is needed on NeXTSTEP which checks file times
37
38libz.a: $(OBJS) 48libz.a: $(OBJS)
39 ar rc $@ $(OBJS) 49 $(AR) $@ $(OBJS)
40 -@$(RANLIB) $@ 50 -@ ($(RANLIB) $@ || true) 2>/dev/null
51
52libz.so.$(VER): $(OBJS)
53 $(LDSHARED) -o $@ $(OBJS)
54 rm -f libz.so; ln -s $@ libz.so
41 55
42example: example.o libz.a 56example: example.o $(LIBS)
43 $(CC) $(CFLAGS) -o $@ example.o $(LDFLAGS) 57 $(CC) $(CFLAGS) -o $@ example.o $(LDFLAGS)
44 58
45minigzip: minigzip.o libz.a 59minigzip: minigzip.o $(LIBS)
46 $(CC) $(CFLAGS) -o $@ minigzip.o $(LDFLAGS) 60 $(CC) $(CFLAGS) -o $@ minigzip.o $(LDFLAGS)
47 61
62install: $(LIBS)
63 -@if [ ! $(prefix)/include ]; then mkdir $(prefix)/include; fi
64 -@if [ ! $(exec_prefix)/lib ]; then mkdir $(exec_prefix)/lib; fi
65 cp zlib.h zconf.h $(prefix)/include
66 chmod 644 $(prefix)/include/zlib.h $(prefix)/include/zconf.h
67 cp $(LIBS) $(exec_prefix)/lib
68 cd $(exec_prefix)/lib; chmod 644 $(LIBS)
69 -@(cd $(exec_prefix)/lib; $(RANLIB) libz.a || true) >/dev/null 2>&1
70 cd $(exec_prefix)/lib; if test -f libz.so.$(VER); then \
71 ln -s libz.so.$(VER) libz.so; \
72 fi
73# The ranlib in install is needed on NeXTSTEP which checks file times
74
75uninstall:
76 cd $(exec_prefix)/lib; rm -f $(LIBS); \
77 if test -f libz.so; then \
78 v=`sed -n '/VERSION "/s/.*"\(.*\)".*/\1/p'<$(prefix)/include/zlib.h`;\
79 rm -f libz.so.$$v libz.so; \
80 fi
81 cd $(prefix)/include; rm -f zlib.h zconf.h
82
48clean: 83clean:
49 rm -f *.o example minigzip libz.a foo.gz 84 rm -f *.o *~ example minigzip libz.a libz.so* foo.gz
50 85
51zip: 86zip:
52 zip -ul9 zlib README ChangeLog Makefile Make????.??? Makefile.?? \ 87 mv Makefile Makefile~; cp -p Makefile.in Makefile
53 descrip.mms *.[ch] 88 v=`sed -n -e 's/\./-/g' -e '/VERSION "/s/.*"\(.*\)".*/\1/p' < zlib.h`;\
54 89 zip -ul9 zlib-$$v $(DISTFILES)
55tgz: 90 mv Makefile~ Makefile
56 cd ..; tar cfz zlib/zlib.tgz zlib/README zlib/ChangeLog zlib/Makefile \ 91
57 zlib/Make????.??? zlib/Makefile.?? zlib/descrip.mms zlib/*.[ch] 92dist:
58 93 mv Makefile Makefile~; cp -p Makefile.in Makefile
59TAGS: 94 d=zlib-`sed -n '/VERSION "/s/.*"\(.*\)".*/\1/p' < zlib.h`;\
95 rm -f $$d.tar.gz; \
96 if test ! -d ../$$d; then rm -f ../$$d; ln -s `pwd` ../$$d; fi; \
97 files=""; \
98 for f in $(DISTFILES); do files="$$files $$d/$$f"; done; \
99 cd ..; \
100 GZIP=-9 $(TAR) chofz $$d/$$d.tar.gz $$files; \
101 if test ! -d $$d; then rm -f $$d; fi
102 mv Makefile~ Makefile
103
104tags:
60 etags *.[ch] 105 etags *.[ch]
61 106
107depend:
108 makedepend -- $(CFLAGS) -- *.[ch]
109
62# DO NOT DELETE THIS LINE -- make depend depends on it. 110# DO NOT DELETE THIS LINE -- make depend depends on it.
63 111
64adler32.o: zutil.h zlib.h zconf.h 112adler32.o: zlib.h zconf.h
65compress.o: zlib.h zconf.h 113compress.o: zlib.h zconf.h
66crc32.o: zutil.h zlib.h zconf.h 114crc32.o: zlib.h zconf.h
67deflate.o: deflate.h zutil.h zlib.h zconf.h 115deflate.o: deflate.h zutil.h zlib.h zconf.h
68example.o: zlib.h zconf.h 116example.o: zlib.h zconf.h
69gzio.o: zutil.h zlib.h zconf.h 117gzio.o: zutil.h zlib.h zconf.h
70infblock.o: zutil.h zlib.h zconf.h infblock.h inftrees.h infcodes.h infutil.h 118infblock.o: infblock.h inftrees.h infcodes.h infutil.h zutil.h zlib.h zconf.h
71infcodes.o: zutil.h zlib.h zconf.h inftrees.h infutil.h infcodes.h inffast.h 119infcodes.o: zutil.h zlib.h zconf.h
72inffast.o: zutil.h zlib.h zconf.h inftrees.h infutil.h inffast.h 120infcodes.o: inftrees.h infblock.h infcodes.h infutil.h inffast.h
121inffast.o: zutil.h zlib.h zconf.h inftrees.h
122inffast.o: infblock.h infcodes.h infutil.h inffast.h
73inflate.o: zutil.h zlib.h zconf.h infblock.h 123inflate.o: zutil.h zlib.h zconf.h infblock.h
74inftrees.o: zutil.h zlib.h zconf.h inftrees.h 124inftrees.o: zutil.h zlib.h zconf.h inftrees.h
75infutil.o: zutil.h zlib.h zconf.h inftrees.h infutil.h 125infutil.o: zutil.h zlib.h zconf.h infblock.h inftrees.h infcodes.h infutil.h
76minigzip.o: zlib.h zconf.h 126minigzip.o: zlib.h zconf.h
77trees.o: deflate.h zutil.h zlib.h zconf.h 127trees.o: deflate.h zutil.h zlib.h zconf.h
78uncompr.o: zlib.h zconf.h 128uncompr.o: zlib.h zconf.h
79zutil.o: zutil.h zlib.h zconf.h 129zutil.o: zutil.h zlib.h zconf.h