#-------------------------------------------------------------------------
#
# Makefile.inc--
#    Makefile for bin/psql
#
# Copyright (c) 1994, Regents of the University of California
#
#
# IDENTIFICATION
#    /usr/local/devel/pglite/cvs/src/bin/psql/Makefile,v 1.13 1995/05/26 01:23:04 jolly 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= true


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

ifeq ($(USE_READLINE), true)
   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
else
   CFLAGS += -DNOREADLINE
endif

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

PROG= psql
ifndef LINUX_ELF
SRCS= psql.c $(LIBSRCS)
else
SRCS= psql.c
endif

ifneq ($(USE_READLINE), true)
SRCS+= rlstubs.c
endif

ifndef LINUX_ELF
$(PROG):	libtdb.a

LD_ADD+= -L$(srcdir)/libpq/$(objdir) -L$(LIBDIR) -lpq

all:: $(PROG) 
else
LD_ADD+= $(objdir)/libtdb.so.1 \
	-L$(srcdir)/libpq/$(objdir) -L$(LIBDIR) -lpq
  
all:: libtdb.so.1 $(PROG) 
endif


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




