]> CyberLeo.Net >> Repos - FreeBSD/releng/10.2.git/blob - gnu/usr.bin/grep/Makefile
- Copy stable/10@285827 to releng/10.2 in preparation for 10.2-RC1
[FreeBSD/releng/10.2.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 CLEANFILES+=    gnugrep.1
16
17 CFLAGS+=-I${.CURDIR} -I${DESTDIR}/usr/include/gnu -DHAVE_CONFIG_H
18
19 .if ${MK_BSD_GREP} != "yes"
20 LINKS+= ${BINDIR}/grep ${BINDIR}/egrep \
21         ${BINDIR}/grep ${BINDIR}/fgrep
22 MLINKS= grep.1 egrep.1 grep.1 fgrep.1
23 .endif
24
25 DPADD=  ${LIBGNUREGEX} ${LIBBZ2}
26 LDADD=  -lgnuregex -lbz2
27
28 .if ${MK_BSD_GREP} != "yes"
29 LINKS+= ${BINDIR}/grep ${BINDIR}/bzgrep \
30         ${BINDIR}/grep ${BINDIR}/bzegrep \
31         ${BINDIR}/grep ${BINDIR}/bzfgrep
32 MLINKS+=grep.1 bzgrep.1 grep.1 bzegrep.1 grep.1 bzfgrep.1
33 .endif
34
35 .if defined(GREP_LIBZ) && !empty(GREP_LIBZ)
36 LDADD+= -lz
37 DPADD+= ${LIBZ}
38 CFLAGS+=-DHAVE_LIBZ=1
39 .if ${MK_BSD_GREP} != "yes"
40 LINKS+= ${BINDIR}/grep ${BINDIR}/zgrep \
41         ${BINDIR}/grep ${BINDIR}/zegrep \
42         ${BINDIR}/grep ${BINDIR}/zfgrep
43 MLINKS+=grep.1 zgrep.1 grep.1 zegrep.1 grep.1 zfgrep.1
44 .endif
45 .endif
46
47 gnugrep.1: grep.1
48         cp ${.ALLSRC} ${.TARGET}
49
50 SUBDIR+=doc
51
52 check:  all
53         @failed=0; total=0; \
54         for tst in ${TESTS}; do \
55                 total=$$(($$total+1)); \
56                 if GREP=${.OBJDIR}/${PROG} srcdir=${.CURDIR}/tests \
57                    ${.CURDIR}/tests/$$tst; then \
58                         echo "PASS: $$tst"; \
59                 else \
60                         failed=$$(($$failed+1)); \
61                         echo "FAIL: $$tst"; \
62                 fi; \
63         done; \
64         if [ "$$failed" -eq 0 ]; then \
65                 echo "All $$total tests passed"; \
66         else \
67                 echo "$$failed of $$total tests failed"; \
68         fi
69
70 TESTS=  warning.sh khadafy.sh spencer1.sh bre.sh ere.sh status.sh empty.sh \
71         options.sh backref.sh file.sh
72
73 .include <bsd.prog.mk>