# Makefile for GNU grep

# Copyright (C) 1992 Free Software Foundation, Inc.

# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.

# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.

# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.

#### Start of system configuration section. ####

# Things you might add to DEFS:
# -DSTDC_HEADERS	If you have ANSI C headers and libraries.
# -DHAVE_UNISTD_H	If you have unistd.h.
# -DUSG			If you have System V/ANSI C string
#			and memory functions and headers.
# -D__CHAR_UNSIGNED__	If type `char' is unsigned.
#			gcc defines this automatically.
DEFS=-DGREP  -DSTDC_HEADERS=1 -DHAVE_STRING_H=1 -DHAVE_UNISTD_H=1 -DHAVE_ALLOCA_H=1 -DHAVE_MEMCHR=1 -DHAVE_STRERROR=1

CFLAGS=$(OPT) -wo $(DEFS)
LDFLAGS=-fnone

# Where to install executables.
bindir=/usr/bin

# Where to install man pages.
mandir=/usr/man/man1

# Extension for man pages.
manext=1

#### End of system configuration section. ####

SRCS=grep.c getopt.c regex.c dfa.c kwset.c obstack.c search.c
OBJS=grep.o getopt.o regex.o dfa.o kwset.o obstack.o search.o

all:	grep

install:	$(bindir)/grep $(bindir)/egrep $(bindir)/fgrep \
		$(mandir)/grep.$(manext)

$(bindir)/grep:	grep
	install -lc $? $@

$(bindir)/egrep $(bindir)/fgrep:	$(bindir)/grep
	install -l $? $@

$(mandir)/grep.$(manext):	grep.man
	install -lc $? $@

grep:	$(OBJS)
	$(CC) $(LDFLAGS) -o $@ $(OBJS)

clean:
	rm -f core grep *.o

# Some header file dependencies that really ought to be automatically deduced.
dfa.o search.o: dfa.h
grep.o search.o: grep.h
kwset.o search.o: kwset.h
kwset.o obstack.o: obstack.h
regex.o search.o: regex.h
