aboutsummaryrefslogtreecommitdiff
path: root/src/tutorial
diff options
context:
space:
mode:
Diffstat (limited to 'src/tutorial')
-rw-r--r--src/tutorial/C-code/Makefile10
-rw-r--r--src/tutorial/Makefile54
2 files changed, 45 insertions, 19 deletions
diff --git a/src/tutorial/C-code/Makefile b/src/tutorial/C-code/Makefile
new file mode 100644
index 00000000000..22ba97158ad
--- /dev/null
+++ b/src/tutorial/C-code/Makefile
@@ -0,0 +1,10 @@
+SRCDIR= ../..
+LIBPQDIR= $(SRCDIR)/libpq
+include ../../Makefile.global
+
+CFLAGS+= -I../../include -I$(LIBPQDIR)
+
+all: complex$(SLSUFF) funcs$(SLSUFF)
+
+clean:
+ rm -f complex$(SLSUFF) funcs$(SLSUFF) \ No newline at end of file
diff --git a/src/tutorial/Makefile b/src/tutorial/Makefile
index 5a29b1468d8..b0b7861a765 100644
--- a/src/tutorial/Makefile
+++ b/src/tutorial/Makefile
@@ -1,39 +1,55 @@
#-------------------------------------------------------------------------
#
# Makefile--
-# Makefile for tutorial/C-code
-#
-# Copyright (c) 1994, Regents of the University of California
-#
+# Makefile for tutorial
#
# IDENTIFICATION
-# $Header: /cvsroot/pgsql/src/tutorial/Makefile,v 1.1.1.1 1996/07/09 06:22:33 scrappy Exp $
+# $Header: /cvsroot/pgsql/src/tutorial/Makefile,v 1.2 1996/11/12 11:43:20 bryanh Exp $
#
#-------------------------------------------------------------------------
-MKDIR= ../mk
-include $(MKDIR)/postgres.mk
+SRCDIR= ..
+LIBPQDIR= $(SRCDIR)/libpq
+include ../Makefile.global
-VPATH:= $(VPATH):C-code
+CFLAGS+= -I$(LIBPQDIR) -I../../include
+LDADD+= -L$(LIBPQDIR) -lpq
+
#
-# build dynamically-loaded object files
+# DLOBJS is the dynamically-loaded object files. The "funcs" queries
+# include CREATE FUNCTIONs that load routines from these files.
#
-DLOBJS= complex$(SLSUFF) funcs$(SLSUFF)
+DLOBJS= complex$(SLSUFF) funcs$(SLSUFF)
+QUERIES= advanced.sql basics.sql complex.sql funcs.sql syscat.sql
#
-# ... plus test query inputs
+# plus exports files
#
-CREATEFILES= $(DLOBJS:%=$(objdir)/%) \
- advanced.sql basics.sql complex.sql funcs.sql syscat.sql
-
-include $(MKDIR)/postgres.user.mk
-
-CFLAGS+= -I$(srcdir)/backend
+ifdef EXPSUFF
+DLOBJS+= $(DLOBJS:.o=$(EXPSUFF))
+endif
-CLEANFILES+= $(notdir $(CREATEFILES))
+all: $(QUERIES)
-all:: $(CREATEFILES)
+%.sql: %.source
+ if [ -z "$$USER" ]; then USER=$$LOGNAME; fi; \
+ if [ -z "$$USER" ]; then USER=`whoami`; fi; \
+ if [ -z "$$USER" ]; then echo 'Cannot deduce $$USER.'; exit 1; fi; \
+ rm -f $@; \
+ C=`pwd`; \
+ sed -e "s:_CWD_:$$C:g" \
+ -e "s:_OBJWD_:$$C:g" \
+ -e "s:_SLSUFF_:$(SLSUFF):g" \
+ -e "s/_USER_/$$USER/g" < $< > $@
+funcs.sql:: $(DLOBJS)
+$(DLOBJS):
+ $(MAKE) -C C-code $@
+ cp C-code/$@ .
+clean:
+ $(MAKE) -C C-code clean
+ rm -f $(QUERIES)
+ rm -f $(DLOBJS)