]> granicus.if.org Git - postgresql/blob - src/pl/tcl/Makefile
ef61ee596e098890f32eae836c81f0a73e8365a0
[postgresql] / src / pl / tcl / Makefile
1 #-------------------------------------------------------------------------
2 #
3 # Makefile for the PL/Tcl procedural language
4 #
5 # src/pl/tcl/Makefile
6 #
7 #-------------------------------------------------------------------------
8
9 subdir = src/pl/tcl
10 top_builddir = ../../..
11 include $(top_builddir)/src/Makefile.global
12
13
14 override CPPFLAGS := -I. -I$(srcdir) $(TCL_INCLUDE_SPEC) $(CPPFLAGS)
15
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
19 endif
20
21 PGFILEDESC = "PL/Tcl - procedural language"
22
23 NAME = pltcl
24
25 OBJS = pltcl.o $(WIN32RES)
26
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
29
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
32
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)
37
38 tclwithver = $(subst -l,,$(filter -l%, $(TCL_LIB_SPEC)))
39 TCLDLL = $(dir $(TCLSH))/$(tclwithver).dll
40
41 OBJS += lib$(tclwithver).a
42
43 lib$(tclwithver).a: $(tclwithver).def
44         dlltool --dllname $(tclwithver).dll --def $(tclwithver).def --output-lib lib$(tclwithver).a
45
46 $(tclwithver).def: $(TCLDLL)
47         pexports $^ > $@
48
49 endif # win32
50
51
52 include $(top_srcdir)/src/Makefile.shlib
53
54
55 all: all-lib
56
57 # Force this dependency to be known even without dependency info built:
58 pltcl.o: pltclerrcodes.h
59
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 $< > $@
63
64 distprep: pltclerrcodes.h
65
66 install: all install-lib install-data
67
68 installdirs: installdirs-lib
69         $(MKDIR_P) '$(DESTDIR)$(datadir)/extension'
70
71 uninstall: uninstall-lib uninstall-data
72
73 install-data: installdirs
74         $(INSTALL_DATA) $(addprefix $(srcdir)/, $(DATA)) '$(DESTDIR)$(datadir)/extension/'
75
76 uninstall-data:
77         rm -f $(addprefix '$(DESTDIR)$(datadir)/extension'/, $(notdir $(DATA)))
78
79 .PHONY: install-data uninstall-data
80
81
82 check: submake
83         $(pg_regress_check) $(REGRESS_OPTS) $(REGRESS)
84
85 installcheck: submake
86         $(pg_regress_installcheck) $(REGRESS_OPTS) $(REGRESS)
87
88 .PHONY: submake
89 submake:
90         $(MAKE) -C $(top_builddir)/src/test/regress pg_regress$(X)
91
92 # pltclerrcodes.h is in the distribution tarball, so don't clean it here.
93 clean distclean: clean-lib
94         rm -f $(OBJS)
95         rm -rf $(pg_regress_clean_files)
96 ifeq ($(PORTNAME), win32)
97         rm -f $(tclwithver).def
98 endif
99
100 maintainer-clean: distclean
101         rm -f pltclerrcodes.h