Makefile revision 1.1
11.1Schristos# Makefile for zlib
21.1Schristos# Copyright (C) 1995-2005 Jean-loup Gailly.
31.1Schristos# For conditions of distribution and use, see copyright notice in zlib.h
41.1Schristos
51.1Schristos# To compile and test, type:
61.1Schristos#    ./configure; make test
71.1Schristos# The call of configure is optional if you don't have special requirements
81.1Schristos# If you wish to build zlib as a shared library, use: ./configure -s
91.1Schristos
101.1Schristos# To use the asm code, type:
111.1Schristos#    cp contrib/asm?86/match.S ./match.S
121.1Schristos#    make LOC=-DASMV OBJA=match.o
131.1Schristos
141.1Schristos# To install /usr/local/lib/libz.* and /usr/local/include/zlib.h, type:
151.1Schristos#    make install
161.1Schristos# To install in $HOME instead of /usr/local, use:
171.1Schristos#    make install prefix=$HOME
181.1Schristos
191.1SchristosCC=cc
201.1Schristos
211.1SchristosCFLAGS=-O
221.1Schristos#CFLAGS=-O -DMAX_WBITS=14 -DMAX_MEM_LEVEL=7
231.1Schristos#CFLAGS=-g -DDEBUG
241.1Schristos#CFLAGS=-O3 -Wall -Wwrite-strings -Wpointer-arith -Wconversion \
251.1Schristos#           -Wstrict-prototypes -Wmissing-prototypes
261.1Schristos
271.1SchristosLDFLAGS=libz.a
281.1SchristosLDSHARED=$(CC)
291.1SchristosCPP=$(CC) -E
301.1Schristos
311.1SchristosLIBS=libz.a
321.1SchristosSHAREDLIB=libz.so
331.1SchristosSHAREDLIBV=libz.so.1.2.3
341.1SchristosSHAREDLIBM=libz.so.1
351.1Schristos
361.1SchristosAR=ar rc
371.1SchristosRANLIB=ranlib
381.1SchristosTAR=tar
391.1SchristosSHELL=/bin/sh
401.1SchristosEXE=
411.1Schristos
421.1Schristosprefix = /usr/local
431.1Schristosexec_prefix = ${prefix}
441.1Schristoslibdir = ${exec_prefix}/lib
451.1Schristosincludedir = ${prefix}/include
461.1Schristosmandir = ${prefix}/share/man
471.1Schristosman3dir = ${mandir}/man3
481.1Schristos
491.1SchristosOBJS = adler32.o compress.o crc32.o gzio.o uncompr.o deflate.o trees.o \
501.1Schristos       zutil.o inflate.o infback.o inftrees.o inffast.o
511.1Schristos
521.1SchristosOBJA =
531.1Schristos# to use the asm code: make OBJA=match.o
541.1Schristos
551.1SchristosTEST_OBJS = example.o minigzip.o
561.1Schristos
571.1Schristosall: example$(EXE) minigzip$(EXE)
581.1Schristos
591.1Schristoscheck: test
601.1Schristostest: all
611.1Schristos	@LD_LIBRARY_PATH=.:$(LD_LIBRARY_PATH) ; export LD_LIBRARY_PATH; \
621.1Schristos	echo hello world | ./minigzip | ./minigzip -d || \
631.1Schristos	  echo '		*** minigzip test FAILED ***' ; \
641.1Schristos	if ./example; then \
651.1Schristos	  echo '		*** zlib test OK ***'; \
661.1Schristos	else \
671.1Schristos	  echo '		*** zlib test FAILED ***'; \
681.1Schristos	fi
691.1Schristos
701.1Schristoslibz.a: $(OBJS) $(OBJA)
711.1Schristos	$(AR) $@ $(OBJS) $(OBJA)
721.1Schristos	-@ ($(RANLIB) $@ || true) >/dev/null 2>&1
731.1Schristos
741.1Schristosmatch.o: match.S
751.1Schristos	$(CPP) match.S > _match.s
761.1Schristos	$(CC) -c _match.s
771.1Schristos	mv _match.o match.o
781.1Schristos	rm -f _match.s
791.1Schristos
801.1Schristos$(SHAREDLIBV): $(OBJS)
811.1Schristos	$(LDSHARED) -o $@ $(OBJS)
821.1Schristos	rm -f $(SHAREDLIB) $(SHAREDLIBM)
831.1Schristos	ln -s $@ $(SHAREDLIB)
841.1Schristos	ln -s $@ $(SHAREDLIBM)
851.1Schristos
861.1Schristosexample$(EXE): example.o $(LIBS)
871.1Schristos	$(CC) $(CFLAGS) -o $@ example.o $(LDFLAGS)
881.1Schristos
891.1Schristosminigzip$(EXE): minigzip.o $(LIBS)
901.1Schristos	$(CC) $(CFLAGS) -o $@ minigzip.o $(LDFLAGS)
911.1Schristos
921.1Schristosinstall: $(LIBS)
931.1Schristos	-@if [ ! -d $(exec_prefix) ]; then mkdir -p $(exec_prefix); fi
941.1Schristos	-@if [ ! -d $(includedir)  ]; then mkdir -p $(includedir); fi
951.1Schristos	-@if [ ! -d $(libdir)      ]; then mkdir -p $(libdir); fi
961.1Schristos	-@if [ ! -d $(man3dir)     ]; then mkdir -p $(man3dir); fi
971.1Schristos	cp zlib.h zconf.h $(includedir)
981.1Schristos	chmod 644 $(includedir)/zlib.h $(includedir)/zconf.h
991.1Schristos	cp $(LIBS) $(libdir)
1001.1Schristos	cd $(libdir); chmod 755 $(LIBS)
1011.1Schristos	-@(cd $(libdir); $(RANLIB) libz.a || true) >/dev/null 2>&1
1021.1Schristos	cd $(libdir); if test -f $(SHAREDLIBV); then \
1031.1Schristos	  rm -f $(SHAREDLIB) $(SHAREDLIBM); \
1041.1Schristos	  ln -s $(SHAREDLIBV) $(SHAREDLIB); \
1051.1Schristos	  ln -s $(SHAREDLIBV) $(SHAREDLIBM); \
1061.1Schristos	  (ldconfig || true)  >/dev/null 2>&1; \
1071.1Schristos	fi
1081.1Schristos	cp zlib.3 $(man3dir)
1091.1Schristos	chmod 644 $(man3dir)/zlib.3
1101.1Schristos# The ranlib in install is needed on NeXTSTEP which checks file times
1111.1Schristos# ldconfig is for Linux
1121.1Schristos
1131.1Schristosuninstall:
1141.1Schristos	cd $(includedir); \
1151.1Schristos	cd $(libdir); rm -f libz.a; \
1161.1Schristos	if test -f $(SHAREDLIBV); then \
1171.1Schristos	  rm -f $(SHAREDLIBV) $(SHAREDLIB) $(SHAREDLIBM); \
1181.1Schristos	fi
1191.1Schristos	cd $(man3dir); rm -f zlib.3
1201.1Schristos
1211.1Schristosmostlyclean: clean
1221.1Schristosclean:
1231.1Schristos	rm -f *.o *~ example$(EXE) minigzip$(EXE) \
1241.1Schristos	   libz.* foo.gz so_locations \
1251.1Schristos	   _match.s maketree contrib/infback9/*.o
1261.1Schristos
1271.1Schristosmaintainer-clean: distclean
1281.1Schristosdistclean: clean
1291.1Schristos	cp -p Makefile.in Makefile
1301.1Schristos	cp -p zconf.in.h zconf.h
1311.1Schristos	rm -f .DS_Store
1321.1Schristos
1331.1Schristostags:
1341.1Schristos	etags *.[ch]
1351.1Schristos
1361.1Schristosdepend:
1371.1Schristos	makedepend -- $(CFLAGS) -- *.[ch]
1381.1Schristos
1391.1Schristos# DO NOT DELETE THIS LINE -- make depend depends on it.
1401.1Schristos
1411.1Schristosadler32.o: zlib.h zconf.h
1421.1Schristoscompress.o: zlib.h zconf.h
1431.1Schristoscrc32.o: crc32.h zlib.h zconf.h
1441.1Schristosdeflate.o: deflate.h zutil.h zlib.h zconf.h
1451.1Schristosexample.o: zlib.h zconf.h
1461.1Schristosgzio.o: zutil.h zlib.h zconf.h
1471.1Schristosinffast.o: zutil.h zlib.h zconf.h inftrees.h inflate.h inffast.h
1481.1Schristosinflate.o: zutil.h zlib.h zconf.h inftrees.h inflate.h inffast.h
1491.1Schristosinfback.o: zutil.h zlib.h zconf.h inftrees.h inflate.h inffast.h
1501.1Schristosinftrees.o: zutil.h zlib.h zconf.h inftrees.h
1511.1Schristosminigzip.o: zlib.h zconf.h
1521.1Schristostrees.o: deflate.h zutil.h zlib.h zconf.h trees.h
1531.1Schristosuncompr.o: zlib.h zconf.h
1541.1Schristoszutil.o: zutil.h zlib.h zconf.h
155