OSDN Git Service

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