]> granicus.if.org Git - postgresql/blob - src/pl/tcl/Makefile
pltcl didn't work well at all when Tcl had been built with a different
[postgresql] / src / pl / tcl / Makefile
1 #-------------------------------------------------------------------------
2 #
3 # Makefile
4 #    Makefile for the pltcl shared object
5 #
6 # IDENTIFICATION
7 #    $Header: /cvsroot/pgsql/src/pl/tcl/Makefile,v 1.12 2000/04/21 03:28:17 tgl Exp $
8 #
9 #-------------------------------------------------------------------------
10
11 #
12 # Tell make where the postgresql sources live
13 #
14 SRCDIR= ../../../src
15 include $(SRCDIR)/Makefile.global
16
17 #
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?
21 #
22 include Makefile.tcldefs
23
24 #
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.
31 #
32 ifndef TCL_SHARED_BUILD
33 ifneq (,$(findstring $(DLSUFFIX),$(TCL_LIB_FILE)))
34 TCL_SHARED_BUILD=1
35 else
36 TCL_SHARED_BUILD=0
37 endif
38 endif
39
40
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...
49
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
53 else
54 # link command for a shared lib must NOT mention shared libs it uses
55 SHLIB_EXTRA_LIBS=
56 endif
57
58 %$(TCL_SHLIB_SUFFIX):   %.o
59         $(TCL_SHLIB_LD) -o $@ $< $(TCL_LIB_SPEC) $(SHLIB_EXTRA_LIBS)
60
61
62 CC = $(TCL_CC)
63
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.
67
68 # Can choose either TCL_CFLAGS_OPTIMIZE or TCL_CFLAGS_DEBUG here, as needed
69 CFLAGS= $(TCL_CFLAGS_OPTIMIZE)
70
71 CFLAGS+= $(TCL_SHLIB_CFLAGS) $(TCL_DEFS)
72
73 CFLAGS+= -I$(SRCDIR)/include -I$(SRCDIR)/backend
74         
75 #
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.
79 #
80 #CFLAGS+= -DPLTCL_UNKNOWN_SUPPORT
81
82
83 #
84 # DLOBJS is the dynamically-loaded object file.
85 #
86 DLOBJS= pltcl$(DLSUFFIX)
87
88 INFILES= $(DLOBJS) 
89
90 #
91 # plus exports files
92 #
93 ifdef EXPSUFF
94 INFILES+= $(DLOBJS:.o=$(EXPSUFF))
95 endif
96
97
98 ifeq ($(TCL_SHARED_BUILD),1)
99
100 #
101 # Build the shared lib
102 #
103 all: $(INFILES)
104
105 install: all
106         $(INSTALL) $(INSTL_SHLIB_OPTS) $(DLOBJS) $(LIBDIR)/$(DLOBJS)
107
108 else
109
110 #
111 # Oops, can't build it
112 #
113 all:
114         @echo "Cannot build pltcl because Tcl is not a shared library; skipping it."
115
116 install:
117         @echo "Cannot build pltcl because Tcl is not a shared library; skipping it."
118
119 endif
120
121 #
122 # Make targets that are still valid when we can't build pltcl
123 # should be below here.
124 #
125
126 Makefile.tcldefs: mkMakefile.tcldefs.sh
127         /bin/sh mkMakefile.tcldefs.sh
128
129 #
130 # Clean 
131 #
132 clean:
133         rm -f $(INFILES) *.o
134         rm -f Makefile.tcldefs
135
136 dep depend: