1## Process this file with automake to create Makefile.in 2# Copyright 1997-1998, 2005-2021 Free Software Foundation, Inc. 3# 4# This program is free software; you can redistribute it and/or modify 5# it under the terms of the GNU General Public License as published by 6# the Free Software Foundation; either version 3, or (at your option) 7# any later version. 8# 9# This program is distributed in the hope that it will be useful, 10# but WITHOUT ANY WARRANTY; without even the implied warranty of 11# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12# GNU General Public License for more details. 13# 14# You should have received a copy of the GNU General Public License 15# along with this program. If not, see <https://www.gnu.org/licenses/>. 16 17LN = ln 18 19AM_CFLAGS = $(WARN_CFLAGS) $(WERROR_CFLAGS) $(PCRE_CFLAGS) 20 21# Tell the linker to omit references to unused shared libraries. 22AM_LDFLAGS = $(IGNORE_UNUSED_LIBRARIES_CFLAGS) 23 24bin_PROGRAMS = grep 25bin_SCRIPTS = egrep fgrep 26grep_SOURCES = \ 27 dfasearch.c \ 28 die.h \ 29 grep.c \ 30 kwsearch.c \ 31 kwset.c \ 32 searchutils.c 33if USE_PCRE 34grep_SOURCES += pcresearch.c 35endif 36 37noinst_HEADERS = grep.h kwset.h search.h system.h 38 39# Sometimes, the expansion of $(LIBINTL) includes -lc which may 40# include modules defining variables like 'optind', so libgreputils.a 41# must precede $(LIBINTL) in order to ensure we use GNU getopt. 42# But libgreputils.a must also follow $(LIBINTL), since libintl uses 43# replacement functions defined in libgreputils.a. 44LDADD = \ 45 ../lib/libgreputils.a $(LIBINTL) ../lib/libgreputils.a $(LIBICONV) \ 46 $(LIBTHREAD) 47 48grep_LDADD = $(LDADD) $(PCRE_LIBS) $(LIBCSTACK) 49localedir = $(datadir)/locale 50AM_CPPFLAGS = -I$(top_builddir)/lib -I$(top_srcdir)/lib 51 52EXTRA_DIST = egrep.sh 53 54egrep fgrep: egrep.sh Makefile 55 $(AM_V_GEN)grep=`echo grep | sed -e '$(transform)'` && \ 56 case $@ in egrep) option=-E;; fgrep) option=-F;; esac && \ 57 shell_does_substrings='set x/y && d=$${1%/*} && test "$$d" = x' && \ 58 if $(SHELL) -c "$$shell_does_substrings" 2>/dev/null; then \ 59 edit_substring='s,X,X,'; \ 60 else \ 61 edit_substring='s,\$${0%/\*},`expr "X$$0" : '\''X\\(.*\\)/'\''`,g'; \ 62 fi && \ 63 sed -e 's|[@]SHELL@|$(SHELL)|g' \ 64 -e "$$edit_substring" \ 65 -e "s|[@]grep@|$$grep|g" \ 66 -e "s|[@]option@|$$option|g" <$(srcdir)/egrep.sh >$@-t 67 $(AM_V_at)chmod +x $@-t 68 $(AM_V_at)mv $@-t $@ 69 70CLEANFILES = egrep fgrep *-t 71