#-------------------------------------------------------------------------
#
# Makefile.inc--
#    Makefile for bin/psql
#
# Copyright (c) 1994, Regents of the University of California
#
#
# IDENTIFICATION
#    $Header: /usr/local/devel/pglite/cvs/src/bin/psql/Makefile,v 1.8 1995/05/01 03:05:18 andrew Exp $
#
#-------------------------------------------------------------------------

MKDIR=	../../mk
include $(MKDIR)/postgres.mk

# About the use of readline:
#    psql does not require the GNU readline and history libraries. Hence, we
#    do not compile with them by default. However, there are hooks in the
#    program which supports the use of GNU readline and history. Should you
#    decide to use them, change USE_READLINE to true and change READLINE_INCDIR
#    and READLINE_LIBDIR to reflect the location of the readline and histroy
#    headers and libraries.
USE_READLINE= false

# directories for the readline and history libraries.
READLINE_INCDIR=  /usr/local/include
READLINE_LIBDIR=  /usr/local/lib


CFLAGS += -I$(CURDIR) \
	-I$(srcdir)/backend/$(objdir) \
	-I$(srcdir)/backend/include \
	-I$(srcdir)/backend

ifeq ($(USE_READLINE), false)
   CFLAGS += -DNOREADLINE
else
   CFLAGS += -I$(READLINE_INCDIR)
   LIBCURSES=	-lcurses
   LD_ADD += -L$(READLINE_LIBDIR) -lreadline -lhistory $(LIBCURSES)

   ifeq ($(PORTNAME), ultrix4)
   LD_ADD += -ltermcap
   else
   ifeq ($(PORTNAME), sparc)
   LD_ADD += -ltermcap
   endif
   endif
endif

LIB=	tdb
LIBSRCS= tdb.c tgPrint.c pqutils.c stringutils.c

PROG= psql
SRCS= psql.c

ifeq ($(USE_READLINE), false)
SRCS+= rlstubs.c
endif


LD_ADD+= $(objdir)/libtdb.a \
	-L$(srcdir)/libpq/$(objdir) -L$(LIBDIR) -lpq

all:: libtdb.a $(PROG) 


include $(MKDIR)/postgres.lib.mk
include $(MKDIR)/postgres.prog.mk


