xref: /freebsd/usr.bin/grep/Makefile (revision 4ca50eab86aec8001978a612a42f9ae8388eceab)
1#	$NetBSD: Makefile,v 1.4 2011/02/16 01:31:33 joerg Exp $
2#	$FreeBSD$
3#	$OpenBSD: Makefile,v 1.6 2003/06/25 15:00:04 millert Exp $
4
5.include <src.opts.mk>
6
7.if ${MK_BSD_GREP} == "yes"
8PROG=	grep
9.else
10PROG=	bsdgrep
11CLEANFILES+= bsdgrep.1
12
13bsdgrep.1: grep.1
14	${CP} ${.ALLSRC} ${.TARGET}
15.endif
16SRCS=	file.c grep.c queue.c util.c
17
18# Extra files ported backported form some regex improvements
19.PATH: ${.CURDIR}/regex
20SRCS+=	fastmatch.c hashtable.c tre-compile.c tre-fastmatch.c
21CFLAGS+=-I${.CURDIR}/regex
22
23CFLAGS.gcc+= --param max-inline-insns-single=500
24
25.if ${MK_BSD_GREP} == "yes"
26LINKS=	${BINDIR}/grep ${BINDIR}/egrep \
27	${BINDIR}/grep ${BINDIR}/fgrep \
28	${BINDIR}/grep ${BINDIR}/rgrep \
29	${BINDIR}/grep ${BINDIR}/zgrep \
30	${BINDIR}/grep ${BINDIR}/zegrep \
31	${BINDIR}/grep ${BINDIR}/zfgrep
32
33MLINKS= grep.1 egrep.1 \
34	grep.1 fgrep.1 \
35	grep.1 rgrep.1 \
36	grep.1 zgrep.1 \
37	grep.1 zegrep.1 \
38	grep.1 zfgrep.1
39.endif
40
41LIBADD=	z
42
43.if ${MK_LZMA_SUPPORT} != "no"
44LIBADD+=	lzma
45
46.if ${MK_BSD_GREP} == "yes"
47LINKS+=	${BINDIR}/${PROG} ${BINDIR}/xzgrep \
48	${BINDIR}/${PROG} ${BINDIR}/xzegrep \
49	${BINDIR}/${PROG} ${BINDIR}/xzfgrep \
50	${BINDIR}/${PROG} ${BINDIR}/lzgrep \
51	${BINDIR}/${PROG} ${BINDIR}/lzegrep \
52	${BINDIR}/${PROG} ${BINDIR}/lzfgrep
53
54MLINKS+= grep.1 xzgrep.1 \
55	 grep.1 xzegrep.1 \
56	 grep.1 xzfgrep.1 \
57	 grep.1 lzgrep.1 \
58	 grep.1 lzegrep.1 \
59	 grep.1 lzfgrep.1
60.endif
61.else
62CFLAGS+= -DWITHOUT_LZMA
63.endif
64
65.if ${MK_BZIP2_SUPPORT} != "no"
66LIBADD+=	bz2
67
68.if ${MK_BSD_GREP} == "yes"
69LINKS+= ${BINDIR}/grep ${BINDIR}/bzgrep \
70	${BINDIR}/grep ${BINDIR}/bzegrep \
71	${BINDIR}/grep ${BINDIR}/bzfgrep
72MLINKS+= grep.1 bzgrep.1 \
73	 grep.1 bzegrep.1 \
74	 grep.1 bzfgrep.1
75.endif
76.else
77CFLAGS+= -DWITHOUT_BZIP2
78.endif
79
80.if ${MK_GNU_GREP_COMPAT} != "no"
81CFLAGS+= -I${DESTDIR}/usr/include/gnu
82LIBADD+=	gnuregex
83.endif
84
85.if ${MK_NLS} != "no"
86.include "${.CURDIR}/nls/Makefile.inc"
87.else
88CFLAGS+= -DWITHOUT_NLS
89.endif
90
91.if ${MK_TESTS} != "no"
92SUBDIR+=	tests
93.endif
94
95.include <bsd.prog.mk>
96