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