Fix PL makefiles to support running regression tests in VPATH builds.
authorTom Lane <tgl@sss.pgh.pa.us>
Tue, 24 May 2005 17:07:41 +0000 (17:07 +0000)
committerTom Lane <tgl@sss.pgh.pa.us>
Tue, 24 May 2005 17:07:41 +0000 (17:07 +0000)
src/pl/plperl/GNUmakefile
src/pl/plpython/Makefile
src/pl/tcl/Makefile

index d64889dbd92440ec309c597821e7f28561cff30a..71a363fe8f38c589311fdf633874d83db402781c 100644 (file)
@@ -47,6 +47,27 @@ all: all-lib
 SPI.c: SPI.xs
        $(PERL) $(perl_privlibexp)/ExtUtils/xsubpp -typemap $(perl_privlibexp)/ExtUtils/typemap $< >$@
 
+# When doing a VPATH build, copy over the .sql and .out files so that the
+# test script can find them.  See comments in src/test/regress/GNUmakefile.
+ifdef VPATH
+
+ifneq ($(PORTNAME),win32)
+abs_srcdir := $(shell cd $(srcdir) && pwd)
+abs_builddir := $(shell pwd)
+else
+abs_srcdir := $(shell cd $(srcdir) && pwd -W)
+abs_builddir := $(shell pwd -W)
+endif
+
+test_files_src := $(wildcard $(srcdir)/sql/*.sql) $(wildcard $(srcdir)/expected/*.out)
+test_files_build := $(patsubst $(srcdir)/%, $(abs_builddir)/%, $(test_files_src))
+
+all: $(test_files_build)
+$(test_files_build): $(abs_builddir)/%: $(srcdir)/%
+       ln -s $< $@
+
+endif
+
 install: all installdirs
 ifeq ($(enable_shared), yes)
        $(INSTALL_SHLIB) $(shlib) $(DESTDIR)$(pkglibdir)/plperl$(DLSUFFIX)
index 48ed3c86bb2135e68eefebf838267e44fdb4c706..a2f283476b5f1d9a8c197a5af6bf91d31461ef47 100644 (file)
@@ -66,6 +66,27 @@ include $(top_srcdir)/src/Makefile.shlib
 
 all: all-lib
 
+# When doing a VPATH build, copy over the .sql and .out files so that the
+# test script can find them.  See comments in src/test/regress/GNUmakefile.
+ifdef VPATH
+
+ifneq ($(PORTNAME),win32)
+abs_srcdir := $(shell cd $(srcdir) && pwd)
+abs_builddir := $(shell pwd)
+else
+abs_srcdir := $(shell cd $(srcdir) && pwd -W)
+abs_builddir := $(shell pwd -W)
+endif
+
+test_files_src := $(wildcard $(srcdir)/sql/*.sql) $(wildcard $(srcdir)/expected/*.out)
+test_files_build := $(patsubst $(srcdir)/%, $(abs_builddir)/%, $(test_files_src))
+
+all: $(test_files_build)
+$(test_files_build): $(abs_builddir)/%: $(srcdir)/%
+       ln -s $< $@
+
+endif
+
 install: all installdirs
 ifeq ($(enable_shared), yes)
        $(INSTALL_SHLIB) $(shlib) $(DESTDIR)$(pkglibdir)/plpython$(DLSUFFIX)
index 4955a39bb5dce71a8b1a6570ae2083fc7484b62e..89fa1109f20518f111ea9e69ca0695a293be5f91 100644 (file)
@@ -50,6 +50,27 @@ ifeq ($(TCL_SHARED_BUILD), 1)
 all: all-lib
        $(MAKE) -C modules $@
 
+# When doing a VPATH build, copy over the .sql and .out files so that the
+# test script can find them.  See comments in src/test/regress/GNUmakefile.
+ifdef VPATH
+
+ifneq ($(PORTNAME),win32)
+abs_srcdir := $(shell cd $(srcdir) && pwd)
+abs_builddir := $(shell pwd)
+else
+abs_srcdir := $(shell cd $(srcdir) && pwd -W)
+abs_builddir := $(shell pwd -W)
+endif
+
+test_files_src := $(wildcard $(srcdir)/sql/*.sql) $(wildcard $(srcdir)/expected/*.out)
+test_files_build := $(patsubst $(srcdir)/%, $(abs_builddir)/%, $(test_files_src))
+
+all: $(test_files_build)
+$(test_files_build): $(abs_builddir)/%: $(srcdir)/%
+       ln -s $< $@
+
+endif
+
 install: all installdirs
 ifeq ($(enable_shared), yes)
        $(INSTALL_SHLIB) $(shlib) $(DESTDIR)$(pkglibdir)/$(NAME)$(DLSUFFIX)