freebsd-dev/usr.bin/grep/Makefile
Baptiste Daroussin 612c330d85 Use a script wrapper for <compress>grep
Import the wrapper script from zstdgrep (written by wiz@netbsd.org)

Modify it to support more than just zstd (adding support for gzip,
lzma, xz and bzip2)

Write a simple manpage dedicated for it.

Only use that new wrapper both for gnu grep and bsd grep

Next step will be removing code related to compression format from bsdgrep

Reviewed by:	kevans
Approved by:	kevans
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D15193
2018-04-25 13:23:58 +00:00

101 lines
2.2 KiB
Makefile

# $NetBSD: Makefile,v 1.4 2011/02/16 01:31:33 joerg Exp $
# $FreeBSD$
# $OpenBSD: Makefile,v 1.6 2003/06/25 15:00:04 millert Exp $
.include <src.opts.mk>
.if ${MK_BSD_GREP} == "yes"
PROG= grep
MAN1= grep.1 zgrep.1
.else
PROG= bsdgrep
CLEANFILES+= bsdgrep.1
MAN1= grep.1 zgrep.1
bsdgrep.1: grep.1
${CP} ${.ALLSRC} ${.TARGET}
.endif
SRCS= file.c grep.c queue.c util.c
.if ${MK_BSD_GREP_FASTMATCH} == "yes"
# Extra files ported backported for some regex improvements
.PATH: ${.CURDIR}/regex
SRCS+= fastmatch.c hashtable.c tre-compile.c tre-fastmatch.c
CFLAGS+=-I${.CURDIR}/regex
.else
CFLAGS+= -DWITHOUT_FASTMATCH
.endif
SCRIPTS= zgrep.sh
LINKS= ${BINDIR}/zgrep ${BINDIR}/zfgrep \
${BINDIR}/zgrep ${BINDIR}/zegrep \
${BINDIR}/zgrep ${BINDIR}/bzgrep \
${BINDIR}/zgrep ${BINDIR}/bzegrep \
${BINDIR}/zgrep ${BINDIR}/bzfgrep \
${BINDIR}/zgrep ${BINDIR}/lzgrep \
${BINDIR}/zgrep ${BINDIR}/lzegrep \
${BINDIR}/zgrep ${BINDIR}/lzfgrep \
${BINDIR}/zgrep ${BINDIR}/xzgrep \
${BINDIR}/zgrep ${BINDIR}/xzegrep \
${BINDIR}/zgrep ${BINDIR}/xzfgrep \
${BINDIR}/zgrep ${BINDIR}/zstdgrep \
${BINDIR}/zgrep ${BINDIR}/zstdegrep \
${BINDIR}/zgrep ${BINDIR}/zstdegrep
MLINKS= zgrep.1 zfgrep.1 \
zgrep.1 zegrep.1 \
zgrep.1 bzgrep.1 \
zgrep.1 bzegrep.1 \
zgrep.1 bzfgrep.1 \
zgrep.1 lzgrep.1 \
zgrep.1 lzegrep.1 \
zgrep.1 lzfgrep.1 \
zgrep.1 xzgrep.1 \
zgrep.1 xzegrep.1 \
zgrep.1 xzfgrep.1 \
zgrep.1 zstdgrep.1 \
zgrep.1 zstdegrep.1 \
zgrep.1 zstdfgrep.1
CFLAGS.gcc+= --param max-inline-insns-single=500
.if ${MK_BSD_GREP} == "yes"
LINKS+= ${BINDIR}/grep ${BINDIR}/egrep \
${BINDIR}/grep ${BINDIR}/fgrep \
${BINDIR}/grep ${BINDIR}/rgrep \
MLINKS+= grep.1 egrep.1 \
grep.1 fgrep.1 \
grep.1 rgrep.1
.endif
LIBADD= z
.if ${MK_LZMA_SUPPORT} != "no"
LIBADD+= lzma
.else
CFLAGS+= -DWITHOUT_LZMA
.endif
.if ${MK_BZIP2_SUPPORT} != "no"
LIBADD+= bz2
.else
CFLAGS+= -DWITHOUT_BZIP2
.endif
.if ${MK_GNU_GREP_COMPAT} != "no"
CFLAGS+= -I${SYSROOT:U${DESTDIR}}/usr/include/gnu -DWITH_GNU
LIBADD+= gnuregex
.endif
.if ${MK_NLS} != "no"
.include "${.CURDIR}/nls/Makefile.inc"
.else
CFLAGS+= -DWITHOUT_NLS
.endif
HAS_TESTS=
SUBDIR.${MK_TESTS}+= tests
.include <bsd.prog.mk>