]> granicus.if.org Git - postgresql/blob - src/pl/tcl/Makefile
Rewrite pg_regress as a C program instead of a shell script.
[postgresql] / src / pl / tcl / Makefile
1 #-------------------------------------------------------------------------
2 #
3 # Makefile for the pltcl shared object
4 #
5 # $PostgreSQL: pgsql/src/pl/tcl/Makefile,v 1.49 2006/07/19 02:37:00 tgl Exp $
6 #
7 #-------------------------------------------------------------------------
8
9 subdir = src/pl/tcl
10 top_builddir = ../../..
11 include $(top_builddir)/src/Makefile.global
12
13
14 override CPPFLAGS := $(TCL_INCLUDE_SPEC) $(CPPFLAGS)
15
16
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.
22
23 ifndef TCL_SHARED_BUILD
24 ifneq (,$(findstring $(DLSUFFIX),$(TCL_LIB_FILE)))
25 TCL_SHARED_BUILD=1
26 else
27 TCL_SHARED_BUILD=0
28 endif
29 endif
30
31
32 ifneq ($(PORTNAME), win32)
33 SHLIB_LINK = $(BE_DLLLIBS) $(TCL_LIB_SPEC) $(TCL_LIBS) -lc
34 else
35 SHLIB_LINK = $(TCL_LIB_SPEC) $(BE_DLLLIBS)
36 endif
37
38 NAME = pltcl
39 SO_MAJOR_VERSION = 2
40 SO_MINOR_VERSION = 0
41 OBJS = pltcl.o
42
43 REGRESS_OPTS = --dbname=$(PL_TESTDB) --load-language=pltcl
44 REGRESS = pltcl_setup pltcl_queries
45
46 include $(top_srcdir)/src/Makefile.shlib
47
48 ifeq ($(TCL_SHARED_BUILD), 1)
49
50 all: all-lib
51         $(MAKE) -C modules $@
52
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.
55 ifdef VPATH
56
57 ifneq ($(PORTNAME),win32)
58 abs_srcdir := $(shell cd $(srcdir) && pwd)
59 abs_builddir := $(shell pwd)
60 else
61 abs_srcdir := $(shell cd $(srcdir) && pwd -W)
62 abs_builddir := $(shell pwd -W)
63 endif
64
65 test_files_src := $(wildcard $(srcdir)/sql/*.sql) $(wildcard $(srcdir)/expected/*.out)
66 test_files_build := $(patsubst $(srcdir)/%, $(abs_builddir)/%, $(test_files_src))
67
68 all: $(test_files_build)
69 $(test_files_build): $(abs_builddir)/%: $(srcdir)/%
70         ln -s $< $@
71
72 endif
73
74 install: all installdirs
75 ifeq ($(enable_shared), yes)
76         $(INSTALL_SHLIB) $(shlib) '$(DESTDIR)$(pkglibdir)/$(NAME)$(DLSUFFIX)'
77 else
78         @echo "*****"; \
79          echo "* PL/Tcl was not installed due to lack of shared library support."; \
80          echo "*****"
81 endif
82         $(MAKE) -C modules $@
83
84 installdirs:
85         $(mkinstalldirs) '$(DESTDIR)$(pkglibdir)'
86         $(MAKE) -C modules $@
87
88 uninstall:
89         rm -f '$(DESTDIR)$(pkglibdir)/$(NAME)$(DLSUFFIX)'
90         $(MAKE) -C modules $@
91
92 installcheck: submake
93         $(top_builddir)/src/test/regress/pg_regress $(REGRESS_OPTS) $(REGRESS)
94
95 .PHONY: submake
96 submake:
97         $(MAKE) -C $(top_builddir)/src/test/regress pg_regress$(X)
98
99 else # TCL_SHARED_BUILD = 0
100
101 # Provide dummy targets for the case where we can't build the shared library.
102 all:
103         @echo "*****"; \
104          echo "* Cannot build PL/Tcl because Tcl is not a shared library; skipping it."; \
105          echo "*****"
106
107 endif # TCL_SHARED_BUILD = 0
108
109 clean distclean maintainer-clean: clean-lib
110         rm -f $(OBJS)
111         rm -rf results
112         rm -f regression.diffs regression.out
113         $(MAKE) -C modules $@