Makefile revision 361069
1#
2# $FreeBSD: stable/11/lib/libz/Makefile 361069 2020-05-15 00:51:30Z delphij $
3#
4
5PACKAGE=lib${LIB}
6LIB=		z
7SHLIBDIR?=	/lib
8SHLIB_MAJOR=	6
9MAN=		zlib.3 zopen.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+=	-DHAS_snprintf -DHAS_vsnprintf -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+=		zopen.c
41SRCS+=		zutil.c
42
43.if ${MACHINE_ARCH} == "i386" || ${MACHINE_ARCH} == "amd64"
44CFLAGS+=	-DUNALIGNED_OK
45.endif
46
47VERSION_DEF=	${.CURDIR}/Versions.def
48SYMBOL_MAPS=	${.CURDIR}/Symbol.map
49CFLAGS+=	-DSYMBOL_VERSIONING
50
51INCS=		zconf.h zlib.h
52
53.PATH:		${ZLIBSRC}/test
54
55ZLIB_VERSION!=	sed -n '/define.*ZLIB_VERSION/{s,[^0-9.],,gp;q;}' ${ZLIBSRC}/zlib.h
56
57zlib.pc: zlib.pc.in
58	sed -e 's,@prefix@,/usr,g ; \
59		s,@exec_prefix@,$${prefix},g ; \
60		s,@libdir@,$${exec_prefix}/lib,g ; \
61		s,@sharedlibdir@,$${libdir},g ; \
62		s,@includedir@,$${prefix}/include,g ; \
63		s,@VERSION@,${ZLIB_VERSION},g ;' \
64		${.ALLSRC} > ${.TARGET}
65
66minigzip:	all minigzip.o
67	$(CC) -o minigzip minigzip.o -L. -lz
68
69example:	all example.o
70	$(CC) -o example example.o -L. -lz
71
72test: example minigzip
73	(export LD_LIBRARY_PATH=. ; ./example )
74	(export LD_LIBRARY_PATH=. ; \
75		echo hello world | ./minigzip | ./minigzip -d )
76
77FILES=		zlib.pc
78FILESDIR=	${LIBDATADIR}/pkgconfig
79
80.include <bsd.lib.mk>
81
82## XXX: clang integrated-as doesn't grok .intel_syntax directives yet
83#ACFLAGS.gvmat64.S=	${CLANG_NO_IAS}
84