SHELL=	     /bin/sh
CC=	     @CC@
INSTALL=     @INSTALL@
prefix=      @prefix@
exec_prefix= @exec_prefix@
bindir=      @bindir@
mandir=      @mandir@

DEFS=	@DEFS@
LIBS=	@LIBS@

KLIBS=	@KLIBS@
ETLIB=	-lcom_err

INCLUDES= -I../include -I../regex -I$(prefix)/include
CFLAGS=	  -O
LDFLAGS=  -L$(prefix)/lib

OBJS=	dsgrep.o

all:	dsgrep

dsgrep: $(OBJS) ../libds/libds.a ../usp/libusp.a ../regex/libregexp.a
	${CC} $(LDFLAGS) -o $@ $(OBJS) ../libds/libds.a ${KLIBS} ../usp/libusp.a ${ETLIB} ../regex/libregexp.a ${LIBS}

.c.o:
	${CC} ${CFLAGS} ${INCLUDES} ${DEFS} -c $*.c

install: all
	$(INSTALL) -s dsgrep $(bindir)
	$(INSTALL) -m 644 dsgrep.1 $(mandir)/man1

clean:
	rm -f dsgrep *.o *~ \#* *.bak

distclean: clean
	rm -f Makefile
