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@
41 VERSION_NUM = @PG_VERSION_NUM@
43 # Set top_srcdir, srcdir, and VPATH.
45 top_srcdir = $(top_builddir)
47 # If VPATH is set or Makefile is not in current directory we are building
48 # the extension with VPATH so we set the variable here.
52 ifeq ($(CURDIR),$(dir $(firstword $(MAKEFILE_LIST))))
56 srcdir = $(dir $(firstword $(MAKEFILE_LIST)))
61 vpath_build = @vpath_build@
62 abs_top_builddir = @abs_top_builddir@
63 abs_top_srcdir = @abs_top_srcdir@
65 ifneq ($(vpath_build),yes)
66 top_srcdir = $(top_builddir)
68 else # vpath_build = yes
69 top_srcdir = $(abs_top_srcdir)
70 srcdir = $(top_srcdir)/$(subdir)
75 vpathsearch = `for f in $(addsuffix /$(1),$(subst :, ,. $(VPATH))); do test -r $$f && echo $$f && break; done`
77 # Saved arguments from configure
78 configure_args = @configure_args@
81 ##########################################################################
83 # Installation directories
85 # These are set by the equivalent --xxxdir configure options. We
86 # append "postgresql" to some of them, if the string does not already
87 # contain "pgsql" or "postgres", in order to avoid directory clutter.
89 # In a PGXS build, we cannot use the values inserted into Makefile.global
90 # by configure, since the installation tree may have been relocated.
91 # Instead get the path values from pg_config.
95 # Note that prefix, exec_prefix, and datarootdir aren't defined in a PGXS build;
96 # makefiles may only use the derived variables such as bindir.
99 exec_prefix := @exec_prefix@
100 datarootdir := @datarootdir@
105 ifeq "$(findstring pgsql, $(datadir))" ""
106 ifeq "$(findstring postgres, $(datadir))" ""
107 override datadir := $(datadir)/postgresql
111 sysconfdir := @sysconfdir@
112 ifeq "$(findstring pgsql, $(sysconfdir))" ""
113 ifeq "$(findstring postgres, $(sysconfdir))" ""
114 override sysconfdir := $(sysconfdir)/postgresql
120 pkglibdir = $(libdir)
121 ifeq "$(findstring pgsql, $(pkglibdir))" ""
122 ifeq "$(findstring postgres, $(pkglibdir))" ""
123 override pkglibdir := $(pkglibdir)/postgresql
127 includedir := @includedir@
129 pkgincludedir = $(includedir)
130 ifeq "$(findstring pgsql, $(pkgincludedir))" ""
131 ifeq "$(findstring postgres, $(pkgincludedir))" ""
132 override pkgincludedir := $(pkgincludedir)/postgresql
139 ifeq "$(findstring pgsql, $(docdir))" ""
140 ifeq "$(findstring postgres, $(docdir))" ""
141 override docdir := $(docdir)/postgresql
147 localedir := @localedir@
151 # Extension makefiles should set PG_CONFIG, but older ones might not
153 PG_CONFIG = pg_config
156 bindir := $(shell $(PG_CONFIG) --bindir)
157 datadir := $(shell $(PG_CONFIG) --sharedir)
158 sysconfdir := $(shell $(PG_CONFIG) --sysconfdir)
159 libdir := $(shell $(PG_CONFIG) --libdir)
160 pkglibdir := $(shell $(PG_CONFIG) --pkglibdir)
161 includedir := $(shell $(PG_CONFIG) --includedir)
162 pkgincludedir := $(shell $(PG_CONFIG) --pkgincludedir)
163 mandir := $(shell $(PG_CONFIG) --mandir)
164 docdir := $(shell $(PG_CONFIG) --docdir)
165 localedir := $(shell $(PG_CONFIG) --localedir)
169 # These derived path variables aren't separately configurable.
171 includedir_server = $(pkgincludedir)/server
172 includedir_internal = $(pkgincludedir)/internal
173 pgxsdir = $(pkglibdir)/pgxs
176 ##########################################################################
180 # Records the choice of the various --enable-xxx and --with-xxx options.
182 with_perl = @with_perl@
183 with_python = @with_python@
184 with_tcl = @with_tcl@
185 with_openssl = @with_openssl@
186 with_selinux = @with_selinux@
187 with_libxml = @with_libxml@
188 with_libxslt = @with_libxslt@
189 with_system_tzdata = @with_system_tzdata@
190 with_uuid = @with_uuid@
191 with_zlib = @with_zlib@
192 enable_rpath = @enable_rpath@
193 enable_nls = @enable_nls@
194 enable_debug = @enable_debug@
195 enable_dtrace = @enable_dtrace@
196 enable_coverage = @enable_coverage@
197 enable_tap_tests = @enable_tap_tests@
198 enable_thread_safety = @enable_thread_safety@
200 python_includespec = @python_includespec@
201 python_libdir = @python_libdir@
202 python_libspec = @python_libspec@
203 python_additional_libs = @python_additional_libs@
204 python_majorversion = @python_majorversion@
205 python_version = @python_version@
207 krb_srvtab = @krb_srvtab@
210 TCL_LIBS = @TCL_LIBS@
211 TCL_LIB_SPEC = @TCL_LIB_SPEC@
212 TCL_INCLUDE_SPEC = @TCL_INCLUDE_SPEC@
213 TCL_SHARED_BUILD = @TCL_SHARED_BUILD@
214 TCL_SHLIB_LD_LIBS = @TCL_SHLIB_LD_LIBS@
216 PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
217 PTHREAD_LIBS = @PTHREAD_LIBS@
220 ##########################################################################
227 CPPFLAGS = @CPPFLAGS@
230 override CPPFLAGS := -I$(includedir_server) -I$(includedir_internal) $(CPPFLAGS)
232 override CPPFLAGS := -I$(top_srcdir)/src/include $(CPPFLAGS)
234 override CPPFLAGS := -I$(top_builddir)/src/include $(CPPFLAGS)
240 SUN_STUDIO_CC = @SUN_STUDIO_CC@
242 CFLAGS_VECTOR = @CFLAGS_VECTOR@
243 CFLAGS_SSE42 = @CFLAGS_SSE42@
248 BISONFLAGS = @BISONFLAGS@ $(YFLAGS)
250 FLEXFLAGS = @FLEXFLAGS@ $(LFLAGS)
252 DTRACEFLAGS = @DTRACEFLAGS@
261 LDAP_LIBS_FE = @LDAP_LIBS_FE@
262 LDAP_LIBS_BE = @LDAP_LIBS_BE@
263 UUID_LIBS = @UUID_LIBS@
264 UUID_EXTRA_OBJS = @UUID_EXTRA_OBJS@
266 with_gnu_ld = @with_gnu_ld@
267 ld_R_works = @ld_R_works@
269 # We want -L for libpgport.a and libpgcommon.a to be first in LDFLAGS. We
270 # also need LDFLAGS to be a "recursively expanded" variable, else adjustments
271 # to rpathdir don't work right. So we must NOT do LDFLAGS := something,
272 # meaning this has to be done first and elsewhere we must only do LDFLAGS +=
275 LDFLAGS = -L$(libdir)
277 LDFLAGS = -L$(top_builddir)/src/port -L$(top_builddir)/src/common
281 LDFLAGS_EX = @LDFLAGS_EX@
282 # LDFLAGS_SL might have already been assigned by calling makefile
283 LDFLAGS_SL += @LDFLAGS_SL@
293 # quoted to protect pathname with spaces
296 PERL = $(missing) perl
298 perl_archlibexp = @perl_archlibexp@
299 perl_privlibexp = @perl_privlibexp@
300 perl_embed_ldflags = @perl_embed_ldflags@
307 MSGFMT_FLAGS = @MSGFMT_FLAGS@
308 MSGMERGE = @MSGMERGE@
311 XGETTEXT = @XGETTEXT@
322 ifndef NO_TEMP_INSTALL
323 ifneq ($(abs_top_builddir),)
324 ifeq ($(MAKELEVEL),0)
325 rm -rf '$(abs_top_builddir)'/tmp_install
326 $(MKDIR_P) '$(abs_top_builddir)'/tmp_install/log
327 $(MAKE) -C '$(top_builddir)' DESTDIR='$(abs_top_builddir)'/tmp_install install >'$(abs_top_builddir)'/tmp_install/log/install.log 2>&1
329 $(if $(EXTRA_INSTALL),for extra in $(EXTRA_INSTALL); do $(MAKE) -C '$(top_builddir)'/$$extra DESTDIR='$(abs_top_builddir)'/tmp_install install >>'$(abs_top_builddir)'/tmp_install/log/install.log || exit; done)
334 PG_PROVE_FLAGS = -I $(top_srcdir)/src/test/perl/
335 PROVE_FLAGS = --verbose
337 # prepend to path if already set, else just set it
339 $(1)="$(if $($(1)),$(2):$$$(1),$(2))"
342 # platform-specific environment variable to set shared library path
343 define ld_library_path_var
344 $(if $(filter $(PORTNAME),darwin),DYLD_LIBRARY_PATH,$(if $(filter $(PORTNAME),aix),LIBPATH,LD_LIBRARY_PATH))
347 define with_temp_install
348 PATH="$(abs_top_builddir)/tmp_install$(bindir):$$PATH" $(call add_to_path,$(ld_library_path_var),$(abs_top_builddir)/tmp_install$(libdir))
351 ifeq ($(enable_tap_tests),yes)
353 define prove_installcheck
354 rm -rf $(CURDIR)/tmp_check/log
355 cd $(srcdir) && TESTDIR='$(CURDIR)' PATH="$(bindir):$$PATH" PGPORT='6$(DEF_PGPORT)' top_builddir='$(CURDIR)/$(top_builddir)' PG_REGRESS='$(CURDIR)/$(top_builddir)/src/test/regress/pg_regress' $(PROVE) $(PG_PROVE_FLAGS) $(PROVE_FLAGS) t/*.pl
359 rm -rf $(CURDIR)/tmp_check/log
360 cd $(srcdir) && TESTDIR='$(CURDIR)' $(with_temp_install) PGPORT='6$(DEF_PGPORT)' PG_REGRESS='$(CURDIR)/$(top_builddir)/src/test/regress/pg_regress' $(PROVE) $(PG_PROVE_FLAGS) $(PROVE_FLAGS) t/*.pl
364 prove_installcheck = @echo "TAP tests not enabled"
365 prove_check = $(prove_installcheck)
370 install_bin = @install_bin@
371 install_sh = $(SHELL) $(top_srcdir)/config/install-sh -c
372 INSTALL = $(if $(use_install_sh),$(install_sh),$(if $(install_bin),$(install_bin),$(install_sh)))
374 INSTALL_SCRIPT_MODE = 755
375 INSTALL_DATA_MODE = 644
376 INSTALL_PROGRAM = $(INSTALL_PROGRAM_ENV) $(INSTALL) $(INSTALL_STRIP_FLAG)
377 INSTALL_SCRIPT = $(INSTALL) -m $(INSTALL_SCRIPT_MODE)
378 INSTALL_DATA = $(INSTALL) -m $(INSTALL_DATA_MODE)
379 INSTALL_STLIB = $(INSTALL_STLIB_ENV) $(INSTALL_DATA) $(INSTALL_STRIP_FLAG)
380 INSTALL_SHLIB = $(INSTALL_SHLIB_ENV) $(INSTALL) $(INSTALL_SHLIB_OPTS) $(INSTALL_STRIP_FLAG)
381 # Override in Makefile.port if necessary
382 INSTALL_SHLIB_OPTS = -m 755
386 missing = $(SHELL) $(top_srcdir)/config/missing
389 STRIP_STATIC_LIB = @STRIP_STATIC_LIB@
390 STRIP_SHARED_LIB = @STRIP_SHARED_LIB@
394 have_docbook = @have_docbook@
395 COLLATEINDEX = @COLLATEINDEX@
396 DBTOEPUB = @DBTOEPUB@
397 DOCBOOKSTYLE = @DOCBOOKSTYLE@
402 XSLTPROC = @XSLTPROC@
410 ifeq ($(enable_coverage),yes)
411 # ccache loses .gcno files
412 export CCACHE_DISABLE = 1
417 DEF_PGPORT = @default_port@
418 WANTED_LANGUAGES = @WANTED_LANGUAGES@
421 ##########################################################################
423 # Additional platform-specific settings
426 # Name of the "template"
429 build_os = @build_os@
433 host_cpu = @host_cpu@
435 # Make HAVE_IPV6 available for initdb script creation
436 HAVE_IPV6= @HAVE_IPV6@
438 # This is mainly for use on FreeBSD, where we have both a.out and elf
439 # systems now. May be applicable to other systems to?
440 ELF_SYSTEM= @ELF_SYS@
442 # Backend stack size limit has to be hard-wired on Windows (it's in bytes)
443 WIN32_STACK_RLIMIT=4194304
445 # Set if we have a working win32 crashdump header
446 have_win32_dbghelp = @have_win32_dbghelp@
448 # Pull in platform-specific magic
449 include $(top_builddir)/src/Makefile.port
451 # Set up rpath if enabled. By default it will point to our libdir,
452 # but individual Makefiles can force other rpath paths if needed.
455 ifeq ($(enable_rpath), yes)
460 ##########################################################################
462 # Some variables needed to find some client interfaces
465 # some contribs assumes headers and libs are in the source tree...
466 libpq_srcdir = $(includedir)
467 libpq_builddir = $(libdir)
469 libpq_srcdir = $(top_srcdir)/src/interfaces/libpq
470 libpq_builddir = $(top_builddir)/src/interfaces/libpq
473 # This macro is for use by libraries linking to libpq. (Because libpgport
474 # isn't created with the same link flags as libpq, it can't be used.)
475 libpq = -L$(libpq_builddir) -lpq
477 # This macro is for use by client executables (not libraries) that use libpq.
478 # We force clients to pull symbols from the non-shared libraries libpgport
479 # and libpgcommon rather than pulling some libpgport symbols from libpq just
480 # because libpq uses those functions too. This makes applications less
481 # dependent on changes in libpq's usage of pgport. To do this we link to
482 # pgport before libpq. This does cause duplicate -lpgport's to appear
483 # on client link lines.
485 libpq_pgport = -L$(libdir) -lpgcommon -lpgport $(libpq)
487 libpq_pgport = -L$(top_builddir)/src/common -lpgcommon -L$(top_builddir)/src/port -lpgport $(libpq)
490 # Cygwin seems to need ldap libraries to be mentioned here, too
491 ifeq ($(PORTNAME),cygwin)
492 libpq_pgport += $(LDAP_LIBS_FE)
497 $(MAKE) -C $(libpq_builddir) all
500 $(MAKE) -C $(top_builddir)/src/port all
501 $(MAKE) -C $(top_builddir)/src/common all
503 .PHONY: submake-libpq submake-libpgport
506 ##########################################################################
510 PL_TESTDB = pl_regression
511 CONTRIB_TESTDB = contrib_regression
512 ifneq ($(MODULE_big),)
513 CONTRIB_TESTDB_MODULE = contrib_regression_$(MODULE_big)
516 CONTRIB_TESTDB_MODULE = contrib_regression_$(MODULES)
518 CONTRIB_TESTDB_MODULE = contrib_regression
523 NOLOCALE += --no-locale
526 pg_regress_locale_flags = $(if $(ENCODING),--encoding=$(ENCODING)) $(NOLOCALE)
528 pg_regress_check = $(with_temp_install) $(top_builddir)/src/test/regress/pg_regress --inputdir=$(srcdir) --temp-instance=./tmp_check --bindir= $(pg_regress_locale_flags) $(EXTRA_REGRESS_OPTS)
529 pg_regress_installcheck = $(top_builddir)/src/test/regress/pg_regress --inputdir=$(srcdir) --bindir='$(bindir)' $(pg_regress_locale_flags) $(EXTRA_REGRESS_OPTS)
531 pg_regress_clean_files = results/ regression.diffs regression.out tmp_check/ log/
533 pg_isolation_regress_check = $(with_temp_install) $(top_builddir)/src/test/isolation/pg_isolation_regress --inputdir=$(srcdir) --temp-instance=./tmp_check --bindir= $(pg_regress_locale_flags) $(EXTRA_REGRESS_OPTS)
534 pg_isolation_regress_installcheck = $(top_builddir)/src/test/isolation/pg_isolation_regress --inputdir=$(srcdir) $(pg_regress_locale_flags) $(EXTRA_REGRESS_OPTS)
536 ##########################################################################
540 # This includes your local customizations if Makefile.custom exists
541 # in the source directory. This file doesn't exist in the original
542 # distribution so that it doesn't get overwritten when you upgrade.
544 # NOTE: Makefile.custom is from the pre-Autoconf days of PostgreSQL.
545 # You are liable to shoot yourself in the foot if you use it without
546 # knowing exactly what you're doing. The preferred (and more
547 # reliable) method is to communicate what you want to do to the
548 # configure script, and leave the makefiles alone.
550 -include $(top_srcdir)/src/Makefile.custom
552 ifneq ($(CUSTOM_INSTALL),)
553 INSTALL= $(CUSTOM_INSTALL)
556 ifneq ($(CUSTOM_CC),)
560 ifneq ($(CUSTOM_COPT),)
571 LDFLAGS += $(PROFILE)
575 ##########################################################################
577 # substitute implementations of C library routines (see src/port/)
578 # note we already included -L.../src/port in LDFLAGS above
582 # files needed for the chosen CRC-32C implementation
583 PG_CRC32C_OBJS = @PG_CRC32C_OBJS@
585 LIBS := -lpgcommon -lpgport $(LIBS)
587 # to make ws2_32.lib the last library
588 ifeq ($(PORTNAME),win32)
592 # Not really standard libc functions, used by the backend.
596 ##########################################################################
598 # Global targets and rules
602 $(FLEX) $(if $(FLEX_NO_BACKUP),-b) $(FLEXFLAGS) -o'$@' $<
603 @$(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)
605 @$(missing) flex $< '$@'
609 $(if $(BISON_CHECK_CMD),$(BISON_CHECK_CMD))
611 $(BISON) $(BISONFLAGS) -o $@ $<
613 @$(missing) bison $< $@
617 $(CPP) $(CPPFLAGS) -o $@ $<
620 $(GZIP) --best -c $< >$@
625 # Direct builds of foo.c -> foo are disabled to avoid generating
626 # *.dSYM junk on Macs. All builds should normally go through the
627 # foo.c -> foo.o -> foo steps. This also ensures that dependency
628 # tracking (see below) is used.
633 # Remake Makefile.global from Makefile.global.in if the latter
634 # changed. In order to trigger this rule, the including file must
635 # write `include $(top_builddir)/src/Makefile.global', not some
637 $(top_builddir)/src/Makefile.global: $(top_srcdir)/src/Makefile.global.in $(top_builddir)/config.status
638 cd $(top_builddir) && ./config.status src/Makefile.global
640 # Remake pg_config.h from pg_config.h.in if the latter changed.
641 # config.status will not change the timestamp on pg_config.h if it
642 # doesn't change, so as to avoid recompiling the entire tree
643 # unnecessarily. Therefore we make config.status update a timestamp file
644 # stamp-h every time it runs, so that we don't trigger this rule every time.
645 # (We do trigger the null rule for stamp-h to pg_config.h every time; so it's
646 # important for that rule to be empty!)
648 # Of course you need to turn on dependency tracking to get any
649 # dependencies on pg_config.h.
650 $(top_builddir)/src/include/pg_config.h: $(top_builddir)/src/include/stamp-h ;
652 $(top_builddir)/src/include/stamp-h: $(top_srcdir)/src/include/pg_config.h.in $(top_builddir)/config.status
653 cd $(top_builddir) && ./config.status src/include/pg_config.h
655 # Also remake pg_config_ext.h from pg_config_ext.h.in, same logic as above.
656 $(top_builddir)/src/include/pg_config_ext.h: $(top_builddir)/src/include/stamp-ext-h ;
658 $(top_builddir)/src/include/stamp-ext-h: $(top_srcdir)/src/include/pg_config_ext.h.in $(top_builddir)/config.status
659 cd $(top_builddir) && ./config.status src/include/pg_config_ext.h
661 # Also remake ecpg_config.h from ecpg_config.h.in if the latter changed, same
663 $(top_builddir)/src/interfaces/ecpg/include/ecpg_config.h: $(top_builddir)/src/interfaces/ecpg/include/stamp-h ;
665 $(top_builddir)/src/interfaces/ecpg/include/stamp-h: $(top_builddir)/src/interfaces/ecpg/include/ecpg_config.h.in $(top_builddir)/config.status
666 cd $(top_builddir) && ./config.status src/interfaces/ecpg/include/ecpg_config.h
668 # When configure changes, rerun configure with the same options as
669 # last time. To change configure, you need to run autoconf manually.
670 $(top_builddir)/config.status: $(top_srcdir)/configure
671 cd $(top_builddir) && ./config.status --recheck
677 # install-strip always uses install-sh, so that strip options can be
679 $(MAKE) use_install_sh=yes \
680 INSTALL_PROGRAM_ENV="STRIPPROG='$(STRIP)'" \
681 INSTALL_STLIB_ENV="STRIPPROG='$(STRIP_STATIC_LIB)'" \
682 INSTALL_SHLIB_ENV="STRIPPROG='$(STRIP_SHARED_LIB)'" \
683 INSTALL_STRIP_FLAG=-s \
687 ##########################################################################
689 # Recursive make support
690 # ----------------------
691 # Instead of recursing through subdirectories with a for loop or
692 # repeated $(MAKE) -C whatever calls, this is a little smarter: it
693 # allows parallel make across directories and lets make -k and -q work
696 # We need the $(eval) function and order-only prerequisites, which are
697 # available in GNU make 3.80. That also happens to be the version
698 # where the .VARIABLES variable was introduced, so this is a simple check.
700 $(error GNU make 3.80 or newer is required. You are using version $(MAKE_VERSION))
703 # This function is only for internal use below. It should be called
704 # using $(eval). It will set up a target so that it recurses into
705 # a given subdirectory. Note that to avoid a nasty bug in make 3.80,
706 # this function has to avoid using any complicated constructs (like
707 # multiple targets on a line) and also not contain any lines that expand
708 # to more than about 200 bytes. This is why we make it apply to just one
709 # subdirectory at a time, rather than to a list of subdirectories.
710 # $1: target name, e.g., all
712 # $3: target to run in subdir, usually same as $1
713 define _create_recursive_target
714 .PHONY: $(1)-$(2)-recurse
715 $(1): $(1)-$(2)-recurse
716 $(1)-$(2)-recurse: $(if $(filter check, $(3)), temp-install)
717 $$(MAKE) -C $(2) $(3)
719 # Note that the use of $$ on the last line above is important; we want
720 # $(MAKE) to be evaluated when the rule is run, not when the $(eval) is run
721 # to create the rule. This is necessary to get make -q working.
723 # Call this function in a makefile that needs to recurse into subdirectories.
724 # In the normal case all arguments can be defaulted.
725 # $1: targets to make recursive (defaults to list of standard targets)
726 # $2: list of subdirs (defaults to SUBDIRS variable)
727 # $3: target to run in subdir (defaults to current element of $1)
728 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))))))
730 # If a makefile's list of SUBDIRS varies depending on configuration, then
731 # any subdirectories excluded from SUBDIRS should instead be added to
732 # ALWAYS_SUBDIRS, and then it must call recurse_always as well as recurse.
733 # This ensures that distprep, distclean, etc will apply to all subdirectories.
734 # In the normal case all arguments will be defaulted.
735 # $1: targets to make recursive (defaults to standard_always_targets)
736 # $2: list of subdirs (defaults to ALWAYS_SUBDIRS variable)
737 # $3: target to run in subdir (defaults to current element of $1)
738 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))))))
741 ##########################################################################
743 # Automatic dependency generation
744 # -------------------------------
745 # When we configure with --enable-depend then we override the default
746 # compilation rule with the magic below. While or after creating the
747 # actual output file we also create a dependency list for the .c file.
748 # Next time we invoke make we will have top-notch information about
749 # whether this file needs to be updated. The dependency files are kept
750 # in the .deps subdirectory of each directory.
752 autodepend = @autodepend@
754 ifeq ($(autodepend), yes)
757 COMPILE.c = $(CC) $(CFLAGS) $(CPPFLAGS) -c
764 # GCC allows us to create object and dependency file in one invocation.
766 @if test ! -d $(DEPDIR); then mkdir -p $(DEPDIR); fi
767 $(COMPILE.c) -o $@ $< -MMD -MP -MF $(DEPDIR)/$(*F).Po
771 # Include all the dependency files generated for the current
772 # directory. Note that make would complain if include was called with
774 Po_files := $(wildcard $(DEPDIR)/*.Po)
780 clean distclean maintainer-clean: clean-deps
789 ##########################################################################
791 # Native language support
793 ifeq ($(enable_nls), yes)
794 ifneq (,$(wildcard $(srcdir)/nls.mk))
796 include $(top_srcdir)/src/nls-global.mk
802 ##########################################################################
806 # Explanation of involved files:
809 # foo.gcno gcov graph (a.k.a. "notes") file, created at compile time
810 # (by gcc -ftest-coverage)
811 # foo.gcda gcov data file, created when the program is run (for
812 # programs compiled with gcc -fprofile-arcs)
813 # foo.c.gcov gcov output file with coverage information, created by
814 # gcov from foo.gcda (by "make coverage")
815 # foo.c.gcov.out stdout captured when foo.c.gcov is created, mildly
817 # lcov.info lcov tracefile, built from gcda files in one directory,
818 # later collected by "make coverage-html"
820 ifeq ($(enable_coverage), yes)
822 # There is a strange interaction between lcov and existing .gcov
823 # output files. Hence the rm command and the ordering dependency.
825 gcda_files := $(wildcard *.gcda)
827 lcov.info: $(gcda_files)
829 $(if $^,$(LCOV) -d . -c -o $@ $(LCOVFLAGS) --gcov-tool $(GCOV))
831 %.c.gcov: %.gcda | lcov.info
832 $(GCOV) -b -f -p -o . $(GCOVFLAGS) $*.c >$*.c.gcov.out
834 coverage: $(gcda_files:.gcda=.c.gcov) lcov.info
836 .PHONY: coverage-html
837 coverage-html: coverage
840 $(GENHTML) --show-details --legend --output-directory=coverage --title=PostgreSQL --num-spaces=4 --prefix=$(abs_top_srcdir) `find . -name lcov.info -print`
844 clean distclean maintainer-clean: clean-coverage
846 .PHONY: clean-coverage
849 rm -f *.gcda *.gcno lcov.info *.gcov *.gcov.out
852 # User-callable target to reset counts between test runs
854 rm -f `find . -name '*.gcda' -print`
856 endif # enable_coverage