1 #-------------------------------------------------------------------------
3 # Makefile for the PL/Tcl procedural language
7 #-------------------------------------------------------------------------
10 top_builddir = ../../..
11 include $(top_builddir)/src/Makefile.global
14 override CPPFLAGS := -I. -I$(srcdir) $(TCL_INCLUDE_SPEC) $(CPPFLAGS)
16 # On Windows, we don't link directly with the Tcl library; see below
17 ifneq ($(PORTNAME), win32)
18 SHLIB_LINK = $(TCL_LIB_SPEC) $(TCL_LIBS) -lc
21 PGFILEDESC = "PL/Tcl - procedural language"
25 OBJS = pltcl.o $(WIN32RES)
27 DATA = pltcl.control pltcl--1.0.sql pltcl--unpackaged--1.0.sql \
28 pltclu.control pltclu--1.0.sql pltclu--unpackaged--1.0.sql
30 REGRESS_OPTS = --dbname=$(PL_TESTDB) --load-extension=pltcl
31 REGRESS = pltcl_setup pltcl_queries pltcl_call pltcl_start_proc pltcl_subxact pltcl_unicode pltcl_transaction
33 # Tcl on win32 ships with import libraries only for Microsoft Visual C++,
34 # which are not compatible with mingw gcc. Therefore we need to build a
35 # new import library to link with.
36 ifeq ($(PORTNAME), win32)
38 tclwithver = $(subst -l,,$(filter -l%, $(TCL_LIB_SPEC)))
39 TCLDLL = $(dir $(TCLSH))/$(tclwithver).dll
41 OBJS += lib$(tclwithver).a
43 lib$(tclwithver).a: $(tclwithver).def
44 dlltool --dllname $(tclwithver).dll --def $(tclwithver).def --output-lib lib$(tclwithver).a
46 $(tclwithver).def: $(TCLDLL)
52 include $(top_srcdir)/src/Makefile.shlib
57 # Force this dependency to be known even without dependency info built:
58 pltcl.o: pltclerrcodes.h
60 # generate pltclerrcodes.h from src/backend/utils/errcodes.txt
61 pltclerrcodes.h: $(top_srcdir)/src/backend/utils/errcodes.txt generate-pltclerrcodes.pl
62 $(PERL) $(srcdir)/generate-pltclerrcodes.pl $< > $@
64 distprep: pltclerrcodes.h
66 install: all install-lib install-data
68 installdirs: installdirs-lib
69 $(MKDIR_P) '$(DESTDIR)$(datadir)/extension'
71 uninstall: uninstall-lib uninstall-data
73 install-data: installdirs
74 $(INSTALL_DATA) $(addprefix $(srcdir)/, $(DATA)) '$(DESTDIR)$(datadir)/extension/'
77 rm -f $(addprefix '$(DESTDIR)$(datadir)/extension'/, $(notdir $(DATA)))
79 .PHONY: install-data uninstall-data
83 $(pg_regress_check) $(REGRESS_OPTS) $(REGRESS)
86 $(pg_regress_installcheck) $(REGRESS_OPTS) $(REGRESS)
90 $(MAKE) -C $(top_builddir)/src/test/regress pg_regress$(X)
92 # pltclerrcodes.h is in the distribution tarball, so don't clean it here.
93 clean distclean: clean-lib
95 rm -rf $(pg_regress_clean_files)
96 ifeq ($(PORTNAME), win32)
97 rm -f $(tclwithver).def
100 maintainer-clean: distclean
101 rm -f pltclerrcodes.h