xref: /freebsd/lib/libz/Makefile (revision 517904de5ccac643589c71ac0d2751797f89e4f9)
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+=	-DHAS_snprintf -DHAS_vsnprintf -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+=		zopen.c
42SRCS+=		zutil.c
43
44.if ${MACHINE_ARCH} == "i386" || ${MACHINE_ARCH} == "amd64"
45CFLAGS+=	-DUNALIGNED_OK
46.endif
47
48VERSION_DEF=	${.CURDIR}/Versions.def
49SYMBOL_MAPS=	${.CURDIR}/Symbol.map
50CFLAGS+=	-DSYMBOL_VERSIONING
51
52INCS=		zconf.h zlib.h
53
54.PATH:		${ZLIBSRC}/test
55
56ZLIB_VERSION!=	sed -n '/define.*ZLIB_VERSION/{s,[^0-9.],,gp;q;}' ${ZLIBSRC}/zlib.h
57
58zlib.pc: zlib.pc.in
59	sed -e 's,@prefix@,/usr,g ; \
60		s,@exec_prefix@,$${prefix},g ; \
61		s,@libdir@,$${exec_prefix}/lib,g ; \
62		s,@sharedlibdir@,$${libdir},g ; \
63		s,@includedir@,$${prefix}/include,g ; \
64		s,@VERSION@,${ZLIB_VERSION},g ;' \
65		${.ALLSRC} > ${.TARGET}
66
67minigzip:	all minigzip.o
68	$(CC) -o minigzip minigzip.o -L. -lz
69
70example:	all example.o
71	$(CC) -o example example.o -L. -lz
72
73test: example minigzip
74	(export LD_LIBRARY_PATH=. ; ./example )
75	(export LD_LIBRARY_PATH=. ; \
76		echo hello world | ./minigzip | ./minigzip -d )
77
78PCFILES=	zlib.pc
79
80.include <bsd.lib.mk>
81