#-------------------------------------------------------------------------
#
# Makefile--
#    Makefile for tutorial
#
# IDENTIFICATION
#    $Header: /cvsroot/pgsql/src/tutorial/Makefile,v 1.16 2002/09/05 18:28:46 petere Exp $
#
# Please note that this Makefile was modified for Debian to allow
# compilation in an arbitrary directory and without the complete
# PostgreSQL source tree.
#-------------------------------------------------------------------------

DLSUFFIX=.so
INCLUDES= -I/usr/include/postgresql/ -I/usr/include/postgresql/server/
CC= gcc $(INCLUDES)
 
#
# DLOBJS are the dynamically-loaded object files.  The "funcs" queries
# include CREATE FUNCTIONs that load routines from these files.
#
DLOBJS= complex$(DLSUFFIX) funcs$(DLSUFFIX)

QUERIES= advanced.sql basics.sql complex.sql funcs.sql syscat.sql

all: $(DLOBJS) $(QUERIES)

%$(DLSUFFIX): %.c
	$(CC) -shared -o $@ $<

%.sql: %.source
	rm -f $@; \
	C=`pwd`; \
	sed -e "s:_OBJWD_:$$C:g" < $< > $@

clean distclean maintainer-clean:
	rm -f $(DLOBJS) $(QUERIES)

.PHONY: clean distclean maintainer-clean
