1 #-------------------------------------------------------------------------
4 # Makefile for the pltcl shared object
7 # $Header: /cvsroot/pgsql/src/pl/tcl/Makefile,v 1.12 2000/04/21 03:28:17 tgl Exp $
9 #-------------------------------------------------------------------------
12 # Tell make where the postgresql sources live
15 include $(SRCDIR)/Makefile.global
18 # Include definitions from the tclConfig.sh file
19 # NOTE: GNU make will make this file automatically if it doesn't exist,
20 # using the make rule that appears below. Cute, eh?
22 include Makefile.tcldefs
25 # Find out whether Tcl was built as a shared library --- if not,
26 # we can't link a shared library that depends on it, and have to
27 # forget about building pltcl.
28 # In Tcl 8, tclConfig.sh sets TCL_SHARED_BUILD for us, but in
29 # older Tcl releases it doesn't. In that case we guess based on
30 # the name of the Tcl library.
32 ifndef TCL_SHARED_BUILD
33 ifneq (,$(findstring $(DLSUFFIX),$(TCL_LIB_FILE)))
41 # Change following to how shared library that contains
42 # references to libtcl must get built on your system.
43 # Since these definitions come from the tclConfig.sh script,
44 # they should work if the shared build of tcl was successful
45 # on this system. However, tclConfig.sh lies to us a little bit
46 # (at least in versions 7.6 through 8.0.4) --- it doesn't mention -lc
47 # in TCL_LIBS, but you still need it on systems that want to hear about
48 # dependent libraries...
50 ifneq ($(TCL_SHLIB_LD_LIBS),)
51 # link command for a shared lib must mention shared libs it uses
52 SHLIB_EXTRA_LIBS=$(TCL_LIBS) -lc
54 # link command for a shared lib must NOT mention shared libs it uses
58 %$(TCL_SHLIB_SUFFIX): %.o
59 $(TCL_SHLIB_LD) -o $@ $< $(TCL_LIB_SPEC) $(SHLIB_EXTRA_LIBS)
64 # Since we are using Tcl's choice of C compiler, which might not be the
65 # same one selected for Postgres, do NOT use CFLAGS from Makefile.global.
66 # Instead use TCL's CFLAGS plus necessary -I directives.
68 # Can choose either TCL_CFLAGS_OPTIMIZE or TCL_CFLAGS_DEBUG here, as needed
69 CFLAGS= $(TCL_CFLAGS_OPTIMIZE)
71 CFLAGS+= $(TCL_SHLIB_CFLAGS) $(TCL_DEFS)
73 CFLAGS+= -I$(SRCDIR)/include -I$(SRCDIR)/backend
76 # Uncomment the following to enable the unknown command lookup
77 # on the first of all calls to the call handler. See the doc
78 # in the modules directory about details.
80 #CFLAGS+= -DPLTCL_UNKNOWN_SUPPORT
84 # DLOBJS is the dynamically-loaded object file.
86 DLOBJS= pltcl$(DLSUFFIX)
94 INFILES+= $(DLOBJS:.o=$(EXPSUFF))
98 ifeq ($(TCL_SHARED_BUILD),1)
101 # Build the shared lib
106 $(INSTALL) $(INSTL_SHLIB_OPTS) $(DLOBJS) $(LIBDIR)/$(DLOBJS)
111 # Oops, can't build it
114 @echo "Cannot build pltcl because Tcl is not a shared library; skipping it."
117 @echo "Cannot build pltcl because Tcl is not a shared library; skipping it."
122 # Make targets that are still valid when we can't build pltcl
123 # should be below here.
126 Makefile.tcldefs: mkMakefile.tcldefs.sh
127 /bin/sh mkMakefile.tcldefs.sh
134 rm -f Makefile.tcldefs