]> granicus.if.org Git - postgresql/blob - src/test/regress/GNUmakefile
Copy refint.so and autoinc.so into the src/test/regress directory during
[postgresql] / src / test / regress / GNUmakefile
1 #-------------------------------------------------------------------------
2 #
3 # GNUmakefile--
4 #    Makefile for src/test/regress (the regression tests)
5 #
6 # Portions Copyright (c) 1996-2008, PostgreSQL Global Development Group
7 # Portions Copyright (c) 1994, Regents of the University of California
8 #
9 # $PostgreSQL: pgsql/src/test/regress/GNUmakefile,v 1.74 2008/05/30 00:04:32 tgl Exp $
10 #
11 #-------------------------------------------------------------------------
12
13 subdir = src/test/regress
14 top_builddir = ../../..
15 include $(top_builddir)/src/Makefile.global
16
17 # port number for temp-installation test postmaster
18 TEMP_PORT = 5$(DEF_PGPORT)
19
20 # file with extra config for temp build
21 TEMP_CONF =
22 ifdef TEMP_CONFIG
23 TEMP_CONF += --temp-config=$(TEMP_CONFIG)
24 endif
25
26 # where to find psql for testing an existing installation
27 PSQLDIR = $(bindir)
28
29 # default encoding
30 MULTIBYTE = SQL_ASCII
31
32 # maximum simultaneous connections for parallel tests
33 MAXCONNOPT =
34 ifdef MAX_CONNECTIONS
35 MAXCONNOPT += --max-connections=$(MAX_CONNECTIONS)
36 endif
37
38 # locale
39 NOLOCALE =
40 ifdef NO_LOCALE
41 NOLOCALE += --no-locale
42 endif
43
44 # stuff to pass into build of pg_regress
45 EXTRADEFS = '-DHOST_TUPLE="$(host_tuple)"' \
46         '-DMAKEPROG="$(MAKE)"' \
47         '-DSHELLPROG="$(SHELL)"' \
48         '-DDLSUFFIX="$(DLSUFFIX)"'
49
50 ##
51 ## Prepare for tests
52 ##
53
54 # Build regression test driver
55
56 all: submake-libpgport pg_regress$(X)
57
58 pg_regress$(X): pg_regress.o pg_regress_main.o
59         $(CC) $(CFLAGS) $^ $(LDFLAGS) $(LIBS) -o $@
60
61 # dependencies ensure that path changes propagate
62 pg_regress.o: pg_regress.c $(top_builddir)/src/port/pg_config_paths.h
63         $(CC) $(CFLAGS) $(CPPFLAGS) -I$(top_builddir)/src/port $(EXTRADEFS) -c -o $@ $<
64
65 $(top_builddir)/src/port/pg_config_paths.h: $(top_builddir)/src/Makefile.global
66         $(MAKE) -C $(top_builddir)/src/port pg_config_paths.h
67
68 install: pg_regress$(X)
69         $(INSTALL_PROGRAM) pg_regress$(X) '$(DESTDIR)$(pgxsdir)/$(subdir)/pg_regress$(X)'
70
71 uninstall:
72         rm -f '$(DESTDIR)$(pgxsdir)/$(subdir)/pg_regress$(X)'
73
74
75 # Build dynamically-loaded object file for CREATE FUNCTION ... LANGUAGE C.
76
77 NAME = regress
78 OBJS = regress.o
79
80 include $(top_srcdir)/src/Makefile.shlib
81
82 all: all-lib
83
84 # Test input and expected files.  These are created by pg_regress itself, so we
85 # don't have a rule to create them.  We do need rules to clean them however.
86 ifile_list := $(subst .source,, $(notdir $(wildcard $(top_srcdir)/$(subdir)/input/*.source)))
87 input_files  := $(foreach file, $(ifile_list), sql/$(file).sql)
88 ofile_list := $(subst .source,, $(notdir $(wildcard $(top_srcdir)/$(subdir)/output/*.source)))
89 output_files := $(foreach file, $(ofile_list), expected/$(file).out)
90
91 ifneq ($(PORTNAME),win32)
92 abs_srcdir := $(shell cd $(srcdir) && pwd)
93 abs_builddir := $(shell pwd)
94 else
95 abs_srcdir := $(shell cd $(srcdir) && pwd -W)
96 abs_builddir := $(shell pwd -W)
97 endif
98
99 # When doing a VPATH build, copy over the remaining .sql and .out
100 # files so that the driver script can find them.  We have to use an
101 # absolute path for the targets, because otherwise make will try to
102 # locate the missing files using VPATH, and will find them in
103 # $(srcdir), but the point here is that we want to copy them from
104 # $(srcdir) to the build directory.
105
106 ifdef VPATH
107 remaining_files_src := $(wildcard $(srcdir)/sql/*.sql) $(wildcard $(srcdir)/expected/*.out) $(srcdir)/resultmap
108 remaining_files_build := $(patsubst $(srcdir)/%, $(abs_builddir)/%, $(remaining_files_src))
109
110 all: $(remaining_files_build)
111 $(remaining_files_build): $(abs_builddir)/%: $(srcdir)/%
112         ln -s $< $@
113 endif
114
115
116 # Get some extra C modules from contrib/spi...
117
118 all: refint$(DLSUFFIX) autoinc$(DLSUFFIX)
119
120 refint$(DLSUFFIX): $(top_builddir)/contrib/spi/refint$(DLSUFFIX)
121         cp $< $@
122
123 autoinc$(DLSUFFIX): $(top_builddir)/contrib/spi/autoinc$(DLSUFFIX)
124         cp $< $@
125
126 $(top_builddir)/contrib/spi/refint$(DLSUFFIX): $(top_srcdir)/contrib/spi/refint.c
127         $(MAKE) -C $(top_builddir)/contrib/spi refint$(DLSUFFIX)
128
129 $(top_builddir)/contrib/spi/autoinc$(DLSUFFIX): $(top_srcdir)/contrib/spi/autoinc.c
130         $(MAKE) -C $(top_builddir)/contrib/spi autoinc$(DLSUFFIX)
131
132
133 # Tablespace setup
134
135 all: tablespace-setup
136
137 .PHONY: tablespace-setup
138 tablespace-setup:
139         rm -rf ./testtablespace
140         mkdir ./testtablespace
141
142
143 ##
144 ## Run tests
145 ##
146
147 check: all
148         ./pg_regress --temp-install=./tmp_check --top-builddir=$(top_builddir) --srcdir=$(abs_srcdir) --temp-port=$(TEMP_PORT) --schedule=$(srcdir)/parallel_schedule --multibyte=$(MULTIBYTE) --load-language=plpgsql $(MAXCONNOPT) $(NOLOCALE) $(TEMP_CONF)
149
150 installcheck: all
151         ./pg_regress --psqldir=$(PSQLDIR) --schedule=$(srcdir)/serial_schedule --srcdir=$(abs_srcdir) --multibyte=$(MULTIBYTE) --load-language=plpgsql $(NOLOCALE)
152
153 installcheck-parallel: all
154         ./pg_regress --psqldir=$(PSQLDIR) --schedule=$(srcdir)/parallel_schedule --srcdir=$(abs_srcdir) --multibyte=$(MULTIBYTE) --load-language=plpgsql $(MAXCONNOPT) $(NOLOCALE)
155
156
157 # old interfaces follow...
158
159 runcheck: check
160 runtest: installcheck
161 runtest-parallel: installcheck-parallel
162
163 bigtest: all
164         ./pg_regress --psqldir=$(PSQLDIR) --schedule=$(srcdir)/serial_schedule --srcdir=$(abs_srcdir) --multibyte=$(MULTIBYTE) --load-language=plpgsql $(NOLOCALE) numeric_big 
165
166 bigcheck: all
167         ./pg_regress --temp-install=./tmp_check --top-builddir=$(top_builddir) --srcdir=$(abs_srcdir) --temp-port=$(TEMP_PORT) --schedule=$(srcdir)/parallel_schedule --multibyte=$(MULTIBYTE) --load-language=plpgsql $(MAXCONNOPT) $(NOLOCALE) numeric_big
168
169
170 ##
171 ## Clean up
172 ##
173
174 clean distclean maintainer-clean: clean-lib
175 # things built by `all' target
176         rm -f $(OBJS) refint$(DLSUFFIX) autoinc$(DLSUFFIX)
177         rm -f $(output_files) $(input_files) pg_regress_main.o pg_regress.o pg_regress$(X)
178 # things created by various check targets
179         rm -rf testtablespace
180         rm -rf results tmp_check log
181         rm -f regression.diffs regression.out regress.out run_check.out
182 ifeq ($(PORTNAME), cygwin)
183         rm -f regress.def
184 endif
185 ifdef VPATH
186         rm -f $(remaining_files_build)
187 endif