Makefile revision 226664
1220422Sgabor#	$NetBSD: Makefile,v 1.4 2011/02/16 01:31:33 joerg Exp $
2210389Sgabor#	$FreeBSD: head/usr.bin/grep/Makefile 226664 2011-10-23 16:04:07Z gabor $
3210389Sgabor#	$OpenBSD: Makefile,v 1.6 2003/06/25 15:00:04 millert Exp $
4210389Sgabor
5222273Sobrien.include <bsd.own.mk>
6222273Sobrien
7222273Sobrien.if ${MK_BSD_GREP} == "yes"
8210389SgaborPROG=	grep
9222273Sobrien.else
10222273SobrienPROG=	bsdgrep
11226035SgaborCLEANFILES+= bsdgrep.1
12226035Sgabor
13226035Sgaborbsdgrep.1: grep.1
14226035Sgabor	cp ${.ALLSRC} ${.TARGET}
15222273Sobrien.endif
16226035SgaborSRCS=	file.c grep.c queue.c util.c
17220422Sgabor
18226035Sgabor# Extra files ported backported form some regex improvements
19226035Sgabor.PATH: ${.CURDIR}/regex
20226035SgaborSRCS+=	fastmatch.c hashtable.c tre-compile.c tre-fastmatch.c xmalloc.c
21226035SgaborCFLAGS+=-I${.CURDIR}/regex
22226035Sgabor
23222273Sobrien.if ${MK_BSD_GREP} == "yes"
24210389SgaborLINKS=	${BINDIR}/grep ${BINDIR}/egrep \
25210389Sgabor	${BINDIR}/grep ${BINDIR}/fgrep \
26210389Sgabor	${BINDIR}/grep ${BINDIR}/zgrep \
27210389Sgabor	${BINDIR}/grep ${BINDIR}/zegrep \
28226035Sgabor	${BINDIR}/grep ${BINDIR}/zfgrep \
29226035Sgabor	${BINDIR}/grep ${BINDIR}/xzgrep \
30226035Sgabor	${BINDIR}/grep ${BINDIR}/xzegrep \
31226035Sgabor	${BINDIR}/grep ${BINDIR}/xzfgrep \
32226035Sgabor	${BINDIR}/grep ${BINDIR}/lzgrep \
33226035Sgabor	${BINDIR}/grep ${BINDIR}/lzegrep \
34226035Sgabor	${BINDIR}/grep ${BINDIR}/lzfgrep
35210389Sgabor
36210389SgaborMLINKS= grep.1 egrep.1 \
37210389Sgabor	grep.1 fgrep.1 \
38210389Sgabor	grep.1 zgrep.1 \
39210389Sgabor	grep.1 zegrep.1 \
40226035Sgabor	grep.1 zfgrep.1 \
41226035Sgabor	grep.1 xzgrep.1 \
42226035Sgabor	grep.1 xzegrep.1 \
43226035Sgabor	grep.1 xzfgrep.1 \
44226035Sgabor	grep.1 lzgrep.1 \
45226035Sgabor	grep.1 lzegrep.1 \
46226035Sgabor	grep.1 lzfgrep.1
47222273Sobrien.endif
48210389Sgabor
49226271SgaborLDADD=	-lz -llzma
50226271SgaborDPADD=	${LIBZ} ${LIBLZMA}
51222273Sobrien
52226271Sgabor.if !defined(WITHOUT_BZIP2)
53226271SgaborLDADD+=	-lbz2
54226271SgaborDPADD+=	${LIBBZ2}
55226271Sgabor
56226664Sgabor.if ${MK_BSD_GREP} == "yes"
57226271SgaborLINKS+= ${BINDIR}/grep ${BINDIR}/bzgrep \
58226271Sgabor	${BINDIR}/grep ${BINDIR}/bzegrep \
59226271Sgabor	${BINDIR}/grep ${BINDIR}/bzfgrep
60226271SgaborMLINKS+= grep.1 bzgrep.1 \
61226271Sgabor	 grep.1 bzegrep.1 \
62226271Sgabor	 grep.1 bzfgrep.1
63226664Sgabor.endif
64226271Sgabor.else
65226271SgaborCFLAGS+= -DWITHOUT_BZIP2
66226271Sgabor.endif
67226271Sgabor
68210389Sgabor.if !defined(WITHOUT_GNU_COMPAT)
69210389SgaborCFLAGS+= -I/usr/include/gnu
70210389SgaborLDADD+=	-lgnuregex
71210389SgaborDPADD+=	${LIBGNUREGEX}
72210389Sgabor.endif
73210389Sgabor
74210389Sgabor.if !defined(WITHOUT_NLS)
75210389Sgabor.include "${.CURDIR}/nls/Makefile.inc"
76210389Sgabor.else
77210389SgaborCFLAGS+= -DWITHOUT_NLS
78210389Sgabor.endif
79210389Sgabor
80210389Sgabor.include <bsd.prog.mk>
81