2 # src/Makefile.global.in
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
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 #------------------------------------------------------------------------------
18 ##########################################################################
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
26 .PHONY: $(standard_targets) install-strip html man installcheck-parallel maintainer-check
28 # make `all' the default target
31 # Delete target files if the command fails after it has
32 # started to update the file.
35 # Never delete any intermediate files automatically.
38 # PostgreSQL version number
39 VERSION = @PACKAGE_VERSION@
40 MAJORVERSION = @PG_MAJORVERSION@
42 # Support for VPATH builds
43 vpath_build = @vpath_build@
44 abs_top_srcdir = @abs_top_srcdir@
46 ifneq ($(vpath_build),yes)
47 top_srcdir = $(top_builddir)
49 else # vpath_build = yes
50 top_srcdir = $(abs_top_srcdir)
51 srcdir = $(top_srcdir)/$(subdir)
55 vpathsearch = `for f in $(addsuffix /$(1),$(subst :, ,. $(VPATH))); do test -r $$f && echo $$f && break; done`
57 # Saved arguments from configure
58 configure_args = @configure_args@
61 ##########################################################################
63 # Installation directories
65 # These are set by the equivalent --xxxdir configure options. We
66 # append "postgresql" to some of them, if the string does not already
67 # contain "pgsql" or "postgres", in order to avoid directory clutter.
69 # In a PGXS build, we cannot use the values inserted into Makefile.global
70 # by configure, since the installation tree may have been relocated.
71 # Instead get the path values from pg_config.
75 # Note that prefix, exec_prefix, and datarootdir aren't defined in a PGXS build;
76 # makefiles may only use the derived variables such as bindir.
79 exec_prefix := @exec_prefix@
80 datarootdir := @datarootdir@
85 ifeq "$(findstring pgsql, $(datadir))" ""
86 ifeq "$(findstring postgres, $(datadir))" ""
87 override datadir := $(datadir)/postgresql
91 sysconfdir := @sysconfdir@
92 ifeq "$(findstring pgsql, $(sysconfdir))" ""
93 ifeq "$(findstring postgres, $(sysconfdir))" ""
94 override sysconfdir := $(sysconfdir)/postgresql
100 pkglibdir = $(libdir)
101 ifeq "$(findstring pgsql, $(pkglibdir))" ""
102 ifeq "$(findstring postgres, $(pkglibdir))" ""
103 override pkglibdir := $(pkglibdir)/postgresql
107 includedir := @includedir@
109 pkgincludedir = $(includedir)
110 ifeq "$(findstring pgsql, $(pkgincludedir))" ""
111 ifeq "$(findstring postgres, $(pkgincludedir))" ""
112 override pkgincludedir := $(pkgincludedir)/postgresql
119 ifeq "$(findstring pgsql, $(docdir))" ""
120 ifeq "$(findstring postgres, $(docdir))" ""
121 override docdir := $(docdir)/postgresql
127 localedir := @localedir@
131 # Extension makefiles should set PG_CONFIG, but older ones might not
133 PG_CONFIG = pg_config
136 bindir := $(shell $(PG_CONFIG) --bindir)
137 datadir := $(shell $(PG_CONFIG) --sharedir)
138 sysconfdir := $(shell $(PG_CONFIG) --sysconfdir)
139 libdir := $(shell $(PG_CONFIG) --libdir)
140 pkglibdir := $(shell $(PG_CONFIG) --pkglibdir)
141 includedir := $(shell $(PG_CONFIG) --includedir)
142 pkgincludedir := $(shell $(PG_CONFIG) --pkgincludedir)
143 mandir := $(shell $(PG_CONFIG) --mandir)
144 docdir := $(shell $(PG_CONFIG) --docdir)
145 localedir := $(shell $(PG_CONFIG) --localedir)
149 # These derived path variables aren't separately configurable.
151 includedir_server = $(pkgincludedir)/server
152 includedir_internal = $(pkgincludedir)/internal
153 pgxsdir = $(pkglibdir)/pgxs
156 ##########################################################################
160 # Records the choice of the various --enable-xxx and --with-xxx options.
162 with_perl = @with_perl@
163 with_python = @with_python@
164 with_tcl = @with_tcl@
165 with_openssl = @with_openssl@
166 with_selinux = @with_selinux@
167 with_libxml = @with_libxml@
168 with_libxslt = @with_libxslt@
169 with_system_tzdata = @with_system_tzdata@
170 with_uuid = @with_uuid@
171 with_zlib = @with_zlib@
172 enable_rpath = @enable_rpath@
173 enable_nls = @enable_nls@
174 enable_debug = @enable_debug@
175 enable_dtrace = @enable_dtrace@
176 enable_coverage = @enable_coverage@
177 enable_thread_safety = @enable_thread_safety@
179 python_enable_shared = @python_enable_shared@
180 python_includespec = @python_includespec@
181 python_libdir = @python_libdir@
182 python_libspec = @python_libspec@
183 python_additional_libs = @python_additional_libs@
184 python_majorversion = @python_majorversion@
185 python_version = @python_version@
187 krb_srvtab = @krb_srvtab@
190 TCL_LIB_FILE = @TCL_LIB_FILE@
191 TCL_LIBS = @TCL_LIBS@
192 TCL_LIB_SPEC = @TCL_LIB_SPEC@
193 TCL_INCLUDE_SPEC = @TCL_INCLUDE_SPEC@
194 TCL_SHARED_BUILD = @TCL_SHARED_BUILD@
195 TCL_SHLIB_LD_LIBS = @TCL_SHLIB_LD_LIBS@
197 PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
198 PTHREAD_LIBS = @PTHREAD_LIBS@
201 ##########################################################################
208 CPPFLAGS = @CPPFLAGS@
211 override CPPFLAGS := -I$(includedir_server) -I$(includedir_internal) $(CPPFLAGS)
213 override CPPFLAGS := -I$(top_srcdir)/src/include $(CPPFLAGS)
215 override CPPFLAGS := -I$(top_builddir)/src/include $(CPPFLAGS)
221 SUN_STUDIO_CC = @SUN_STUDIO_CC@
223 CFLAGS_VECTOR = @CFLAGS_VECTOR@
228 BISONFLAGS = @BISONFLAGS@ $(YFLAGS)
230 FLEXFLAGS = @FLEXFLAGS@ $(LFLAGS)
232 DTRACEFLAGS = @DTRACEFLAGS@
241 LDAP_LIBS_FE = @LDAP_LIBS_FE@
242 LDAP_LIBS_BE = @LDAP_LIBS_BE@
243 UUID_LIBS = @UUID_LIBS@
244 UUID_EXTRA_OBJS = @UUID_EXTRA_OBJS@
246 with_gnu_ld = @with_gnu_ld@
247 ld_R_works = @ld_R_works@
249 # We want -L for libpgport.a and libpgcommon.a to be first in LDFLAGS. We
250 # also need LDFLAGS to be a "recursively expanded" variable, else adjustments
251 # to rpathdir don't work right. So we must NOT do LDFLAGS := something,
252 # meaning this has to be done first and elsewhere we must only do LDFLAGS +=
255 LDFLAGS = -L$(libdir)
257 LDFLAGS = -L$(top_builddir)/src/port -L$(top_builddir)/src/common
261 LDFLAGS_EX = @LDFLAGS_EX@
262 # LDFLAGS_SL might have already been assigned by calling makefile
263 LDFLAGS_SL += @LDFLAGS_SL@
273 # quoted to protect pathname with spaces
276 PERL = $(missing) perl
278 perl_archlibexp = @perl_archlibexp@
279 perl_privlibexp = @perl_privlibexp@
280 perl_useshrplib = @perl_useshrplib@
281 perl_embed_ldflags = @perl_embed_ldflags@
288 MSGFMT_FLAGS = @MSGFMT_FLAGS@
289 MSGMERGE = @MSGMERGE@
292 XGETTEXT = @XGETTEXT@
300 PG_PROVE_FLAGS = --ext='.pl' -I $(top_srcdir)/src/test/perl/
301 PROVE_FLAGS = --verbose
303 define prove_installcheck
304 PATH="$(bindir):$$PATH" PGPORT='6$(DEF_PGPORT)' $(PROVE) $(PG_PROVE_FLAGS) $(PROVE_FLAGS)
308 $(MKDIR_P) tmp_check/log
309 $(MAKE) -C $(top_builddir) DESTDIR=$(CURDIR)/tmp_check/install install >$(CURDIR)/tmp_check/log/install.log 2>&1
310 PATH="$(CURDIR)/tmp_check/install$(bindir):$$PATH" PGPORT='6$(DEF_PGPORT)' $(PROVE) $(PG_PROVE_FLAGS) $(PROVE_FLAGS)
315 install_bin = @install_bin@
316 install_sh = $(SHELL) $(top_srcdir)/config/install-sh -c
317 INSTALL = $(if $(use_install_sh),$(install_sh),$(if $(install_bin),$(install_bin),$(install_sh)))
319 INSTALL_SCRIPT_MODE = 755
320 INSTALL_DATA_MODE = 644
321 INSTALL_PROGRAM = $(INSTALL_PROGRAM_ENV) $(INSTALL) $(INSTALL_STRIP_FLAG)
322 INSTALL_SCRIPT = $(INSTALL) -m $(INSTALL_SCRIPT_MODE)
323 INSTALL_DATA = $(INSTALL) -m $(INSTALL_DATA_MODE)
324 INSTALL_STLIB = $(INSTALL_STLIB_ENV) $(INSTALL_DATA) $(INSTALL_STRIP_FLAG)
325 INSTALL_SHLIB = $(INSTALL_SHLIB_ENV) $(INSTALL) $(INSTALL_SHLIB_OPTS) $(INSTALL_STRIP_FLAG)
326 # Override in Makefile.port if necessary
327 INSTALL_SHLIB_OPTS = -m 755
331 missing = $(SHELL) $(top_srcdir)/config/missing
334 STRIP_STATIC_LIB = @STRIP_STATIC_LIB@
335 STRIP_SHARED_LIB = @STRIP_SHARED_LIB@
339 have_docbook = @have_docbook@
340 COLLATEINDEX = @COLLATEINDEX@
341 DOCBOOKSTYLE = @DOCBOOKSTYLE@
345 XSLTPROC = @XSLTPROC@
353 ifeq ($(enable_coverage),yes)
354 # ccache loses .gcno files
355 export CCACHE_DISABLE = 1
360 DEF_PGPORT = @default_port@
361 WANTED_LANGUAGES = @WANTED_LANGUAGES@
364 ##########################################################################
366 # Additional platform-specific settings
369 # Name of the "template"
372 build_os = @build_os@
376 host_cpu = @host_cpu@
378 # Make HAVE_IPV6 available for initdb script creation
379 HAVE_IPV6= @HAVE_IPV6@
381 # The HP-UX port makefile, for one, needs access to this symbol
382 HAVE_POSIX_SIGNALS= @HAVE_POSIX_SIGNALS@
384 # This is mainly for use on FreeBSD, where we have both a.out and elf
385 # systems now. May be applicable to other systems to?
386 ELF_SYSTEM= @ELF_SYS@
388 # Backend stack size limit has to be hard-wired on Windows (it's in bytes)
389 WIN32_STACK_RLIMIT=4194304
391 # Set if we have a working win32 crashdump header
392 have_win32_dbghelp = @have_win32_dbghelp@
394 # Pull in platform-specific magic
395 include $(top_builddir)/src/Makefile.port
397 # Set up rpath if enabled. By default it will point to our libdir,
398 # but individual Makefiles can force other rpath paths if needed.
401 ifeq ($(enable_rpath), yes)
406 ##########################################################################
408 # Some variables needed to find some client interfaces
411 # some contribs assumes headers and libs are in the source tree...
412 libpq_srcdir = $(includedir)
413 libpq_builddir = $(libdir)
415 libpq_srcdir = $(top_srcdir)/src/interfaces/libpq
416 libpq_builddir = $(top_builddir)/src/interfaces/libpq
419 # This macro is for use by libraries linking to libpq. (Because libpgport
420 # isn't created with the same link flags as libpq, it can't be used.)
421 libpq = -L$(libpq_builddir) -lpq
423 # This macro is for use by client executables (not libraries) that use libpq.
424 # We force clients to pull symbols from the non-shared libraries libpgport
425 # and libpgcommon rather than pulling some libpgport symbols from libpq just
426 # because libpq uses those functions too. This makes applications less
427 # dependent on changes in libpq's usage of pgport. To do this we link to
428 # pgport before libpq. This does cause duplicate -lpgport's to appear
429 # on client link lines.
431 libpq_pgport = -L$(libdir) -lpgcommon -lpgport $(libpq)
433 libpq_pgport = -L$(top_builddir)/src/common -lpgcommon -L$(top_builddir)/src/port -lpgport $(libpq)
436 # Cygwin seems to need ldap libraries to be mentioned here, too
437 ifeq ($(PORTNAME),cygwin)
438 libpq_pgport += $(LDAP_LIBS_FE)
441 # If PGXS is not defined, build libpq and libpgport dependencies as required.
442 # If the build is with PGXS, then these are supposed to be already built and
443 # installed, and we just ensure that the expected files exist.
446 $(MAKE) -C $(libpq_builddir) all
448 submake-libpq: $(libdir)/libpq.so ;
453 $(MAKE) -C $(top_builddir)/src/port all
454 $(MAKE) -C $(top_builddir)/src/common all
456 submake-libpgport: $(libdir)/libpgport.a $(libdir)/libpgcommon.a ;
459 .PHONY: submake-libpq submake-libpgport
462 ##########################################################################
466 PL_TESTDB = pl_regression
467 CONTRIB_TESTDB = contrib_regression
468 ifneq ($(MODULE_big),)
469 CONTRIB_TESTDB_MODULE = contrib_regression_$(MODULE_big)
472 CONTRIB_TESTDB_MODULE = contrib_regression_$(MODULES)
474 CONTRIB_TESTDB_MODULE = contrib_regression
479 NOLOCALE += --no-locale
482 pg_regress_locale_flags = $(if $(ENCODING),--encoding=$(ENCODING)) $(NOLOCALE)
484 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)
485 pg_regress_installcheck = $(top_builddir)/src/test/regress/pg_regress --inputdir=$(srcdir) --psqldir='$(PSQLDIR)' $(pg_regress_locale_flags) $(EXTRA_REGRESS_OPTS)
487 pg_regress_clean_files = results/ regression.diffs regression.out tmp_check/ log/
489 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)
490 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)
492 ##########################################################################
496 # This includes your local customizations if Makefile.custom exists
497 # in the source directory. This file doesn't exist in the original
498 # distribution so that it doesn't get overwritten when you upgrade.
500 # NOTE: Makefile.custom is from the pre-Autoconf days of PostgreSQL.
501 # You are liable to shoot yourself in the foot if you use it without
502 # knowing exactly what you're doing. The preferred (and more
503 # reliable) method is to communicate what you want to do to the
504 # configure script, and leave the makefiles alone.
506 -include $(top_srcdir)/src/Makefile.custom
508 ifneq ($(CUSTOM_INSTALL),)
509 INSTALL= $(CUSTOM_INSTALL)
512 ifneq ($(CUSTOM_CC),)
516 ifneq ($(CUSTOM_COPT),)
527 LDFLAGS += $(PROFILE)
531 ##########################################################################
533 # substitute implementations of C library routines (see src/port/)
534 # note we already included -L.../src/port in LDFLAGS above
538 LIBS := -lpgcommon -lpgport $(LIBS)
540 # to make ws2_32.lib the last library, and always link with shfolder,
541 # so SHGetFolderName isn't picked up from shell32.dll
542 ifeq ($(PORTNAME),win32)
543 LIBS += -lws2_32 -lshfolder
546 # Not really standard libc functions, used by the backend.
550 ##########################################################################
552 # Global targets and rules
556 $(FLEX) $(if $(FLEX_NO_BACKUP),-b) $(FLEXFLAGS) -o'$@' $<
557 @$(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)
559 @$(missing) flex $< '$@'
563 $(if $(BISON_CHECK_CMD),$(BISON_CHECK_CMD))
565 $(BISON) $(BISONFLAGS) -o $@ $<
567 @$(missing) bison $< $@
571 $(CPP) $(CPPFLAGS) -o $@ $<
574 $(GZIP) --best -c $< >$@
579 # Direct builds of foo.c -> foo are disabled to avoid generating
580 # *.dSYM junk on Macs. All builds should normally go through the
581 # foo.c -> foo.o -> foo steps. This also ensures that dependency
582 # tracking (see below) is used.
587 # Remake Makefile.global from Makefile.global.in if the latter
588 # changed. In order to trigger this rule, the including file must
589 # write `include $(top_builddir)/src/Makefile.global', not some
591 $(top_builddir)/src/Makefile.global: $(top_srcdir)/src/Makefile.global.in $(top_builddir)/config.status
592 cd $(top_builddir) && ./config.status src/Makefile.global
594 # Remake pg_config.h from pg_config.h.in if the latter changed.
595 # config.status will not change the timestamp on pg_config.h if it
596 # doesn't change, so as to avoid recompiling the entire tree
597 # unnecessarily. Therefore we make config.status update a timestamp file
598 # stamp-h every time it runs, so that we don't trigger this rule every time.
599 # (We do trigger the null rule for stamp-h to pg_config.h every time; so it's
600 # important for that rule to be empty!)
602 # Of course you need to turn on dependency tracking to get any
603 # dependencies on pg_config.h.
604 $(top_builddir)/src/include/pg_config.h: $(top_builddir)/src/include/stamp-h ;
606 $(top_builddir)/src/include/stamp-h: $(top_srcdir)/src/include/pg_config.h.in $(top_builddir)/config.status
607 cd $(top_builddir) && ./config.status src/include/pg_config.h
609 # Also remake pg_config_ext.h from pg_config_ext.h.in, same logic as above.
610 $(top_builddir)/src/include/pg_config_ext.h: $(top_builddir)/src/include/stamp-ext-h ;
612 $(top_builddir)/src/include/stamp-ext-h: $(top_srcdir)/src/include/pg_config_ext.h.in $(top_builddir)/config.status
613 cd $(top_builddir) && ./config.status src/include/pg_config_ext.h
615 # Also remake ecpg_config.h from ecpg_config.h.in if the latter changed, same
617 $(top_builddir)/src/interfaces/ecpg/include/ecpg_config.h: $(top_builddir)/src/interfaces/ecpg/include/stamp-h ;
619 $(top_builddir)/src/interfaces/ecpg/include/stamp-h: $(top_builddir)/src/interfaces/ecpg/include/ecpg_config.h.in $(top_builddir)/config.status
620 cd $(top_builddir) && ./config.status src/interfaces/ecpg/include/ecpg_config.h
622 # When configure changes, rerun configure with the same options as
623 # last time. To change configure, you need to run autoconf manually.
624 $(top_builddir)/config.status: $(top_srcdir)/configure
625 cd $(top_builddir) && ./config.status --recheck
631 # install-strip always uses install-sh, so that strip options can be
633 $(MAKE) use_install_sh=yes \
634 INSTALL_PROGRAM_ENV="STRIPPROG='$(STRIP)'" \
635 INSTALL_STLIB_ENV="STRIPPROG='$(STRIP_STATIC_LIB)'" \
636 INSTALL_SHLIB_ENV="STRIPPROG='$(STRIP_SHARED_LIB)'" \
637 INSTALL_STRIP_FLAG=-s \
641 ##########################################################################
643 # Recursive make support
644 # ----------------------
645 # Instead of recursing through subdirectories with a for loop or
646 # repeated $(MAKE) -C whatever calls, this is a little smarter: it
647 # allows parallel make across directories and lets make -k and -q work
650 # We need the $(eval) function and order-only prerequisites, which are
651 # available in GNU make 3.80. That also happens to be the version
652 # where the .VARIABLES variable was introduced, so this is a simple check.
654 $(error GNU make 3.80 or newer is required. You are using version $(MAKE_VERSION))
657 # This function is only for internal use below. It should be called
658 # using $(eval). It will set up a target so that it recurses into
659 # a given subdirectory. Note that to avoid a nasty bug in make 3.80,
660 # this function has to avoid using any complicated constructs (like
661 # multiple targets on a line) and also not contain any lines that expand
662 # to more than about 200 bytes. This is why we make it apply to just one
663 # subdirectory at a time, rather than to a list of subdirectories.
664 # $1: target name, e.g., all
666 # $3: target to run in subdir, usually same as $1
667 define _create_recursive_target
668 .PHONY: $(1)-$(2)-recurse
669 $(1): $(1)-$(2)-recurse
671 $$(MAKE) -C $(2) $(3)
673 # Note that the use of $$ on the last line above is important; we want
674 # $(MAKE) to be evaluated when the rule is run, not when the $(eval) is run
675 # to create the rule. This is necessary to get make -q working.
677 # Call this function in a makefile that needs to recurse into subdirectories.
678 # In the normal case all arguments can be defaulted.
679 # $1: targets to make recursive (defaults to list of standard targets)
680 # $2: list of subdirs (defaults to SUBDIRS variable)
681 # $3: target to run in subdir (defaults to current element of $1)
682 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))))))
684 # If a makefile's list of SUBDIRS varies depending on configuration, then
685 # any subdirectories excluded from SUBDIRS should instead be added to
686 # ALWAYS_SUBDIRS, and then it must call recurse_always as well as recurse.
687 # This ensures that distprep, distclean, etc will apply to all subdirectories.
688 # In the normal case all arguments will be defaulted.
689 # $1: targets to make recursive (defaults to standard_always_targets)
690 # $2: list of subdirs (defaults to ALWAYS_SUBDIRS variable)
691 # $3: target to run in subdir (defaults to current element of $1)
692 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))))))
695 ##########################################################################
697 # Automatic dependency generation
698 # -------------------------------
699 # When we configure with --enable-depend then we override the default
700 # compilation rule with the magic below. While or after creating the
701 # actual output file we also create a dependency list for the .c file.
702 # Next time we invoke make we will have top-notch information about
703 # whether this file needs to be updated. The dependency files are kept
704 # in the .deps subdirectory of each directory.
706 autodepend = @autodepend@
708 ifeq ($(autodepend), yes)
711 COMPILE.c = $(CC) $(CFLAGS) $(CPPFLAGS) -c
718 # GCC allows us to create object and dependency file in one invocation.
720 @if test ! -d $(DEPDIR); then mkdir -p $(DEPDIR); fi
721 $(COMPILE.c) -o $@ $< -MMD -MP -MF $(DEPDIR)/$(*F).Po
725 # Include all the dependency files generated for the current
726 # directory. Note that make would complain if include was called with
728 Po_files := $(wildcard $(DEPDIR)/*.Po)
734 clean distclean maintainer-clean: clean-deps
743 ##########################################################################
745 # Native language support
747 ifeq ($(enable_nls), yes)
748 ifneq (,$(wildcard $(srcdir)/nls.mk))
750 include $(top_srcdir)/src/nls-global.mk
756 ##########################################################################
760 # Explanation of involved files:
763 # foo.gcno gcov graph (a.k.a. "notes") file, created at compile time
764 # (by gcc -ftest-coverage)
765 # foo.gcda gcov data file, created when the program is run (for
766 # programs compiled with gcc -fprofile-arcs)
767 # foo.c.gcov gcov output file with coverage information, created by
768 # gcov from foo.gcda (by "make coverage")
769 # foo.c.gcov.out stdout captured when foo.c.gcov is created, mildly
771 # lcov.info lcov tracefile, built from gcda files in one directory,
772 # later collected by "make coverage-html"
774 ifeq ($(enable_coverage), yes)
776 # There is a strange interaction between lcov and existing .gcov
777 # output files. Hence the rm command and the ordering dependency.
779 gcda_files := $(wildcard *.gcda)
781 lcov.info: $(gcda_files)
783 $(if $^,$(LCOV) -d . -c -o $@ $(LCOVFLAGS) --gcov-tool $(GCOV))
785 %.c.gcov: %.gcda | lcov.info
786 $(GCOV) -b -f -p -o . $(GCOVFLAGS) $*.c >$*.c.gcov.out
788 coverage: $(gcda_files:.gcda=.c.gcov) lcov.info
790 .PHONY: coverage-html
791 coverage-html: coverage
794 $(GENHTML) --show-details --legend --output-directory=coverage --title=PostgreSQL --num-spaces=4 --prefix=$(abs_top_srcdir) `find . -name lcov.info -print`
798 clean distclean maintainer-clean: clean-coverage
800 .PHONY: clean-coverage
803 rm -f *.gcda *.gcno lcov.info *.gcov *.gcov.out
806 # User-callable target to reset counts between test runs
808 rm -f `find . -name '*.gcda' -print`
810 endif # enable_coverage