Makefile (bd957a8d6c05c2b26507f0c310c269d02f187632) Makefile (e827b8c5cb1702eec714c267d4ea6686b075ffac)
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
1#
2# $Id: Makefile,v 1.5 1997/02/22 11:38:21 peter Exp $
3#
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# If you wish to build zlib as a shared library, use: ./configure -s
5MAINTAINER=peter@FreeBSD.org
9
6
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
7LIB= z
14
8
15CC=cc
9#CFLAGS+= -DMAX_WBITS=14 -DMAX_MEM_LEVEL=7
10#CFLAGS+= -g -DDEBUG
11#CFLAGS+= -Wall -Wwrite-strings -Wpointer-arith -Wconversion \
12# -Wstrict-prototypes -Wmissing-prototypes
16
13
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
14CLEANFILES+= example.o example foo.gz minigzip.o minigzip
22
15
23LDFLAGS=-L. -lz
24LDSHARED=$(CC)
16SRCS = adler32.c compress.c crc32.c gzio.c uncompr.c deflate.c trees.c \
17 zutil.c inflate.c infblock.c inftrees.c infcodes.c infutil.c inffast.c
25
18
26VER=1.1.1
27LIBS=libz.a
28SHAREDLIB=libz.so
19beforeinstall:
20.for hdr in zconf.h zlib.h
21 ${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 ${.CURDIR}/${hdr} \
22 ${DESTDIR}/usr/include
23.endfor
29
24
30AR=ar rc
31RANLIB=ranlib
32TAR=tar
33SHELL=/bin/sh
25minigzip: all minigzip.o
26 $(CC) -o minigzip minigzip.o -L. -lz
34
27
35prefix=/usr/local
36exec_prefix = $(prefix)
28example: all example.o
29 $(CC) -o example example.o -L. -lz
37
30
38OBJS = adler32.o compress.o crc32.o gzio.o uncompr.o deflate.o trees.o \
39 zutil.o inflate.o infblock.o inftrees.o infcodes.o infutil.o inffast.o
31test: example minigzip
32 (export LD_LIBRARY_PATH=. ; ./example )
33 (export LD_LIBRARY_PATH=. ; \
34 echo hello world | ./minigzip | ./minigzip -d )
40
35
41TEST_OBJS = example.o minigzip.o
42
43DISTFILES = README INDEX ChangeLog configure Make*[a-z0-9] *.[ch] descrip.mms \
44 algorithm.txt zlib.3 msdos/Make*[a-z0-9] msdos/zlib.def msdos/zlib.rc \
45 nt/Makefile.nt nt/zlib.dnt contrib/README.contrib contrib/*.txt \
46 contrib/asm386/*.asm contrib/asm386/*.c \
47 contrib/asm386/*.bat contrib/asm386/zlibvc.d?? contrib/iostream/*.cpp \
48 contrib/iostream/*.h contrib/iostream2/*.h contrib/iostream2/*.cpp \
49 contrib/untgz/Makefile contrib/untgz/*.c contrib/untgz/*.w32
50
51all: example minigzip
52
53test: all
54 @LD_LIBRARY_PATH=.:$(LD_LIBRARY_PATH) ; export LD_LIBRARY_PATH; \
55 echo hello world | ./minigzip | ./minigzip -d || \
56 echo ' *** minigzip test FAILED ***' ; \
57 if ./example; then \
58 echo ' *** zlib test OK ***'; \
59 else \
60 echo ' *** zlib test FAILED ***'; \
61 fi
62
63libz.a: $(OBJS)
64 $(AR) $@ $(OBJS)
65 -@ ($(RANLIB) $@ || true) >/dev/null 2>&1
66
67$(SHAREDLIB).$(VER): $(OBJS)
68 $(LDSHARED) -o $@ $(OBJS)
69 rm -f $(SHAREDLIB) $(SHAREDLIB).1
70 ln -s $@ $(SHAREDLIB)
71 ln -s $@ $(SHAREDLIB).1
72
73example: example.o $(LIBS)
74 $(CC) $(CFLAGS) -o $@ example.o $(LDFLAGS)
75
76minigzip: minigzip.o $(LIBS)
77 $(CC) $(CFLAGS) -o $@ minigzip.o $(LDFLAGS)
78
79install: $(LIBS)
80 -@if [ ! -d $(prefix)/include ]; then mkdir $(prefix)/include; fi
81 -@if [ ! -d $(exec_prefix)/lib ]; then mkdir $(exec_prefix)/lib; fi
82 cp zlib.h zconf.h $(prefix)/include
83 chmod 644 $(prefix)/include/zlib.h $(prefix)/include/zconf.h
84 cp $(LIBS) $(exec_prefix)/lib
85 cd $(exec_prefix)/lib; chmod 755 $(LIBS)
86 -@(cd $(exec_prefix)/lib; $(RANLIB) libz.a || true) >/dev/null 2>&1
87 cd $(exec_prefix)/lib; if test -f $(SHAREDLIB).$(VER); then \
88 rm -f $(SHAREDLIB) $(SHAREDLIB).1; \
89 ln -s $(SHAREDLIB).$(VER) $(SHAREDLIB); \
90 ln -s $(SHAREDLIB).$(VER) $(SHAREDLIB).1; \
91 (ldconfig || true) >/dev/null 2>&1; \
92 fi
93# The ranlib in install is needed on NeXTSTEP which checks file times
94# ldconfig is for Linux
95
96uninstall:
97 cd $(prefix)/include; \
98 v=$(VER); \
99 if test -f zlib.h; then \
100 v=`sed -n '/VERSION "/s/.*"\(.*\)".*/\1/p' < zlib.h`; \
101 rm -f zlib.h zconf.h; \
102 fi; \
103 cd $(exec_prefix)/lib; rm -f libz.a; \
104 if test -f $(SHAREDLIB).$$v; then \
105 rm -f $(SHAREDLIB).$$v $(SHAREDLIB) $(SHAREDLIB).1; \
106 fi
107
108clean:
109 rm -f *.o *~ example minigzip libz.a libz.so* foo.gz
110
111distclean: clean
112
113zip:
114 mv Makefile Makefile~; cp -p Makefile.in Makefile
115 rm -f test.c ztest*.c
116 v=`sed -n -e 's/\.//g' -e '/VERSION "/s/.*"\(.*\)".*/\1/p' < zlib.h`;\
117 zip -ul9 zlib$$v $(DISTFILES)
118 mv Makefile~ Makefile
119
120dist:
121 mv Makefile Makefile~; cp -p Makefile.in Makefile
122 rm -f test.c ztest*.c
123 d=zlib-`sed -n '/VERSION "/s/.*"\(.*\)".*/\1/p' < zlib.h`;\
124 rm -f $$d.tar.gz; \
125 if test ! -d ../$$d; then rm -f ../$$d; ln -s `pwd` ../$$d; fi; \
126 files=""; \
127 for f in $(DISTFILES); do files="$$files $$d/$$f"; done; \
128 cd ..; \
129 GZIP=-9 $(TAR) chofz $$d/$$d.tar.gz $$files; \
130 if test ! -d $$d; then rm -f $$d; fi
131 mv Makefile~ Makefile
132
133tags:
134 etags *.[ch]
135
136depend:
137 makedepend -- $(CFLAGS) -- *.[ch]
138
139# DO NOT DELETE THIS LINE -- make depend depends on it.
140
141adler32.o: zlib.h zconf.h
142compress.o: zlib.h zconf.h
143crc32.o: zlib.h zconf.h
144deflate.o: deflate.h zutil.h zlib.h zconf.h
145example.o: zlib.h zconf.h
146gzio.o: zutil.h zlib.h zconf.h
147infblock.o: infblock.h inftrees.h infcodes.h infutil.h zutil.h zlib.h zconf.h
148infcodes.o: zutil.h zlib.h zconf.h
149infcodes.o: inftrees.h infblock.h infcodes.h infutil.h inffast.h
150inffast.o: zutil.h zlib.h zconf.h inftrees.h
151inffast.o: infblock.h infcodes.h infutil.h inffast.h
152inflate.o: zutil.h zlib.h zconf.h infblock.h
153inftrees.o: zutil.h zlib.h zconf.h inftrees.h
154infutil.o: zutil.h zlib.h zconf.h infblock.h inftrees.h infcodes.h infutil.h
155minigzip.o: zlib.h zconf.h
156trees.o: deflate.h zutil.h zlib.h zconf.h trees.h
157uncompr.o: zlib.h zconf.h
158zutil.o: zutil.h zlib.h zconf.h
36.include <bsd.lib.mk>