xref: /freebsd/usr.bin/grep/Makefile (revision 63d1fd5970ec814904aa0f4580b10a0d302d08b2)
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 xmalloc.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}/zgrep \
29	${BINDIR}/grep ${BINDIR}/zegrep \
30	${BINDIR}/grep ${BINDIR}/zfgrep
31
32MLINKS= grep.1 egrep.1 \
33	grep.1 fgrep.1 \
34	grep.1 zgrep.1 \
35	grep.1 zegrep.1 \
36	grep.1 zfgrep.1
37.endif
38
39LIBADD=	z
40
41.if ${MK_LZMA_SUPPORT} != "no"
42LIBADD+=	lzma
43
44.if ${MK_BSD_GREP} == "yes"
45LINKS+=	${BINDIR}/${PROG} ${BINDIR}/xzgrep \
46	${BINDIR}/${PROG} ${BINDIR}/xzegrep \
47	${BINDIR}/${PROG} ${BINDIR}/xzfgrep \
48	${BINDIR}/${PROG} ${BINDIR}/lzgrep \
49	${BINDIR}/${PROG} ${BINDIR}/lzegrep \
50	${BINDIR}/${PROG} ${BINDIR}/lzfgrep
51
52MLINKS+= grep.1 xzgrep.1 \
53	 grep.1 xzegrep.1 \
54	 grep.1 xzfgrep.1 \
55	 grep.1 lzgrep.1 \
56	 grep.1 lzegrep.1 \
57	 grep.1 lzfgrep.1
58.endif
59.else
60CFLAGS+= -DWITHOUT_LZMA
61.endif
62
63.if ${MK_BZIP2_SUPPORT} != "no"
64LIBADD+=	bz2
65
66.if ${MK_BSD_GREP} == "yes"
67LINKS+= ${BINDIR}/grep ${BINDIR}/bzgrep \
68	${BINDIR}/grep ${BINDIR}/bzegrep \
69	${BINDIR}/grep ${BINDIR}/bzfgrep
70MLINKS+= grep.1 bzgrep.1 \
71	 grep.1 bzegrep.1 \
72	 grep.1 bzfgrep.1
73.endif
74.else
75CFLAGS+= -DWITHOUT_BZIP2
76.endif
77
78.if ${MK_GNU_GREP_COMPAT} != "no"
79CFLAGS+= -I${DESTDIR}/usr/include/gnu
80LIBADD+=	gnuregex
81.endif
82
83.if ${MK_NLS} != "no"
84.include "${.CURDIR}/nls/Makefile.inc"
85.else
86CFLAGS+= -DWITHOUT_NLS
87.endif
88
89.if ${MK_TESTS} != "no"
90SUBDIR+=	tests
91.endif
92
93.include <bsd.prog.mk>
94