1 1.1 christos # Makefile for zlib 2 1.1 christos # Copyright (C) 1995-2005 Jean-loup Gailly. 3 1.1 christos # For conditions of distribution and use, see copyright notice in zlib.h 4 1.1 christos 5 1.1 christos # To compile and test, type: 6 1.1 christos # ./configure; make test 7 1.1 christos # The call of configure is optional if you don't have special requirements 8 1.1 christos # If you wish to build zlib as a shared library, use: ./configure -s 9 1.1 christos 10 1.1 christos # To use the asm code, type: 11 1.1 christos # cp contrib/asm?86/match.S ./match.S 12 1.1 christos # make LOC=-DASMV OBJA=match.o 13 1.1 christos 14 1.1 christos # To install /usr/local/lib/libz.* and /usr/local/include/zlib.h, type: 15 1.1 christos # make install 16 1.1 christos # To install in $HOME instead of /usr/local, use: 17 1.1 christos # make install prefix=$HOME 18 1.1 christos 19 1.1 christos CC=cc 20 1.1 christos 21 1.1 christos CFLAGS=-O 22 1.1 christos #CFLAGS=-O -DMAX_WBITS=14 -DMAX_MEM_LEVEL=7 23 1.1 christos #CFLAGS=-g -DDEBUG 24 1.1 christos #CFLAGS=-O3 -Wall -Wwrite-strings -Wpointer-arith -Wconversion \ 25 1.1 christos # -Wstrict-prototypes -Wmissing-prototypes 26 1.1 christos 27 1.1 christos LDFLAGS=libz.a 28 1.1 christos LDSHARED=$(CC) 29 1.1 christos CPP=$(CC) -E 30 1.1 christos 31 1.1 christos LIBS=libz.a 32 1.1 christos SHAREDLIB=libz.so 33 1.1 christos SHAREDLIBV=libz.so.1.2.3 34 1.1 christos SHAREDLIBM=libz.so.1 35 1.1 christos 36 1.1 christos AR=ar rc 37 1.1 christos RANLIB=ranlib 38 1.1 christos TAR=tar 39 1.1 christos SHELL=/bin/sh 40 1.1 christos EXE= 41 1.1 christos 42 1.1 christos prefix = /usr/local 43 1.1 christos exec_prefix = ${prefix} 44 1.1 christos libdir = ${exec_prefix}/lib 45 1.1 christos includedir = ${prefix}/include 46 1.1 christos mandir = ${prefix}/share/man 47 1.1 christos man3dir = ${mandir}/man3 48 1.1 christos 49 1.1 christos OBJS = adler32.o compress.o crc32.o gzio.o uncompr.o deflate.o trees.o \ 50 1.1 christos zutil.o inflate.o infback.o inftrees.o inffast.o 51 1.1 christos 52 1.1 christos OBJA = 53 1.1 christos # to use the asm code: make OBJA=match.o 54 1.1 christos 55 1.1 christos TEST_OBJS = example.o minigzip.o 56 1.1 christos 57 1.1 christos all: example$(EXE) minigzip$(EXE) 58 1.1 christos 59 1.1 christos check: test 60 1.1 christos test: all 61 1.1 christos @LD_LIBRARY_PATH=.:$(LD_LIBRARY_PATH) ; export LD_LIBRARY_PATH; \ 62 1.1 christos echo hello world | ./minigzip | ./minigzip -d || \ 63 1.1 christos echo ' *** minigzip test FAILED ***' ; \ 64 1.1 christos if ./example; then \ 65 1.1 christos echo ' *** zlib test OK ***'; \ 66 1.1 christos else \ 67 1.1 christos echo ' *** zlib test FAILED ***'; \ 68 1.1 christos fi 69 1.1 christos 70 1.1 christos libz.a: $(OBJS) $(OBJA) 71 1.1 christos $(AR) $@ $(OBJS) $(OBJA) 72 1.1 christos -@ ($(RANLIB) $@ || true) >/dev/null 2>&1 73 1.1 christos 74 1.1 christos match.o: match.S 75 1.1 christos $(CPP) match.S > _match.s 76 1.1 christos $(CC) -c _match.s 77 1.1 christos mv _match.o match.o 78 1.1 christos rm -f _match.s 79 1.1 christos 80 1.1 christos $(SHAREDLIBV): $(OBJS) 81 1.1 christos $(LDSHARED) -o $@ $(OBJS) 82 1.1 christos rm -f $(SHAREDLIB) $(SHAREDLIBM) 83 1.1 christos ln -s $@ $(SHAREDLIB) 84 1.1 christos ln -s $@ $(SHAREDLIBM) 85 1.1 christos 86 1.1 christos example$(EXE): example.o $(LIBS) 87 1.1 christos $(CC) $(CFLAGS) -o $@ example.o $(LDFLAGS) 88 1.1 christos 89 1.1 christos minigzip$(EXE): minigzip.o $(LIBS) 90 1.1 christos $(CC) $(CFLAGS) -o $@ minigzip.o $(LDFLAGS) 91 1.1 christos 92 1.1 christos install: $(LIBS) 93 1.1 christos -@if [ ! -d $(exec_prefix) ]; then mkdir -p $(exec_prefix); fi 94 1.1 christos -@if [ ! -d $(includedir) ]; then mkdir -p $(includedir); fi 95 1.1 christos -@if [ ! -d $(libdir) ]; then mkdir -p $(libdir); fi 96 1.1 christos -@if [ ! -d $(man3dir) ]; then mkdir -p $(man3dir); fi 97 1.1 christos cp zlib.h zconf.h $(includedir) 98 1.1 christos chmod 644 $(includedir)/zlib.h $(includedir)/zconf.h 99 1.1 christos cp $(LIBS) $(libdir) 100 1.1 christos cd $(libdir); chmod 755 $(LIBS) 101 1.1 christos -@(cd $(libdir); $(RANLIB) libz.a || true) >/dev/null 2>&1 102 1.1 christos cd $(libdir); if test -f $(SHAREDLIBV); then \ 103 1.1 christos rm -f $(SHAREDLIB) $(SHAREDLIBM); \ 104 1.1 christos ln -s $(SHAREDLIBV) $(SHAREDLIB); \ 105 1.1 christos ln -s $(SHAREDLIBV) $(SHAREDLIBM); \ 106 1.1 christos (ldconfig || true) >/dev/null 2>&1; \ 107 1.1 christos fi 108 1.1 christos cp zlib.3 $(man3dir) 109 1.1 christos chmod 644 $(man3dir)/zlib.3 110 1.1 christos # The ranlib in install is needed on NeXTSTEP which checks file times 111 1.1 christos # ldconfig is for Linux 112 1.1 christos 113 1.1 christos uninstall: 114 1.1 christos cd $(includedir); \ 115 1.1 christos cd $(libdir); rm -f libz.a; \ 116 1.1 christos if test -f $(SHAREDLIBV); then \ 117 1.1 christos rm -f $(SHAREDLIBV) $(SHAREDLIB) $(SHAREDLIBM); \ 118 1.1 christos fi 119 1.1 christos cd $(man3dir); rm -f zlib.3 120 1.1 christos 121 1.1 christos mostlyclean: clean 122 1.1 christos clean: 123 1.1 christos rm -f *.o *~ example$(EXE) minigzip$(EXE) \ 124 1.1 christos libz.* foo.gz so_locations \ 125 1.1 christos _match.s maketree contrib/infback9/*.o 126 1.1 christos 127 1.1 christos maintainer-clean: distclean 128 1.1 christos distclean: clean 129 1.1 christos cp -p Makefile.in Makefile 130 1.1 christos cp -p zconf.in.h zconf.h 131 1.1 christos rm -f .DS_Store 132 1.1 christos 133 1.1 christos tags: 134 1.1 christos etags *.[ch] 135 1.1 christos 136 1.1 christos depend: 137 1.1 christos makedepend -- $(CFLAGS) -- *.[ch] 138 1.1 christos 139 1.1 christos # DO NOT DELETE THIS LINE -- make depend depends on it. 140 1.1 christos 141 1.1 christos adler32.o: zlib.h zconf.h 142 1.1 christos compress.o: zlib.h zconf.h 143 1.1 christos crc32.o: crc32.h zlib.h zconf.h 144 1.1 christos deflate.o: deflate.h zutil.h zlib.h zconf.h 145 1.1 christos example.o: zlib.h zconf.h 146 1.1 christos gzio.o: zutil.h zlib.h zconf.h 147 1.1 christos inffast.o: zutil.h zlib.h zconf.h inftrees.h inflate.h inffast.h 148 1.1 christos inflate.o: zutil.h zlib.h zconf.h inftrees.h inflate.h inffast.h 149 1.1 christos infback.o: zutil.h zlib.h zconf.h inftrees.h inflate.h inffast.h 150 1.1 christos inftrees.o: zutil.h zlib.h zconf.h inftrees.h 151 1.1 christos minigzip.o: zlib.h zconf.h 152 1.1 christos trees.o: deflate.h zutil.h zlib.h zconf.h trees.h 153 1.1 christos uncompr.o: zlib.h zconf.h 154 1.1 christos zutil.o: zutil.h zlib.h zconf.h 155