xref: /freebsd-12.1/gnu/usr.bin/grep/Makefile (revision 90fc3504)
1# $FreeBSD$
2
3GREP_LIBZ=YES
4
5PROG=	grep
6SRCS=   dfa.c grep.c kwset.c obstack.c savedir.c search.c
7
8CFLAGS+=-I${.CURDIR} -I${.CURDIR}/../../../../include/gnu -DHAVE_CONFIG_H
9
10LINKS+=	${BINDIR}/grep ${BINDIR}/egrep \
11	${BINDIR}/grep ${BINDIR}/fgrep
12MLINKS=	grep.1 egrep.1 grep.1 fgrep.1
13
14DPADD=	${LIBGNUREGEX} ${LIBBZ2}
15LDADD=	-lgnuregex -lbz2
16
17LINKS+=	${BINDIR}/grep ${BINDIR}/bzgrep \
18	${BINDIR}/grep ${BINDIR}/bzegrep \
19	${BINDIR}/grep ${BINDIR}/bzfgrep
20MLINKS+=grep.1 bzgrep.1 grep.1 bzegrep.1 grep.1 bzfgrep.1
21
22.if defined(GREP_LIBZ) && !empty(GREP_LIBZ)
23LDADD+=	-lz
24DPADD+=	${LIBZ}
25CFLAGS+=-DHAVE_LIBZ=1
26LINKS+=	${BINDIR}/grep ${BINDIR}/zgrep \
27	${BINDIR}/grep ${BINDIR}/zegrep \
28	${BINDIR}/grep ${BINDIR}/zfgrep
29MLINKS+=grep.1 zgrep.1 grep.1 zegrep.1 grep.1 zfgrep.1
30.endif
31
32SUBDIR+=doc
33
34check:	all
35	@failed=0; total=0; \
36	for tst in ${TESTS}; do \
37		total=$$(($$total+1)); \
38		if GREP=${.OBJDIR}/${PROG} srcdir=${.CURDIR}/tests \
39		   ${.CURDIR}/tests/$$tst; then \
40			echo "PASS: $$tst"; \
41		else \
42			failed=$$(($$failed+1)); \
43			echo "FAIL: $$tst"; \
44		fi; \
45	done; \
46	if [ "$$failed" -eq 0 ]; then \
47		echo "All $$total tests passed"; \
48	else \
49		echo "$$failed of $$total tests failed"; \
50	fi
51
52TESTS=	warning.sh khadafy.sh spencer1.sh bre.sh ere.sh status.sh empty.sh \
53	options.sh
54
55.include <bsd.prog.mk>
56