]> granicus.if.org Git - postgresql/blob - src/Makefile.global.in
Fix installcheck case for tap tests
[postgresql] / src / Makefile.global.in
1 # -*-makefile-*-
2 # src/Makefile.global.in
3 # @configure_input@
4
5 #------------------------------------------------------------------------------
6 # All PostgreSQL makefiles include this file and use the variables it sets,
7 # which in turn are put here by the configure script. There is no need for
8 # users to edit this file -- if it turns out to be necessary then that's a
9 # bug.
10 #
11 # A makefile that includes this file needs to set the variable `subdir' to
12 # the relative path from the top to itself and `top_builddir' to the relative
13 # path from itself to the top before including this file. (The "top" is the
14 # parent directory of the directory this file is in.)
15 #------------------------------------------------------------------------------
16
17
18 ##########################################################################
19 #
20 # Meta configuration
21
22 standard_targets = all install installdirs uninstall distprep clean distclean maintainer-clean coverage check installcheck init-po update-po
23 # these targets should recurse even into subdirectories not being built:
24 standard_always_targets = distprep clean distclean maintainer-clean
25
26 .PHONY: $(standard_targets) install-strip html man installcheck-parallel maintainer-check
27
28 # make `all' the default target
29 all:
30
31 # Delete target files if the command fails after it has
32 # started to update the file.
33 .DELETE_ON_ERROR:
34
35 # Never delete any intermediate files automatically.
36 .SECONDARY:
37
38 # PostgreSQL version number
39 VERSION = @PACKAGE_VERSION@
40 MAJORVERSION = @PG_MAJORVERSION@
41
42 # Support for VPATH builds
43 # (PGXS VPATH support is handled separately in pgxs.mk)
44 ifndef PGXS
45 vpath_build = @vpath_build@
46 abs_top_srcdir = @abs_top_srcdir@
47
48 ifneq ($(vpath_build),yes)
49 top_srcdir = $(top_builddir)
50 srcdir = .
51 else # vpath_build = yes
52 top_srcdir = $(abs_top_srcdir)
53 srcdir = $(top_srcdir)/$(subdir)
54 VPATH = $(srcdir)
55 endif
56 endif # not PGXS
57
58 vpathsearch = `for f in $(addsuffix /$(1),$(subst :, ,. $(VPATH))); do test -r $$f && echo $$f && break; done`
59
60 # Saved arguments from configure
61 configure_args = @configure_args@
62
63
64 ##########################################################################
65 #
66 # Installation directories
67 #
68 # These are set by the equivalent --xxxdir configure options.  We
69 # append "postgresql" to some of them, if the string does not already
70 # contain "pgsql" or "postgres", in order to avoid directory clutter.
71 #
72 # In a PGXS build, we cannot use the values inserted into Makefile.global
73 # by configure, since the installation tree may have been relocated.
74 # Instead get the path values from pg_config.
75
76 ifndef PGXS
77
78 # Note that prefix, exec_prefix, and datarootdir aren't defined in a PGXS build;
79 # makefiles may only use the derived variables such as bindir.
80
81 prefix := @prefix@
82 exec_prefix := @exec_prefix@
83 datarootdir := @datarootdir@
84
85 bindir := @bindir@
86
87 datadir := @datadir@
88 ifeq "$(findstring pgsql, $(datadir))" ""
89 ifeq "$(findstring postgres, $(datadir))" ""
90 override datadir := $(datadir)/postgresql
91 endif
92 endif
93
94 sysconfdir := @sysconfdir@
95 ifeq "$(findstring pgsql, $(sysconfdir))" ""
96 ifeq "$(findstring postgres, $(sysconfdir))" ""
97 override sysconfdir := $(sysconfdir)/postgresql
98 endif
99 endif
100
101 libdir := @libdir@
102
103 pkglibdir = $(libdir)
104 ifeq "$(findstring pgsql, $(pkglibdir))" ""
105 ifeq "$(findstring postgres, $(pkglibdir))" ""
106 override pkglibdir := $(pkglibdir)/postgresql
107 endif
108 endif
109
110 includedir := @includedir@
111
112 pkgincludedir = $(includedir)
113 ifeq "$(findstring pgsql, $(pkgincludedir))" ""
114 ifeq "$(findstring postgres, $(pkgincludedir))" ""
115 override pkgincludedir := $(pkgincludedir)/postgresql
116 endif
117 endif
118
119 mandir := @mandir@
120
121 docdir := @docdir@
122 ifeq "$(findstring pgsql, $(docdir))" ""
123 ifeq "$(findstring postgres, $(docdir))" ""
124 override docdir := $(docdir)/postgresql
125 endif
126 endif
127
128 htmldir := @htmldir@
129
130 localedir := @localedir@
131
132 else # PGXS case
133
134 # Extension makefiles should set PG_CONFIG, but older ones might not
135 ifndef PG_CONFIG
136 PG_CONFIG = pg_config
137 endif
138
139 bindir := $(shell $(PG_CONFIG) --bindir)
140 datadir := $(shell $(PG_CONFIG) --sharedir)
141 sysconfdir := $(shell $(PG_CONFIG) --sysconfdir)
142 libdir := $(shell $(PG_CONFIG) --libdir)
143 pkglibdir := $(shell $(PG_CONFIG) --pkglibdir)
144 includedir := $(shell $(PG_CONFIG) --includedir)
145 pkgincludedir := $(shell $(PG_CONFIG) --pkgincludedir)
146 mandir := $(shell $(PG_CONFIG) --mandir)
147 docdir := $(shell $(PG_CONFIG) --docdir)
148 localedir := $(shell $(PG_CONFIG) --localedir)
149
150 endif # PGXS
151
152 # These derived path variables aren't separately configurable.
153
154 includedir_server = $(pkgincludedir)/server
155 includedir_internal = $(pkgincludedir)/internal
156 pgxsdir = $(pkglibdir)/pgxs
157
158
159 ##########################################################################
160 #
161 # Features
162 #
163 # Records the choice of the various --enable-xxx and --with-xxx options.
164
165 with_perl       = @with_perl@
166 with_python     = @with_python@
167 with_tcl        = @with_tcl@
168 with_openssl    = @with_openssl@
169 with_selinux    = @with_selinux@
170 with_libxml     = @with_libxml@
171 with_libxslt    = @with_libxslt@
172 with_system_tzdata = @with_system_tzdata@
173 with_uuid       = @with_uuid@
174 with_zlib       = @with_zlib@
175 enable_rpath    = @enable_rpath@
176 enable_nls      = @enable_nls@
177 enable_debug    = @enable_debug@
178 enable_dtrace   = @enable_dtrace@
179 enable_coverage = @enable_coverage@
180 enable_tap_tests        = @enable_tap_tests@
181 enable_thread_safety    = @enable_thread_safety@
182
183 python_enable_shared    = @python_enable_shared@
184 python_includespec      = @python_includespec@
185 python_libdir           = @python_libdir@
186 python_libspec          = @python_libspec@
187 python_additional_libs  = @python_additional_libs@
188 python_majorversion     = @python_majorversion@
189 python_version          = @python_version@
190
191 krb_srvtab = @krb_srvtab@
192
193 TCLSH                   = @TCLSH@
194 TCL_LIB_FILE            = @TCL_LIB_FILE@
195 TCL_LIBS                = @TCL_LIBS@
196 TCL_LIB_SPEC            = @TCL_LIB_SPEC@
197 TCL_INCLUDE_SPEC        = @TCL_INCLUDE_SPEC@
198 TCL_SHARED_BUILD        = @TCL_SHARED_BUILD@
199 TCL_SHLIB_LD_LIBS       = @TCL_SHLIB_LD_LIBS@
200
201 PTHREAD_CFLAGS          = @PTHREAD_CFLAGS@
202 PTHREAD_LIBS            = @PTHREAD_LIBS@
203
204
205 ##########################################################################
206 #
207 # Programs and flags
208
209 # Compilers
210
211 CPP = @CPP@
212 CPPFLAGS = @CPPFLAGS@
213
214 ifdef PGXS
215 override CPPFLAGS := -I$(includedir_server) -I$(includedir_internal) $(CPPFLAGS)
216 else # not PGXS
217 override CPPFLAGS := -I$(top_srcdir)/src/include $(CPPFLAGS)
218 ifdef VPATH
219 override CPPFLAGS := -I$(top_builddir)/src/include $(CPPFLAGS)
220 endif
221 endif # not PGXS
222
223 CC = @CC@
224 GCC = @GCC@
225 SUN_STUDIO_CC = @SUN_STUDIO_CC@
226 CFLAGS = @CFLAGS@
227 CFLAGS_VECTOR = @CFLAGS_VECTOR@
228
229 # Kind-of compilers
230
231 BISON = @BISON@
232 BISONFLAGS = @BISONFLAGS@ $(YFLAGS)
233 FLEX = @FLEX@
234 FLEXFLAGS = @FLEXFLAGS@ $(LFLAGS)
235 DTRACE = @DTRACE@
236 DTRACEFLAGS = @DTRACEFLAGS@
237 ZIC = @ZIC@
238
239 # Linking
240
241 AR = @AR@
242 DLLTOOL = @DLLTOOL@
243 DLLWRAP = @DLLWRAP@
244 LIBS = @LIBS@
245 LDAP_LIBS_FE = @LDAP_LIBS_FE@
246 LDAP_LIBS_BE = @LDAP_LIBS_BE@
247 UUID_LIBS = @UUID_LIBS@
248 UUID_EXTRA_OBJS = @UUID_EXTRA_OBJS@
249 LD = @LD@
250 with_gnu_ld = @with_gnu_ld@
251 ld_R_works = @ld_R_works@
252
253 # We want -L for libpgport.a and libpgcommon.a to be first in LDFLAGS.  We
254 # also need LDFLAGS to be a "recursively expanded" variable, else adjustments
255 # to rpathdir don't work right.  So we must NOT do LDFLAGS := something,
256 # meaning this has to be done first and elsewhere we must only do LDFLAGS +=
257 # something.
258 ifdef PGXS
259   LDFLAGS = -L$(libdir)
260 else
261   LDFLAGS = -L$(top_builddir)/src/port -L$(top_builddir)/src/common
262 endif
263 LDFLAGS += @LDFLAGS@
264
265 LDFLAGS_EX = @LDFLAGS_EX@
266 # LDFLAGS_SL might have already been assigned by calling makefile
267 LDFLAGS_SL += @LDFLAGS_SL@
268 LDREL = -r
269 LDOUT = -o
270 RANLIB = @RANLIB@
271 WINDRES = @WINDRES@
272 X = @EXEEXT@
273
274 # Perl
275
276 ifneq (@PERL@,)
277     # quoted to protect pathname with spaces
278     PERL                = '@PERL@'
279 else
280     PERL                = $(missing) perl
281 endif
282 perl_archlibexp         = @perl_archlibexp@
283 perl_privlibexp         = @perl_privlibexp@
284 perl_useshrplib         = @perl_useshrplib@
285 perl_embed_ldflags      = @perl_embed_ldflags@
286
287 # Miscellaneous
288
289 AWK     = @AWK@
290 LN_S    = @LN_S@
291 MSGFMT  = @MSGFMT@
292 MSGFMT_FLAGS = @MSGFMT_FLAGS@
293 MSGMERGE = @MSGMERGE@
294 PYTHON  = @PYTHON@
295 TAR     = @TAR@
296 XGETTEXT = @XGETTEXT@
297
298 GZIP    = gzip
299 BZIP2   = bzip2
300
301 # Testing
302
303 PROVE = @PROVE@
304 PG_PROVE_FLAGS = -I $(top_srcdir)/src/test/perl/
305 PROVE_FLAGS = --verbose
306
307 # prepend to path if already set, else just set it
308 define add_to_path
309 $(1)="$(if $($(1)),$(2):$$$(1),$(2))"
310 endef
311
312 # platform-specific environment variable to set shared library path
313 define ld_library_path_var
314 $(if $(filter $(PORTNAME),darwin),DYLD_LIBRARY_PATH,$(if $(filter $(PORTNAME),aix),LIBPATH,LD_LIBRARY_PATH))
315 endef
316
317 ifeq ($(enable_tap_tests),yes)
318
319 define prove_installcheck
320 cd $(srcdir) && TESTDIR='$(CURDIR)' PATH="$(bindir):$$PATH" PGPORT='6$(DEF_PGPORT)' top_builddir='$(CURDIR)/$(top_builddir)' $(PROVE) $(PG_PROVE_FLAGS) $(PROVE_FLAGS) t/*.pl
321 endef
322
323 define prove_check
324 $(MKDIR_P) tmp_check/log
325 $(MAKE) -C $(top_builddir) DESTDIR='$(CURDIR)'/tmp_check/install install >'$(CURDIR)'/tmp_check/log/install.log 2>&1
326 cd $(srcdir) && TESTDIR='$(CURDIR)' PATH="$(CURDIR)/tmp_check/install$(bindir):$$PATH" $(call add_to_path,$(ld_library_path_var),$(CURDIR)/tmp_check/install$(libdir)) top_builddir='$(CURDIR)/$(top_builddir)' PGPORT='6$(DEF_PGPORT)' $(PROVE) $(PG_PROVE_FLAGS) $(PROVE_FLAGS) t/*.pl
327 endef
328
329 else
330 prove_installcheck = @echo "TAP tests not enabled"
331 prove_check = $(prove_installcheck)
332 endif
333
334 # Installation.
335
336 install_bin = @install_bin@
337 install_sh = $(SHELL) $(top_srcdir)/config/install-sh -c
338 INSTALL = $(if $(use_install_sh),$(install_sh),$(if $(install_bin),$(install_bin),$(install_sh)))
339
340 INSTALL_SCRIPT_MODE     = 755
341 INSTALL_DATA_MODE       = 644
342 INSTALL_PROGRAM = $(INSTALL_PROGRAM_ENV) $(INSTALL) $(INSTALL_STRIP_FLAG)
343 INSTALL_SCRIPT  = $(INSTALL) -m $(INSTALL_SCRIPT_MODE)
344 INSTALL_DATA    = $(INSTALL) -m $(INSTALL_DATA_MODE)
345 INSTALL_STLIB   = $(INSTALL_STLIB_ENV) $(INSTALL_DATA) $(INSTALL_STRIP_FLAG)
346 INSTALL_SHLIB   = $(INSTALL_SHLIB_ENV) $(INSTALL) $(INSTALL_SHLIB_OPTS) $(INSTALL_STRIP_FLAG)
347 # Override in Makefile.port if necessary
348 INSTALL_SHLIB_OPTS = -m 755
349
350 MKDIR_P = @MKDIR_P@
351
352 missing         = $(SHELL) $(top_srcdir)/config/missing
353
354 STRIP           = @STRIP@
355 STRIP_STATIC_LIB = @STRIP_STATIC_LIB@
356 STRIP_SHARED_LIB = @STRIP_SHARED_LIB@
357
358 # Documentation
359
360 have_docbook    = @have_docbook@
361 COLLATEINDEX    = @COLLATEINDEX@
362 DBTOEPUB        = @DBTOEPUB@
363 DOCBOOKSTYLE    = @DOCBOOKSTYLE@
364 JADE                    = @JADE@
365 NSGMLS                  = @NSGMLS@
366 OSX                             = @OSX@
367 XMLLINT                 = @XMLLINT@
368 XSLTPROC                = @XSLTPROC@
369
370 # Code coverage
371
372 GCOV = @GCOV@
373 LCOV = @LCOV@
374 GENHTML = @GENHTML@
375
376 ifeq ($(enable_coverage),yes)
377 # ccache loses .gcno files
378 export CCACHE_DISABLE = 1
379 endif
380
381 # Feature settings
382
383 DEF_PGPORT = @default_port@
384 WANTED_LANGUAGES = @WANTED_LANGUAGES@
385
386
387 ##########################################################################
388 #
389 # Additional platform-specific settings
390 #
391
392 # Name of the "template"
393 PORTNAME= @PORTNAME@
394
395 build_os = @build_os@
396
397 host_tuple = @host@
398 host_os = @host_os@
399 host_cpu = @host_cpu@
400
401 # Make HAVE_IPV6 available for initdb script creation
402 HAVE_IPV6= @HAVE_IPV6@
403
404 # The HP-UX port makefile, for one, needs access to this symbol
405 HAVE_POSIX_SIGNALS= @HAVE_POSIX_SIGNALS@
406
407 # This is mainly for use on FreeBSD, where we have both a.out and elf
408 # systems now.  May be applicable to other systems to?
409 ELF_SYSTEM= @ELF_SYS@
410
411 # Backend stack size limit has to be hard-wired on Windows (it's in bytes)
412 WIN32_STACK_RLIMIT=4194304
413
414 # Set if we have a working win32 crashdump header
415 have_win32_dbghelp = @have_win32_dbghelp@
416
417 # Pull in platform-specific magic
418 include $(top_builddir)/src/Makefile.port
419
420 # Set up rpath if enabled.  By default it will point to our libdir,
421 # but individual Makefiles can force other rpath paths if needed.
422 rpathdir = $(libdir)
423
424 ifeq ($(enable_rpath), yes)
425 LDFLAGS += $(rpath)
426 endif
427
428
429 ##########################################################################
430 #
431 # Some variables needed to find some client interfaces
432
433 ifdef PGXS
434 # some contribs assumes headers and libs are in the source tree...
435 libpq_srcdir = $(includedir)
436 libpq_builddir = $(libdir)
437 else
438 libpq_srcdir = $(top_srcdir)/src/interfaces/libpq
439 libpq_builddir = $(top_builddir)/src/interfaces/libpq
440 endif
441
442 # This macro is for use by libraries linking to libpq.  (Because libpgport
443 # isn't created with the same link flags as libpq, it can't be used.)
444 libpq = -L$(libpq_builddir) -lpq
445
446 # This macro is for use by client executables (not libraries) that use libpq.
447 # We force clients to pull symbols from the non-shared libraries libpgport
448 # and libpgcommon rather than pulling some libpgport symbols from libpq just
449 # because libpq uses those functions too.  This makes applications less
450 # dependent on changes in libpq's usage of pgport.  To do this we link to
451 # pgport before libpq.  This does cause duplicate -lpgport's to appear
452 # on client link lines.
453 ifdef PGXS
454 libpq_pgport = -L$(libdir) -lpgcommon -lpgport $(libpq)
455 else
456 libpq_pgport = -L$(top_builddir)/src/common -lpgcommon -L$(top_builddir)/src/port -lpgport $(libpq)
457 endif
458
459 # Cygwin seems to need ldap libraries to be mentioned here, too
460 ifeq ($(PORTNAME),cygwin)
461 libpq_pgport += $(LDAP_LIBS_FE)
462 endif
463
464
465 submake-libpq:
466         $(MAKE) -C $(libpq_builddir) all
467
468 submake-libpgport:
469         $(MAKE) -C $(top_builddir)/src/port all
470         $(MAKE) -C $(top_builddir)/src/common all
471
472 .PHONY: submake-libpq submake-libpgport
473
474
475 ##########################################################################
476 #
477 # Testing support
478
479 PL_TESTDB = pl_regression
480 CONTRIB_TESTDB = contrib_regression
481 ifneq ($(MODULE_big),)
482   CONTRIB_TESTDB_MODULE = contrib_regression_$(MODULE_big)
483 else
484   ifneq ($(MODULES),)
485     CONTRIB_TESTDB_MODULE = contrib_regression_$(MODULES)
486   else
487     CONTRIB_TESTDB_MODULE = contrib_regression
488   endif
489 endif
490
491 ifdef NO_LOCALE
492 NOLOCALE += --no-locale
493 endif
494
495 pg_regress_locale_flags = $(if $(ENCODING),--encoding=$(ENCODING)) $(NOLOCALE)
496
497 pg_regress_check = $(top_builddir)/src/test/regress/pg_regress --inputdir=$(srcdir) --temp-install=./tmp_check --top-builddir=$(top_builddir) $(pg_regress_locale_flags) $(EXTRA_REGRESS_OPTS)
498 pg_regress_installcheck = $(top_builddir)/src/test/regress/pg_regress --inputdir=$(srcdir) --psqldir='$(PSQLDIR)' $(pg_regress_locale_flags) $(EXTRA_REGRESS_OPTS)
499
500 pg_regress_clean_files = results/ regression.diffs regression.out tmp_check/ log/
501
502 pg_isolation_regress_check = $(top_builddir)/src/test/isolation/pg_isolation_regress --inputdir=$(srcdir) --temp-install=./tmp_check --top-builddir=$(top_builddir) $(pg_regress_locale_flags) $(EXTRA_REGRESS_OPTS)
503 pg_isolation_regress_installcheck = $(top_builddir)/src/test/isolation/pg_isolation_regress --inputdir=$(srcdir) --top-builddir=$(top_builddir) $(pg_regress_locale_flags) $(EXTRA_REGRESS_OPTS)
504
505 ##########################################################################
506 #
507 # Customization
508 #
509 # This includes your local customizations if Makefile.custom exists
510 # in the source directory.  This file doesn't exist in the original
511 # distribution so that it doesn't get overwritten when you upgrade.
512 #
513 # NOTE:  Makefile.custom is from the pre-Autoconf days of PostgreSQL.
514 # You are liable to shoot yourself in the foot if you use it without
515 # knowing exactly what you're doing.  The preferred (and more
516 # reliable) method is to communicate what you want to do to the
517 # configure script, and leave the makefiles alone.
518
519 -include $(top_srcdir)/src/Makefile.custom
520
521 ifneq ($(CUSTOM_INSTALL),)
522 INSTALL= $(CUSTOM_INSTALL)
523 endif
524
525 ifneq ($(CUSTOM_CC),)
526   CC= $(CUSTOM_CC)
527 endif
528
529 ifneq ($(CUSTOM_COPT),)
530   COPT= $(CUSTOM_COPT)
531 endif
532
533 ifdef COPT
534    CFLAGS += $(COPT)
535    LDFLAGS += $(COPT)
536 endif
537
538 ifdef PROFILE
539    CFLAGS += $(PROFILE)
540    LDFLAGS += $(PROFILE)
541 endif
542
543
544 ##########################################################################
545 #
546 # substitute implementations of C library routines (see src/port/)
547 # note we already included -L.../src/port in LDFLAGS above
548
549 LIBOBJS = @LIBOBJS@
550
551 LIBS := -lpgcommon -lpgport $(LIBS)
552
553 # to make ws2_32.lib the last library
554 ifeq ($(PORTNAME),win32)
555 LIBS += -lws2_32
556 endif
557
558 # Not really standard libc functions, used by the backend.
559 TAS         = @TAS@
560
561
562 ##########################################################################
563 #
564 # Global targets and rules
565
566 %.c: %.l
567 ifdef FLEX
568         $(FLEX) $(if $(FLEX_NO_BACKUP),-b) $(FLEXFLAGS) -o'$@' $<
569         @$(if $(FLEX_NO_BACKUP),if [ `wc -l <lex.backup` -eq 1 ]; then rm lex.backup; else echo "Scanner requires backup; see lex.backup." 1>&2; exit 1; fi)
570 else
571         @$(missing) flex $< '$@'
572 endif
573
574 %.c: %.y
575         $(if $(BISON_CHECK_CMD),$(BISON_CHECK_CMD))
576 ifdef BISON
577         $(BISON) $(BISONFLAGS) -o $@ $<
578 else
579         @$(missing) bison $< $@
580 endif
581
582 %.i: %.c
583         $(CPP) $(CPPFLAGS) -o $@ $<
584
585 %.gz: %
586         $(GZIP) --best -c $< >$@
587
588 %.bz2: %
589         $(BZIP2) -c $< >$@
590
591 # Direct builds of foo.c -> foo are disabled to avoid generating
592 # *.dSYM junk on Macs.  All builds should normally go through the
593 # foo.c -> foo.o -> foo steps.  This also ensures that dependency
594 # tracking (see below) is used.
595 %: %.c
596
597 ifndef PGXS
598
599 # Remake Makefile.global from Makefile.global.in if the latter
600 # changed. In order to trigger this rule, the including file must
601 # write `include $(top_builddir)/src/Makefile.global', not some
602 # shortcut thereof.
603 $(top_builddir)/src/Makefile.global: $(top_srcdir)/src/Makefile.global.in $(top_builddir)/config.status
604         cd $(top_builddir) && ./config.status src/Makefile.global
605
606 # Remake pg_config.h from pg_config.h.in if the latter changed.
607 # config.status will not change the timestamp on pg_config.h if it
608 # doesn't change, so as to avoid recompiling the entire tree
609 # unnecessarily. Therefore we make config.status update a timestamp file
610 # stamp-h every time it runs, so that we don't trigger this rule every time.
611 # (We do trigger the null rule for stamp-h to pg_config.h every time; so it's
612 # important for that rule to be empty!)
613 #
614 # Of course you need to turn on dependency tracking to get any
615 # dependencies on pg_config.h.
616 $(top_builddir)/src/include/pg_config.h: $(top_builddir)/src/include/stamp-h ;
617
618 $(top_builddir)/src/include/stamp-h: $(top_srcdir)/src/include/pg_config.h.in $(top_builddir)/config.status
619         cd $(top_builddir) && ./config.status src/include/pg_config.h
620
621 # Also remake pg_config_ext.h from pg_config_ext.h.in, same logic as above.
622 $(top_builddir)/src/include/pg_config_ext.h: $(top_builddir)/src/include/stamp-ext-h ;
623
624 $(top_builddir)/src/include/stamp-ext-h: $(top_srcdir)/src/include/pg_config_ext.h.in $(top_builddir)/config.status
625         cd $(top_builddir) && ./config.status src/include/pg_config_ext.h
626
627 # Also remake ecpg_config.h from ecpg_config.h.in if the latter changed, same
628 # logic as above.
629 $(top_builddir)/src/interfaces/ecpg/include/ecpg_config.h: $(top_builddir)/src/interfaces/ecpg/include/stamp-h ;
630
631  $(top_builddir)/src/interfaces/ecpg/include/stamp-h: $(top_builddir)/src/interfaces/ecpg/include/ecpg_config.h.in $(top_builddir)/config.status
632         cd $(top_builddir) && ./config.status src/interfaces/ecpg/include/ecpg_config.h
633
634 # When configure changes, rerun configure with the same options as
635 # last time. To change configure, you need to run autoconf manually.
636 $(top_builddir)/config.status: $(top_srcdir)/configure
637         cd $(top_builddir) && ./config.status --recheck
638
639 endif # not PGXS
640
641
642 install-strip:
643 # install-strip always uses install-sh, so that strip options can be
644 # passed.
645         $(MAKE) use_install_sh=yes \
646             INSTALL_PROGRAM_ENV="STRIPPROG='$(STRIP)'" \
647             INSTALL_STLIB_ENV="STRIPPROG='$(STRIP_STATIC_LIB)'" \
648             INSTALL_SHLIB_ENV="STRIPPROG='$(STRIP_SHARED_LIB)'" \
649             INSTALL_STRIP_FLAG=-s \
650             install
651
652
653 ##########################################################################
654 #
655 # Recursive make support
656 # ----------------------
657 # Instead of recursing through subdirectories with a for loop or
658 # repeated $(MAKE) -C whatever calls, this is a little smarter: it
659 # allows parallel make across directories and lets make -k and -q work
660 # correctly.
661
662 # We need the $(eval) function and order-only prerequisites, which are
663 # available in GNU make 3.80.  That also happens to be the version
664 # where the .VARIABLES variable was introduced, so this is a simple check.
665 ifndef .VARIABLES
666 $(error GNU make 3.80 or newer is required.  You are using version $(MAKE_VERSION))
667 endif
668
669 # This function is only for internal use below.  It should be called
670 # using $(eval).  It will set up a target so that it recurses into
671 # a given subdirectory.  Note that to avoid a nasty bug in make 3.80,
672 # this function has to avoid using any complicated constructs (like
673 # multiple targets on a line) and also not contain any lines that expand
674 # to more than about 200 bytes.  This is why we make it apply to just one
675 # subdirectory at a time, rather than to a list of subdirectories.
676 # $1: target name, e.g., all
677 # $2: subdir name
678 # $3: target to run in subdir, usually same as $1
679 define _create_recursive_target
680 .PHONY: $(1)-$(2)-recurse
681 $(1): $(1)-$(2)-recurse
682 $(1)-$(2)-recurse:
683         $$(MAKE) -C $(2) $(3)
684 endef
685 # Note that the use of $$ on the last line above is important; we want
686 # $(MAKE) to be evaluated when the rule is run, not when the $(eval) is run
687 # to create the rule.  This is necessary to get make -q working.
688
689 # Call this function in a makefile that needs to recurse into subdirectories.
690 # In the normal case all arguments can be defaulted.
691 # $1: targets to make recursive (defaults to list of standard targets)
692 # $2: list of subdirs (defaults to SUBDIRS variable)
693 # $3: target to run in subdir (defaults to current element of $1)
694 recurse = $(foreach target,$(if $1,$1,$(standard_targets)),$(foreach subdir,$(if $2,$2,$(SUBDIRS)),$(eval $(call _create_recursive_target,$(target),$(subdir),$(if $3,$3,$(target))))))
695
696 # If a makefile's list of SUBDIRS varies depending on configuration, then
697 # any subdirectories excluded from SUBDIRS should instead be added to
698 # ALWAYS_SUBDIRS, and then it must call recurse_always as well as recurse.
699 # This ensures that distprep, distclean, etc will apply to all subdirectories.
700 # In the normal case all arguments will be defaulted.
701 # $1: targets to make recursive (defaults to standard_always_targets)
702 # $2: list of subdirs (defaults to ALWAYS_SUBDIRS variable)
703 # $3: target to run in subdir (defaults to current element of $1)
704 recurse_always = $(foreach target,$(if $1,$1,$(standard_always_targets)),$(foreach subdir,$(if $2,$2,$(ALWAYS_SUBDIRS)),$(eval $(call _create_recursive_target,$(target),$(subdir),$(if $3,$3,$(target))))))
705
706
707 ##########################################################################
708 #
709 # Automatic dependency generation
710 # -------------------------------
711 # When we configure with --enable-depend then we override the default
712 # compilation rule with the magic below. While or after creating the
713 # actual output file we also create a dependency list for the .c file.
714 # Next time we invoke make we will have top-notch information about
715 # whether this file needs to be updated. The dependency files are kept
716 # in the .deps subdirectory of each directory.
717
718 autodepend = @autodepend@
719
720 ifeq ($(autodepend), yes)
721
722 ifndef COMPILE.c
723 COMPILE.c = $(CC) $(CFLAGS) $(CPPFLAGS) -c
724 endif
725
726 DEPDIR = .deps
727
728 ifeq ($(GCC), yes)
729
730 # GCC allows us to create object and dependency file in one invocation.
731 %.o : %.c
732         @if test ! -d $(DEPDIR); then mkdir -p $(DEPDIR); fi
733         $(COMPILE.c) -o $@ $< -MMD -MP -MF $(DEPDIR)/$(*F).Po
734
735 endif # GCC
736
737 # Include all the dependency files generated for the current
738 # directory. Note that make would complain if include was called with
739 # no arguments.
740 Po_files := $(wildcard $(DEPDIR)/*.Po)
741 ifneq (,$(Po_files))
742 include $(Po_files)
743 endif
744
745 # hook for clean-up
746 clean distclean maintainer-clean: clean-deps
747
748 .PHONY: clean-deps
749 clean-deps:
750         @rm -rf $(DEPDIR)
751
752 endif # autodepend
753
754
755 ##########################################################################
756 #
757 # Native language support
758
759 ifeq ($(enable_nls), yes)
760 ifneq (,$(wildcard $(srcdir)/nls.mk))
761
762 include $(top_srcdir)/src/nls-global.mk
763
764 endif # nls.mk
765 endif # enable_nls
766
767
768 ##########################################################################
769 #
770 # Coverage
771
772 # Explanation of involved files:
773 #   foo.c       source file
774 #   foo.o       object file
775 #   foo.gcno    gcov graph (a.k.a. "notes") file, created at compile time
776 #               (by gcc -ftest-coverage)
777 #   foo.gcda    gcov data file, created when the program is run (for
778 #               programs compiled with gcc -fprofile-arcs)
779 #   foo.c.gcov  gcov output file with coverage information, created by
780 #               gcov from foo.gcda (by "make coverage")
781 #   foo.c.gcov.out  stdout captured when foo.c.gcov is created, mildly
782 #               interesting
783 #   lcov.info   lcov tracefile, built from gcda files in one directory,
784 #               later collected by "make coverage-html"
785
786 ifeq ($(enable_coverage), yes)
787
788 # There is a strange interaction between lcov and existing .gcov
789 # output files.  Hence the rm command and the ordering dependency.
790
791 gcda_files := $(wildcard *.gcda)
792
793 lcov.info: $(gcda_files)
794         rm -f *.gcov
795         $(if $^,$(LCOV) -d . -c -o $@ $(LCOVFLAGS) --gcov-tool $(GCOV))
796
797 %.c.gcov: %.gcda | lcov.info
798         $(GCOV) -b -f -p -o . $(GCOVFLAGS) $*.c >$*.c.gcov.out
799
800 coverage: $(gcda_files:.gcda=.c.gcov) lcov.info
801
802 .PHONY: coverage-html
803 coverage-html: coverage
804         rm -rf coverage
805         mkdir coverage
806         $(GENHTML) --show-details --legend --output-directory=coverage --title=PostgreSQL --num-spaces=4 --prefix=$(abs_top_srcdir) `find . -name lcov.info -print`
807
808
809 # hook for clean-up
810 clean distclean maintainer-clean: clean-coverage
811
812 .PHONY: clean-coverage
813 clean-coverage:
814         rm -rf coverage
815         rm -f *.gcda *.gcno lcov.info *.gcov *.gcov.out
816
817
818 # User-callable target to reset counts between test runs
819 coverage-clean:
820         rm -f `find . -name '*.gcda' -print`
821
822 endif # enable_coverage