1# 2# $FreeBSD$ 3# 4 5PACKAGE= runtime 6LIB= z 7SHLIBDIR?= /lib 8SHLIB_MAJOR= 6 9MAN= zlib.3 zopen.3 10MLINKS+= zopen.3 zdopen.3 11 12ZLIBSRC= ${SRCTOP}/sys/contrib/zlib 13 14.PATH: ${ZLIBSRC} 15 16#CFLAGS=-O -DMAX_WBITS=14 -DMAX_MEM_LEVEL=7 17#CFLAGS=-g -DDEBUG 18#CFLAGS=-O3 -Wall -Wwrite-strings -Wpointer-arith -Wconversion \ 19# -Wstrict-prototypes -Wmissing-prototypes 20 21CFLAGS+= -D_LARGEFILE64_SOURCE=1 -DHAVE_HIDDEN -I${.CURDIR} 22 23WARNS?= 3 24 25CLEANFILES+= example.o example foo.gz minigzip.o minigzip 26 27SRCS+= adler32.c 28SRCS+= compress.c 29SRCS+= crc32.c 30SRCS+= deflate.c 31SRCS+= gzclose.c 32SRCS+= gzlib.c 33SRCS+= gzread.c 34SRCS+= gzwrite.c 35SRCS+= infback.c 36SRCS+= inffast.c 37SRCS+= inflate.c 38SRCS+= inftrees.c 39SRCS+= trees.c 40SRCS+= uncompr.c 41SRCS+= zutil.c 42 43# Wrapper relies on FreeBSD-specific fpos_t representation and non-portable 44# funopen. Not needed for bootstrapping, so just disable it. 45.if ${.MAKE.OS} == "FreeBSD" || !defined(BOOTSTRAPPING) 46SRCS+= zopen.c 47.endif 48 49.if ${MACHINE_ARCH} == "i386" || ${MACHINE_ARCH} == "amd64" 50CFLAGS+= -DUNALIGNED_OK 51.endif 52 53VERSION_DEF= ${.CURDIR}/Versions.def 54SYMBOL_MAPS= ${.CURDIR}/Symbol.map 55CFLAGS+= -DSYMBOL_VERSIONING 56CFLAGS+= ${NO_WDEPRECATED_NON_PROTOTYPE} 57 58INCS= zconf.h zlib.h 59 60.PATH: ${ZLIBSRC}/test 61 62ZLIB_VERSION!= sed -n '/define.*ZLIB_VERSION/{s,[^0-9.],,gp;q;}' ${ZLIBSRC}/zlib.h 63 64zlib.pc: zlib.pc.in 65 sed -e 's,@prefix@,/usr,g ; \ 66 s,@exec_prefix@,$${prefix},g ; \ 67 s,@libdir@,${LIBDIR},g ; \ 68 s,@sharedlibdir@,${SHLIBDIR},g ; \ 69 s,@includedir@,${INCLUDEDIR},g ; \ 70 s,@VERSION@,${ZLIB_VERSION},g ;' \ 71 ${.ALLSRC} > ${.TARGET} 72 73minigzip: all minigzip.o 74 $(CC) -o minigzip minigzip.o -L. -lz 75 76example: all example.o 77 $(CC) -o example example.o -L. -lz 78 79test: example minigzip 80 (export LD_LIBRARY_PATH=. ; ./example ) 81 (export LD_LIBRARY_PATH=. ; \ 82 echo hello world | ./minigzip | ./minigzip -d ) 83 84PCFILES= zlib.pc 85 86.include <bsd.lib.mk> 87