]> CyberLeo.Net >> Repos - FreeBSD/releng/10.0.git/blob - gnu/usr.bin/grep/Makefile
- Copy stable/10 (r259064) to releng/10.0 as part of the
[FreeBSD/releng/10.0.git] / gnu / usr.bin / grep / Makefile
1 # $FreeBSD$
2
3 .include <bsd.own.mk>
4
5 GREP_LIBZ=YES
6
7 .if ${MK_BSD_GREP} != "yes"
8 PROG=   grep
9 .else
10 PROG=   gnugrep
11 .endif
12 SRCS=   closeout.c dfa.c error.c exclude.c grep.c grepmat.c hard-locale.c \
13         isdir.c kwset.c obstack.c quotearg.c savedir.c search.c xmalloc.c \
14         xstrtoumax.c
15
16 CFLAGS+=-I${.CURDIR} -I${DESTDIR}/usr/include/gnu -DHAVE_CONFIG_H
17
18 .if ${MK_BSD_GREP} != "yes"
19 LINKS+= ${BINDIR}/grep ${BINDIR}/egrep \
20         ${BINDIR}/grep ${BINDIR}/fgrep
21 MLINKS= grep.1 egrep.1 grep.1 fgrep.1
22 .endif
23
24 DPADD=  ${LIBGNUREGEX} ${LIBBZ2}
25 LDADD=  -lgnuregex -lbz2
26
27 .if ${MK_BSD_GREP} != "yes"
28 LINKS+= ${BINDIR}/grep ${BINDIR}/bzgrep \
29         ${BINDIR}/grep ${BINDIR}/bzegrep \
30         ${BINDIR}/grep ${BINDIR}/bzfgrep
31 MLINKS+=grep.1 bzgrep.1 grep.1 bzegrep.1 grep.1 bzfgrep.1
32 .endif
33
34 .if defined(GREP_LIBZ) && !empty(GREP_LIBZ)
35 LDADD+= -lz
36 DPADD+= ${LIBZ}
37 CFLAGS+=-DHAVE_LIBZ=1
38 .if ${MK_BSD_GREP} != "yes"
39 LINKS+= ${BINDIR}/grep ${BINDIR}/zgrep \
40         ${BINDIR}/grep ${BINDIR}/zegrep \
41         ${BINDIR}/grep ${BINDIR}/zfgrep
42 MLINKS+=grep.1 zgrep.1 grep.1 zegrep.1 grep.1 zfgrep.1
43 .endif
44 .endif
45
46 gnugrep.1: grep.1
47         cp ${.ALLSRC} ${.TARGET}
48
49 SUBDIR+=doc
50
51 check:  all
52         @failed=0; total=0; \
53         for tst in ${TESTS}; do \
54                 total=$$(($$total+1)); \
55                 if GREP=${.OBJDIR}/${PROG} srcdir=${.CURDIR}/tests \
56                    ${.CURDIR}/tests/$$tst; then \
57                         echo "PASS: $$tst"; \
58                 else \
59                         failed=$$(($$failed+1)); \
60                         echo "FAIL: $$tst"; \
61                 fi; \
62         done; \
63         if [ "$$failed" -eq 0 ]; then \
64                 echo "All $$total tests passed"; \
65         else \
66                 echo "$$failed of $$total tests failed"; \
67         fi
68
69 TESTS=  warning.sh khadafy.sh spencer1.sh bre.sh ere.sh status.sh empty.sh \
70         options.sh backref.sh file.sh
71
72 .include <bsd.prog.mk>