#
# spog (simple postgres query interface)
#
# $Id: Makefile,v 2.3 1992/08/13 11:47:33 schoenw Exp $
#
# $Log: Makefile,v $
# Revision 2.3  1992/08/13  11:47:33  schoenw
# scripts using spog added
#
# Revision 2.2  1992/05/27  14:50:54  schoenw
# HAVE_XMALLOC define for some readline versions added
#
# Revision 2.1  1992/05/22  12:53:33  schoenw
# this is the public release 1.0
#
# Revision 1.4  1992/05/22  12:46:00  schoenw
# builtin-commands, help functions and completion added
#
# Revision 1.3  1992/03/09  15:39:21  schoenw
# bug in install target
#
# Revision 1.2  1992/03/09  15:37:46  schoenw
# clean target added
#
# Revision 1.1  1992/01/24  16:45:20  schoenw
# Initial revision
#

# some readline libraries have xmalloc and xrealloc, some don't
# define NEED_XMALLOC if your readline library lacks xmalloc and xrealloc
CC=cc
#CFLAGS= -O -DNEED_XMALLOC #-DDEBUG
CFLAGS= -O 

# set POSTGRESHOME to the top directory of postgres
#POSTGRES=/usr/local/postgres
POSTGRES=/share2/postgres
# set PORT to the name of your port
PORT=ultrix4
# let RLINC point to the include files of gnu's readline
RLINC=/usr/local/include

PGINC=$(POSTGRES)/src/lib/H
INCLUDES=-I$(PGINC) -I$(RLINC)

PGLIB=$(POSTGRES)/obj.$(PORT)
LIBS=-L$(PGLIB)

spog: spog.o query.o command.o Makefile
	$(CC) -o spog $(CFLAGS) spog.o query.o command.o \
              -lreadline -ltermcap $(LIBS) -lpq

spog.o: spog.c spog.h
	$(CC) -c $(CFLAGS) $(INCLUDES) spog.c

command.o: command.c spog.h
	$(CC) -c $(CFLAGS) $(INCLUDES) command.c

query.o: query.c spog.h
	$(CC) -c $(CFLAGS) $(INCLUDES) query.c

install: spog spog.1
	cp spog $(POSTGRES)/bin
	cp spog.1 $(POSTGRES)/man/man1
	cp pg_edit.sh $(POSTGRES)/bin/pg_edit
	cp pg_edit.1 $(POSTGRES)/man/man1
	cp pg_info.sh $(POSTGRES)/bin/pg_info
	cp pg_info.1 $(POSTGRES)/man/man1

clean:
	rm -f spog *.o

