summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--gnu/usr.bin/Makefile2
-rw-r--r--gnu/usr.bin/grep/Makefile15
-rw-r--r--tools/build/options/WITH_BSD_GREP2
-rw-r--r--usr.bin/Makefile6
-rw-r--r--usr.bin/grep/Makefile11
5 files changed, 28 insertions, 8 deletions
diff --git a/gnu/usr.bin/Makefile b/gnu/usr.bin/Makefile
index 0ee257f..95eeeb8 100644
--- a/gnu/usr.bin/Makefile
+++ b/gnu/usr.bin/Makefile
@@ -27,9 +27,7 @@ _groff= groff
.endif
.endif
-.if ${MK_BSD_GREP} != "yes"
_grep= grep
-.endif
.if ${MK_CVS} != "no"
_cvs= cvs
diff --git a/gnu/usr.bin/grep/Makefile b/gnu/usr.bin/grep/Makefile
index b0c3988..7d3b607 100644
--- a/gnu/usr.bin/grep/Makefile
+++ b/gnu/usr.bin/grep/Makefile
@@ -1,35 +1,50 @@
# $FreeBSD$
+.include <bsd.own.mk>
+
GREP_LIBZ=YES
+.if ${MK_BSD_GREP} != "yes"
PROG= grep
+.else
+PROG= gnugrep
+.endif
SRCS= closeout.c dfa.c error.c exclude.c grep.c grepmat.c hard-locale.c \
isdir.c kwset.c obstack.c quotearg.c savedir.c search.c xmalloc.c \
xstrtoumax.c
CFLAGS+=-I${.CURDIR} -I${DESTDIR}/usr/include/gnu -DHAVE_CONFIG_H
+.if ${MK_BSD_GREP} != "yes"
LINKS+= ${BINDIR}/grep ${BINDIR}/egrep \
${BINDIR}/grep ${BINDIR}/fgrep
MLINKS= grep.1 egrep.1 grep.1 fgrep.1
+.endif
DPADD= ${LIBGNUREGEX} ${LIBBZ2}
LDADD= -lgnuregex -lbz2
+.if ${MK_BSD_GREP} != "yes"
LINKS+= ${BINDIR}/grep ${BINDIR}/bzgrep \
${BINDIR}/grep ${BINDIR}/bzegrep \
${BINDIR}/grep ${BINDIR}/bzfgrep
MLINKS+=grep.1 bzgrep.1 grep.1 bzegrep.1 grep.1 bzfgrep.1
+.endif
.if defined(GREP_LIBZ) && !empty(GREP_LIBZ)
LDADD+= -lz
DPADD+= ${LIBZ}
CFLAGS+=-DHAVE_LIBZ=1
+.if ${MK_BSD_GREP} != "yes"
LINKS+= ${BINDIR}/grep ${BINDIR}/zgrep \
${BINDIR}/grep ${BINDIR}/zegrep \
${BINDIR}/grep ${BINDIR}/zfgrep
MLINKS+=grep.1 zgrep.1 grep.1 zegrep.1 grep.1 zfgrep.1
.endif
+.endif
+
+gnugrep.1: grep.1
+ cp ${.ALLSRC} ${.TARGET}
SUBDIR+=doc
diff --git a/tools/build/options/WITH_BSD_GREP b/tools/build/options/WITH_BSD_GREP
index 702ca25..e664117 100644
--- a/tools/build/options/WITH_BSD_GREP
+++ b/tools/build/options/WITH_BSD_GREP
@@ -1,2 +1,2 @@
.\" $FreeBSD$
-Build BSD-licensed grep instead of GNU grep.
+Install BSD-licensed grep as '[ef]grep' instead of GNU grep.
diff --git a/usr.bin/Makefile b/usr.bin/Makefile
index 85a9180..f258347 100644
--- a/usr.bin/Makefile
+++ b/usr.bin/Makefile
@@ -57,7 +57,7 @@ SUBDIR= alias \
getconf \
getent \
getopt \
- ${_grep} \
+ grep \
gzip \
head \
hexdump \
@@ -227,10 +227,6 @@ SUBDIR+= bluetooth
SUBDIR+= cpio
.endif
-.if ${MK_BSD_GREP} != "no"
-_grep= grep
-.endif
-
.if ${MK_CALENDAR} != "no"
SUBDIR+= calendar
.endif
diff --git a/usr.bin/grep/Makefile b/usr.bin/grep/Makefile
index 98fceeb..8cd490d 100644
--- a/usr.bin/grep/Makefile
+++ b/usr.bin/grep/Makefile
@@ -2,9 +2,16 @@
# $FreeBSD$
# $OpenBSD: Makefile,v 1.6 2003/06/25 15:00:04 millert Exp $
+.include <bsd.own.mk>
+
+.if ${MK_BSD_GREP} == "yes"
PROG= grep
+.else
+PROG= bsdgrep
+.endif
SRCS= fastgrep.c file.c grep.c queue.c util.c
+.if ${MK_BSD_GREP} == "yes"
LINKS= ${BINDIR}/grep ${BINDIR}/egrep \
${BINDIR}/grep ${BINDIR}/fgrep \
${BINDIR}/grep ${BINDIR}/zgrep \
@@ -16,6 +23,10 @@ MLINKS= grep.1 egrep.1 \
grep.1 zgrep.1 \
grep.1 zegrep.1 \
grep.1 zfgrep.1
+.endif
+
+bsdgrep.1: grep.1
+ cp ${.ALLSRC} ${.TARGET}
WARNS?= 6
OpenPOWER on IntegriCloud