1 #-------------------------------------------------------------------------
3 # Makefile for the pltcl shared object
5 # $PostgreSQL: pgsql/src/pl/tcl/Makefile,v 1.49 2006/07/19 02:37:00 tgl Exp $
7 #-------------------------------------------------------------------------
10 top_builddir = ../../..
11 include $(top_builddir)/src/Makefile.global
14 override CPPFLAGS := $(TCL_INCLUDE_SPEC) $(CPPFLAGS)
17 # Find out whether Tcl was built as a shared library --- if not, we
18 # can't link a shared library that depends on it, and have to forget
19 # about building pltcl. In Tcl 8, tclConfig.sh sets TCL_SHARED_BUILD
20 # for us, but in older Tcl releases it doesn't. In that case we guess
21 # based on the name of the Tcl library.
23 ifndef TCL_SHARED_BUILD
24 ifneq (,$(findstring $(DLSUFFIX),$(TCL_LIB_FILE)))
32 ifneq ($(PORTNAME), win32)
33 SHLIB_LINK = $(BE_DLLLIBS) $(TCL_LIB_SPEC) $(TCL_LIBS) -lc
35 SHLIB_LINK = $(TCL_LIB_SPEC) $(BE_DLLLIBS)
43 REGRESS_OPTS = --dbname=$(PL_TESTDB) --load-language=pltcl
44 REGRESS = pltcl_setup pltcl_queries
46 include $(top_srcdir)/src/Makefile.shlib
48 ifeq ($(TCL_SHARED_BUILD), 1)
53 # When doing a VPATH build, copy over the .sql and .out files so that the
54 # test script can find them. See comments in src/test/regress/GNUmakefile.
57 ifneq ($(PORTNAME),win32)
58 abs_srcdir := $(shell cd $(srcdir) && pwd)
59 abs_builddir := $(shell pwd)
61 abs_srcdir := $(shell cd $(srcdir) && pwd -W)
62 abs_builddir := $(shell pwd -W)
65 test_files_src := $(wildcard $(srcdir)/sql/*.sql) $(wildcard $(srcdir)/expected/*.out)
66 test_files_build := $(patsubst $(srcdir)/%, $(abs_builddir)/%, $(test_files_src))
68 all: $(test_files_build)
69 $(test_files_build): $(abs_builddir)/%: $(srcdir)/%
74 install: all installdirs
75 ifeq ($(enable_shared), yes)
76 $(INSTALL_SHLIB) $(shlib) '$(DESTDIR)$(pkglibdir)/$(NAME)$(DLSUFFIX)'
79 echo "* PL/Tcl was not installed due to lack of shared library support."; \
85 $(mkinstalldirs) '$(DESTDIR)$(pkglibdir)'
89 rm -f '$(DESTDIR)$(pkglibdir)/$(NAME)$(DLSUFFIX)'
93 $(top_builddir)/src/test/regress/pg_regress $(REGRESS_OPTS) $(REGRESS)
97 $(MAKE) -C $(top_builddir)/src/test/regress pg_regress$(X)
99 else # TCL_SHARED_BUILD = 0
101 # Provide dummy targets for the case where we can't build the shared library.
104 echo "* Cannot build PL/Tcl because Tcl is not a shared library; skipping it."; \
107 endif # TCL_SHARED_BUILD = 0
109 clean distclean maintainer-clean: clean-lib
112 rm -f regression.diffs regression.out
113 $(MAKE) -C modules $@