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