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