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