# Makefile for the pltcl shared object
#
# IDENTIFICATION
-# $Header: /cvsroot/pgsql/src/pl/tcl/Makefile,v 1.7 1998/10/13 16:30:49 momjian Exp $
+# $Header: /cvsroot/pgsql/src/pl/tcl/Makefile,v 1.8 1998/10/17 23:33:23 tgl Exp $
#
#-------------------------------------------------------------------------
SRCDIR= ../../../src
include $(SRCDIR)/Makefile.global
-
#
# Include definitions from the tclConfig.sh file
+# NOTE: GNU make will make this file automatically if it doesn't exist,
+# using the make rule that appears below. Cute, eh?
#
include Makefile.tcldefs
+#
+# Find out whether Tcl was built as a shared library --- if not,
+# we can't link a shared library that depends on it, and have to
+# forget about building pltcl.
+# In Tcl 8, tclConfig.sh sets TCL_SHARED_BUILD for us, but in
+# older Tcl releases it doesn't. In that case we guess based on
+# the name of the Tcl library.
+#
+ifndef TCL_SHARED_BUILD
+ifneq (,$(findstring $(DLSUFFIX),$(TCL_LIB_FILE)))
+TCL_SHARED_BUILD=1
+else
+TCL_SHARED_BUILD=0
+endif
+endif
+
+
# Change following to how shared library that contain
# correct references to libtcl must get built on your system.
# Since these definitions come from the tclConfig.sh script,
INFILES+= $(DLOBJS:.o=$(EXPSUFF))
endif
+
+ifeq ($(TCL_SHARED_BUILD),1)
+
#
# Build the shared lib
#
all: $(INFILES)
-Makefile.tcldefs:
+install: all
+ $(INSTALL) $(INSTL_LIB_OPTS) $(DLOBJS) $(LIBDIR)/$(DLOBJS)
+
+else
+
+#
+# Oops, can't build it
+#
+all:
+ @echo "Cannot build pltcl because Tcl is not a shared library; skipping it."
+
+install:
+ @echo "Cannot build pltcl because Tcl is not a shared library; skipping it."
+
+endif
+
+#
+# Make targets that are still valid when we can't build pltcl
+# should be below here.
+#
+
+Makefile.tcldefs: mkMakefile.tcldefs.sh
/bin/sh mkMakefile.tcldefs.sh
#
# Clean
#
clean:
- rm -f $(INFILES)
+ rm -f $(INFILES) *.o
rm -f Makefile.tcldefs
-install: all
- $(INSTALL) $(INSTL_LIB_OPTS) $(DLOBJS) $(LIBDIR)/$(DLOBJS)
-
dep depend: