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