ifndef MK
MK=../mk
endif

# Change this line when you recompile, or send it in on the command line:
#PORTNAME=alpha
PORTNAME=sparc
#PORTNAME=linux
#PORTNAME=hpux

# Change this line for kerberos stuff
KRBVERS=4
#KRBVERS=5

# Change this line for pthreads stuff
PTHREADS=mit
#PTHREADS=decosf1
#PTHREADS=aix
#PTHREADS=hpux

# Change this for threads stuff, too
PTHREADS_DIR=$(HOME)/pthreads
#PTHREADS_DIR=/usr/local

include $(MK)/$(PORTNAME).mk
ifdef PTHREADS
include $(MK)/$(PTHREADS)_pthreads.mk
endif
include $(MK)/kerberos.mk

ifndef LIBPQ
LIBPQ=../LIBPQ.a
endif

LIBS += $(KRBLIBS) $(PTHREADS_LIBS)
CC=gcc
COPT=-g
ifdef VPATH
VPATH_CFLAGS=$(shell echo .:$(VPATH) | sed -e 's/^/:/' -e 's/:$$//' -e 's/:/ -I/g')
endif
CFLAGS += $(VPATH_CFLAGS) $(COPT) -I.. -I../tmp -I.
LDFLAGS += $(PTHREADS_LDFLAGS) $(KRBLDFLAGS)

TESTS=test-connect test-2 test-3 test-4 test-5

all: $(TESTS)

$(TESTS): $(LIBPQ)

test-connect: test-connect.o $(LIBPQ)
	$(CC) $(LDFLAGS) -o test-connect test-connect.o $(LIBPQ) $(LIBS)

test-2: test-2.o $(LIBPQ)
	$(CC) $(LDFLAGS) -o test-2 test-2.o $(LIBPQ) $(LIBS)

test-3: test-3.o $(LIBPQ)
	$(CC) $(LDFLAGS) -o test-3 test-3.o $(LIBPQ) $(LIBS)

test-4: test-4.o $(LIBPQ)
	$(CC) $(LDFLAGS) -o test-4 test-4.o $(LIBPQ) $(LIBS)

test-5: test-5.o $(LIBPQ)
	$(CC) $(LDFLAGS) -o test-5 test-5.o $(LIBPQ) $(LIBS)

clean:
	-/bin/rm -f $(TESTS) *.o core a.out *~ \#*\#

%.E: %.c
	$(CC) $(CFLAGS) -E $<
