]> granicus.if.org Git - postgresql/blob - src/Makefile.global.in
Stamp HEAD as 9.5devel.
[postgresql] / src / Makefile.global.in
1 # -*-makefile-*-
2 # src/Makefile.global.in
3 # @configure_input@
4
5 #------------------------------------------------------------------------------
6 # All PostgreSQL makefiles include this file and use the variables it sets,
7 # which in turn are put here by the configure script. There is no need for
8 # users to edit this file -- if it turns out to be necessary then that's a
9 # bug.
10 #
11 # A makefile that includes this file needs to set the variable `subdir' to
12 # the relative path from the top to itself and `top_builddir' to the relative
13 # path from itself to the top before including this file. (The "top" is the
14 # parent directory of the directory this file is in.)
15 #------------------------------------------------------------------------------
16
17
18 ##########################################################################
19 #
20 # Meta configuration
21
22 standard_targets = all install installdirs uninstall distprep clean distclean maintainer-clean coverage check installcheck init-po update-po
23 # these targets should recurse even into subdirectories not being built:
24 standard_always_targets = distprep clean distclean maintainer-clean
25
26 .PHONY: $(standard_targets) install-strip html man installcheck-parallel maintainer-check
27
28 # make `all' the default target
29 all:
30
31 # Delete target files if the command fails after it has
32 # started to update the file.
33 .DELETE_ON_ERROR:
34
35 # Never delete any intermediate files automatically.
36 .SECONDARY:
37
38 # PostgreSQL version number
39 VERSION = @PACKAGE_VERSION@
40 MAJORVERSION = @PG_MAJORVERSION@
41
42 # Support for VPATH builds
43 vpath_build = @vpath_build@
44 abs_top_srcdir = @abs_top_srcdir@
45
46 ifneq ($(vpath_build),yes)
47 top_srcdir = $(top_builddir)
48 srcdir = .
49 else # vpath_build = yes
50 top_srcdir = $(abs_top_srcdir)
51 srcdir = $(top_srcdir)/$(subdir)
52 VPATH = $(srcdir)
53 endif
54
55 vpathsearch = `for f in $(addsuffix /$(1),$(subst :, ,. $(VPATH))); do test -r $$f && echo $$f && break; done`
56
57 # Saved arguments from configure
58 configure_args = @configure_args@
59
60
61 ##########################################################################
62 #
63 # Installation directories
64 #
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.
68 #
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.
72
73 ifndef PGXS
74
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.
77
78 prefix := @prefix@
79 exec_prefix := @exec_prefix@
80 datarootdir := @datarootdir@
81
82 bindir := @bindir@
83
84 datadir := @datadir@
85 ifeq "$(findstring pgsql, $(datadir))" ""
86 ifeq "$(findstring postgres, $(datadir))" ""
87 override datadir := $(datadir)/postgresql
88 endif
89 endif
90
91 sysconfdir := @sysconfdir@
92 ifeq "$(findstring pgsql, $(sysconfdir))" ""
93 ifeq "$(findstring postgres, $(sysconfdir))" ""
94 override sysconfdir := $(sysconfdir)/postgresql
95 endif
96 endif
97
98 libdir := @libdir@
99
100 pkglibdir = $(libdir)
101 ifeq "$(findstring pgsql, $(pkglibdir))" ""
102 ifeq "$(findstring postgres, $(pkglibdir))" ""
103 override pkglibdir := $(pkglibdir)/postgresql
104 endif
105 endif
106
107 includedir := @includedir@
108
109 pkgincludedir = $(includedir)
110 ifeq "$(findstring pgsql, $(pkgincludedir))" ""
111 ifeq "$(findstring postgres, $(pkgincludedir))" ""
112 override pkgincludedir := $(pkgincludedir)/postgresql
113 endif
114 endif
115
116 mandir := @mandir@
117
118 docdir := @docdir@
119 ifeq "$(findstring pgsql, $(docdir))" ""
120 ifeq "$(findstring postgres, $(docdir))" ""
121 override docdir := $(docdir)/postgresql
122 endif
123 endif
124
125 htmldir := @htmldir@
126
127 localedir := @localedir@
128
129 else # PGXS case
130
131 # Extension makefiles should set PG_CONFIG, but older ones might not
132 ifndef PG_CONFIG
133 PG_CONFIG = pg_config
134 endif
135
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)
146
147 endif # PGXS
148
149 # These derived path variables aren't separately configurable.
150
151 includedir_server = $(pkgincludedir)/server
152 includedir_internal = $(pkgincludedir)/internal
153 pgxsdir = $(pkglibdir)/pgxs
154
155
156 ##########################################################################
157 #
158 # Features
159 #
160 # Records the choice of the various --enable-xxx and --with-xxx options.
161
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@
178
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@
186
187 krb_srvtab = @krb_srvtab@
188
189 TCLSH                   = @TCLSH@
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@
196
197 PTHREAD_CFLAGS          = @PTHREAD_CFLAGS@
198 PTHREAD_LIBS            = @PTHREAD_LIBS@
199
200
201 ##########################################################################
202 #
203 # Programs and flags
204
205 # Compilers
206
207 CPP = @CPP@
208 CPPFLAGS = @CPPFLAGS@
209
210 ifdef PGXS
211 override CPPFLAGS := -I$(includedir_server) -I$(includedir_internal) $(CPPFLAGS)
212 else # not PGXS
213 override CPPFLAGS := -I$(top_srcdir)/src/include $(CPPFLAGS)
214 ifdef VPATH
215 override CPPFLAGS := -I$(top_builddir)/src/include $(CPPFLAGS)
216 endif
217 endif # not PGXS
218
219 CC = @CC@
220 GCC = @GCC@
221 SUN_STUDIO_CC = @SUN_STUDIO_CC@
222 CFLAGS = @CFLAGS@
223 CFLAGS_VECTOR = @CFLAGS_VECTOR@
224
225 # Kind-of compilers
226
227 BISON = @BISON@
228 BISONFLAGS = @BISONFLAGS@ $(YFLAGS)
229 FLEX = @FLEX@
230 FLEXFLAGS = @FLEXFLAGS@ $(LFLAGS)
231 DTRACE = @DTRACE@
232 DTRACEFLAGS = @DTRACEFLAGS@
233 ZIC = @ZIC@
234
235 # Linking
236
237 AR = @AR@
238 DLLTOOL = @DLLTOOL@
239 DLLWRAP = @DLLWRAP@
240 LIBS = @LIBS@
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@
245 LD = @LD@
246 with_gnu_ld = @with_gnu_ld@
247 ld_R_works = @ld_R_works@
248
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 +=
253 # something.
254 ifdef PGXS
255   LDFLAGS = -L$(libdir)
256 else
257   LDFLAGS = -L$(top_builddir)/src/port -L$(top_builddir)/src/common
258 endif
259 LDFLAGS += @LDFLAGS@
260
261 LDFLAGS_EX = @LDFLAGS_EX@
262 # LDFLAGS_SL might have already been assigned by calling makefile
263 LDFLAGS_SL += @LDFLAGS_SL@
264 LDREL = -r
265 LDOUT = -o
266 RANLIB = @RANLIB@
267 WINDRES = @WINDRES@
268 X = @EXEEXT@
269
270 # Perl
271
272 ifneq (@PERL@,)
273     # quoted to protect pathname with spaces
274     PERL                = '@PERL@'
275 else
276     PERL                = $(missing) perl
277 endif
278 perl_archlibexp         = @perl_archlibexp@
279 perl_privlibexp         = @perl_privlibexp@
280 perl_useshrplib         = @perl_useshrplib@
281 perl_embed_ldflags      = @perl_embed_ldflags@
282
283 # Miscellaneous
284
285 AWK     = @AWK@
286 LN_S    = @LN_S@
287 MSGFMT  = @MSGFMT@
288 MSGFMT_FLAGS = @MSGFMT_FLAGS@
289 MSGMERGE = @MSGMERGE@
290 PYTHON  = @PYTHON@
291 TAR     = @TAR@
292 XGETTEXT = @XGETTEXT@
293
294 GZIP    = gzip
295 BZIP2   = bzip2
296
297 # Testing
298
299 PROVE = @PROVE@
300 PG_PROVE_FLAGS = --ext='.pl' -I $(top_srcdir)/src/test/perl/
301 PROVE_FLAGS = --verbose
302
303 define prove_installcheck
304 PATH="$(bindir):$$PATH" PGPORT='6$(DEF_PGPORT)' $(PROVE) $(PG_PROVE_FLAGS) $(PROVE_FLAGS)
305 endef
306
307 define prove_check
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)
311 endef
312
313 # Installation.
314
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)))
318
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
328
329 MKDIR_P = @MKDIR_P@
330
331 missing         = $(SHELL) $(top_srcdir)/config/missing
332
333 STRIP           = @STRIP@
334 STRIP_STATIC_LIB = @STRIP_STATIC_LIB@
335 STRIP_SHARED_LIB = @STRIP_SHARED_LIB@
336
337 # Documentation
338
339 have_docbook    = @have_docbook@
340 COLLATEINDEX    = @COLLATEINDEX@
341 DOCBOOKSTYLE    = @DOCBOOKSTYLE@
342 JADE                    = @JADE@
343 NSGMLS                  = @NSGMLS@
344 OSX                             = @OSX@
345 XSLTPROC                = @XSLTPROC@
346
347 # Code coverage
348
349 GCOV = @GCOV@
350 LCOV = @LCOV@
351 GENHTML = @GENHTML@
352
353 ifeq ($(enable_coverage),yes)
354 # ccache loses .gcno files
355 export CCACHE_DISABLE = 1
356 endif
357
358 # Feature settings
359
360 DEF_PGPORT = @default_port@
361 WANTED_LANGUAGES = @WANTED_LANGUAGES@
362
363
364 ##########################################################################
365 #
366 # Additional platform-specific settings
367 #
368
369 # Name of the "template"
370 PORTNAME= @PORTNAME@
371
372 build_os = @build_os@
373
374 host_tuple = @host@
375 host_os = @host_os@
376 host_cpu = @host_cpu@
377
378 # Make HAVE_IPV6 available for initdb script creation
379 HAVE_IPV6= @HAVE_IPV6@
380
381 # The HP-UX port makefile, for one, needs access to this symbol
382 HAVE_POSIX_SIGNALS= @HAVE_POSIX_SIGNALS@
383
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@
387
388 # Backend stack size limit has to be hard-wired on Windows (it's in bytes)
389 WIN32_STACK_RLIMIT=4194304
390
391 # Set if we have a working win32 crashdump header
392 have_win32_dbghelp = @have_win32_dbghelp@
393
394 # Pull in platform-specific magic
395 include $(top_builddir)/src/Makefile.port
396
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.
399 rpathdir = $(libdir)
400
401 ifeq ($(enable_rpath), yes)
402 LDFLAGS += $(rpath)
403 endif
404
405
406 ##########################################################################
407 #
408 # Some variables needed to find some client interfaces
409
410 ifdef PGXS
411 # some contribs assumes headers and libs are in the source tree...
412 libpq_srcdir = $(includedir)
413 libpq_builddir = $(libdir)
414 else
415 libpq_srcdir = $(top_srcdir)/src/interfaces/libpq
416 libpq_builddir = $(top_builddir)/src/interfaces/libpq
417 endif
418
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
422
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.
430 ifdef PGXS
431 libpq_pgport = -L$(libdir) -lpgcommon -lpgport $(libpq)
432 else
433 libpq_pgport = -L$(top_builddir)/src/common -lpgcommon -L$(top_builddir)/src/port -lpgport $(libpq)
434 endif
435
436 # Cygwin seems to need ldap libraries to be mentioned here, too
437 ifeq ($(PORTNAME),cygwin)
438 libpq_pgport += $(LDAP_LIBS_FE)
439 endif
440
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.
444 ifndef PGXS
445 submake-libpq:
446         $(MAKE) -C $(libpq_builddir) all
447 else
448 submake-libpq: $(libdir)/libpq.so ;
449 endif
450
451 ifndef PGXS
452 submake-libpgport:
453         $(MAKE) -C $(top_builddir)/src/port all
454         $(MAKE) -C $(top_builddir)/src/common all
455 else
456 submake-libpgport: $(libdir)/libpgport.a $(libdir)/libpgcommon.a ;
457 endif
458
459 .PHONY: submake-libpq submake-libpgport
460
461
462 ##########################################################################
463 #
464 # Testing support
465
466 PL_TESTDB = pl_regression
467 CONTRIB_TESTDB = contrib_regression
468 ifneq ($(MODULE_big),)
469   CONTRIB_TESTDB_MODULE = contrib_regression_$(MODULE_big)
470 else
471   ifneq ($(MODULES),)
472     CONTRIB_TESTDB_MODULE = contrib_regression_$(MODULES)
473   else
474     CONTRIB_TESTDB_MODULE = contrib_regression
475   endif
476 endif
477
478 ifdef NO_LOCALE
479 NOLOCALE += --no-locale
480 endif
481
482 pg_regress_locale_flags = $(if $(ENCODING),--encoding=$(ENCODING)) $(NOLOCALE)
483
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)
486
487 pg_regress_clean_files = results/ regression.diffs regression.out tmp_check/ log/
488
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)
491
492 ##########################################################################
493 #
494 # Customization
495 #
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.
499 #
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.
505
506 -include $(top_srcdir)/src/Makefile.custom
507
508 ifneq ($(CUSTOM_INSTALL),)
509 INSTALL= $(CUSTOM_INSTALL)
510 endif
511
512 ifneq ($(CUSTOM_CC),)
513   CC= $(CUSTOM_CC)
514 endif
515
516 ifneq ($(CUSTOM_COPT),)
517   COPT= $(CUSTOM_COPT)
518 endif
519
520 ifdef COPT
521    CFLAGS += $(COPT)
522    LDFLAGS += $(COPT)
523 endif
524
525 ifdef PROFILE
526    CFLAGS += $(PROFILE)
527    LDFLAGS += $(PROFILE)
528 endif
529
530
531 ##########################################################################
532 #
533 # substitute implementations of C library routines (see src/port/)
534 # note we already included -L.../src/port in LDFLAGS above
535
536 LIBOBJS = @LIBOBJS@
537
538 LIBS := -lpgcommon -lpgport $(LIBS)
539
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
544 endif
545
546 # Not really standard libc functions, used by the backend.
547 TAS         = @TAS@
548
549
550 ##########################################################################
551 #
552 # Global targets and rules
553
554 %.c: %.l
555 ifdef FLEX
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)
558 else
559         @$(missing) flex $< '$@'
560 endif
561
562 %.c: %.y
563         $(if $(BISON_CHECK_CMD),$(BISON_CHECK_CMD))
564 ifdef BISON
565         $(BISON) $(BISONFLAGS) -o $@ $<
566 else
567         @$(missing) bison $< $@
568 endif
569
570 %.i: %.c
571         $(CPP) $(CPPFLAGS) -o $@ $<
572
573 %.gz: %
574         $(GZIP) --best -c $< >$@
575
576 %.bz2: %
577         $(BZIP2) -c $< >$@
578
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.
583 %: %.c
584
585 ifndef PGXS
586
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
590 # shortcut thereof.
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
593
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!)
601 #
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 ;
605
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
608
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 ;
611
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
614
615 # Also remake ecpg_config.h from ecpg_config.h.in if the latter changed, same
616 # logic as above.
617 $(top_builddir)/src/interfaces/ecpg/include/ecpg_config.h: $(top_builddir)/src/interfaces/ecpg/include/stamp-h ;
618
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
621
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
626
627 endif # not PGXS
628
629
630 install-strip:
631 # install-strip always uses install-sh, so that strip options can be
632 # passed.
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 \
638             install
639
640
641 ##########################################################################
642 #
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
648 # correctly.
649
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.
653 ifndef .VARIABLES
654 $(error GNU make 3.80 or newer is required.  You are using version $(MAKE_VERSION))
655 endif
656
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
665 # $2: subdir name
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
670 $(1)-$(2)-recurse:
671         $$(MAKE) -C $(2) $(3)
672 endef
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.
676
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))))))
683
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))))))
693
694
695 ##########################################################################
696 #
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.
705
706 autodepend = @autodepend@
707
708 ifeq ($(autodepend), yes)
709
710 ifndef COMPILE.c
711 COMPILE.c = $(CC) $(CFLAGS) $(CPPFLAGS) -c
712 endif
713
714 DEPDIR = .deps
715
716 ifeq ($(GCC), yes)
717
718 # GCC allows us to create object and dependency file in one invocation.
719 %.o : %.c
720         @if test ! -d $(DEPDIR); then mkdir -p $(DEPDIR); fi
721         $(COMPILE.c) -o $@ $< -MMD -MP -MF $(DEPDIR)/$(*F).Po
722
723 endif # GCC
724
725 # Include all the dependency files generated for the current
726 # directory. Note that make would complain if include was called with
727 # no arguments.
728 Po_files := $(wildcard $(DEPDIR)/*.Po)
729 ifneq (,$(Po_files))
730 include $(Po_files)
731 endif
732
733 # hook for clean-up
734 clean distclean maintainer-clean: clean-deps
735
736 .PHONY: clean-deps
737 clean-deps:
738         @rm -rf $(DEPDIR)
739
740 endif # autodepend
741
742
743 ##########################################################################
744 #
745 # Native language support
746
747 ifeq ($(enable_nls), yes)
748 ifneq (,$(wildcard $(srcdir)/nls.mk))
749
750 include $(top_srcdir)/src/nls-global.mk
751
752 endif # nls.mk
753 endif # enable_nls
754
755
756 ##########################################################################
757 #
758 # Coverage
759
760 # Explanation of involved files:
761 #   foo.c       source file
762 #   foo.o       object file
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
770 #               interesting
771 #   lcov.info   lcov tracefile, built from gcda files in one directory,
772 #               later collected by "make coverage-html"
773
774 ifeq ($(enable_coverage), yes)
775
776 # There is a strange interaction between lcov and existing .gcov
777 # output files.  Hence the rm command and the ordering dependency.
778
779 gcda_files := $(wildcard *.gcda)
780
781 lcov.info: $(gcda_files)
782         rm -f *.gcov
783         $(if $^,$(LCOV) -d . -c -o $@ $(LCOVFLAGS) --gcov-tool $(GCOV))
784
785 %.c.gcov: %.gcda | lcov.info
786         $(GCOV) -b -f -p -o . $(GCOVFLAGS) $*.c >$*.c.gcov.out
787
788 coverage: $(gcda_files:.gcda=.c.gcov) lcov.info
789
790 .PHONY: coverage-html
791 coverage-html: coverage
792         rm -rf coverage
793         mkdir coverage
794         $(GENHTML) --show-details --legend --output-directory=coverage --title=PostgreSQL --num-spaces=4 --prefix=$(abs_top_srcdir) `find . -name lcov.info -print`
795
796
797 # hook for clean-up
798 clean distclean maintainer-clean: clean-coverage
799
800 .PHONY: clean-coverage
801 clean-coverage:
802         rm -rf coverage
803         rm -f *.gcda *.gcno lcov.info *.gcov *.gcov.out
804
805
806 # User-callable target to reset counts between test runs
807 coverage-clean:
808         rm -f `find . -name '*.gcda' -print`
809
810 endif # enable_coverage