2 # $PostgreSQL: pgsql/src/Makefile.global.in,v 1.181 2004/05/07 00:24:57 tgl Exp $
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
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 #------------------------------------------------------------------------------
17 ##########################################################################
21 .PHONY: all install install-strip installdirs uninstall clean distclean maintainer-clean distprep check installcheck maintainer-check
24 # make `all' the default target
27 # Delete target files if the command fails after it has
28 # started to update the file.
31 # PostgreSQL version number
32 VERSION = @PACKAGE_VERSION@
34 # Support for VPATH builds
35 vpath_build = @vpath_build@
36 abs_top_srcdir = @abs_top_srcdir@
38 ifneq ($(vpath_build),yes)
39 top_srcdir = $(top_builddir)
41 else # vpath_build = yes
42 top_srcdir = $(abs_top_srcdir)
43 srcdir = $(top_srcdir)/$(subdir)
47 # Saved arguments from configure
48 configure_args = @configure_args@
51 ##########################################################################
53 # Installation directories
55 # These are set by the equivalent --xxxdir configure options. We
56 # append "postgresql" to some of them, if the string does not already
57 # contain "pgsql" or "postgres", in order to avoid directory clutter.
60 exec_prefix := @exec_prefix@
65 libexecdir := @libexecdir@
66 ifeq "$(findstring pgsql, $(libexecdir))" ""
67 ifeq "$(findstring postgres, $(libexecdir))" ""
68 override libexecdir := $(libexecdir)/postgresql
73 ifeq "$(findstring pgsql, $(datadir))" ""
74 ifeq "$(findstring postgres, $(datadir))" ""
75 override datadir := $(datadir)/postgresql
79 sysconfdir := @sysconfdir@
80 ifeq "$(findstring pgsql, $(sysconfdir))" ""
81 ifeq "$(findstring postgres, $(sysconfdir))" ""
82 override sysconfdir := $(sysconfdir)/postgresql
88 ifeq "$(findstring pgsql, $(pkglibdir))" ""
89 ifeq "$(findstring postgres, $(pkglibdir))" ""
90 override pkglibdir := $(pkglibdir)/postgresql
94 includedir := @includedir@
95 pkgincludedir = $(includedir)
96 ifeq "$(findstring pgsql, $(pkgincludedir))" ""
97 ifeq "$(findstring postgres, $(pkgincludedir))" ""
98 override pkgincludedir := $(pkgincludedir)/postgresql
101 includedir_server = $(pkgincludedir)/server
102 includedir_internal = $(pkgincludedir)/internal
108 ifeq "$(findstring pgsql, $(docdir))" ""
109 ifeq "$(findstring postgres, $(docdir))" ""
110 override docdir := $(docdir)/postgresql
114 localedir := @localedir@
117 ##########################################################################
121 # Records the choice of the various --enable-xxx and --with-xxx options.
123 with_perl = @with_perl@
124 with_python = @with_python@
125 with_tcl = @with_tcl@
126 enable_shared = @enable_shared@
127 enable_rpath = @enable_rpath@
128 enable_nls = @enable_nls@
129 enable_debug = @enable_debug@
130 enable_thread_safety = @enable_thread_safety@
132 python_includespec = @python_includespec@
133 python_libspec = @python_libspec@
134 python_configdir = @python_configdir@
136 krb_srvtab = @krb_srvtab@
139 TCL_LIB_FILE = @TCL_LIB_FILE@
140 TCL_LIBS = @TCL_LIBS@
141 TCL_LIB_SPEC = @TCL_LIB_SPEC@
142 TCL_INCLUDE_SPEC = @TCL_INCLUDE_SPEC@
143 TCL_SHARED_BUILD = @TCL_SHARED_BUILD@
144 TCL_SHLIB_LD_LIBS = @TCL_SHLIB_LD_LIBS@
147 TK_LIB_SPEC = @TK_LIB_SPEC@
148 TK_XINCLUDES = @TK_XINCLUDES@
150 USE_PGTZ = @USE_PGTZ@
152 PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
153 PTHREAD_LIBS = @PTHREAD_LIBS@
155 have_docbook = @have_docbook@
156 DOCBOOKSTYLE = @DOCBOOKSTYLE@
157 COLLATEINDEX = @COLLATEINDEX@
160 ##########################################################################
167 CPPFLAGS = @CPPFLAGS@
168 override CPPFLAGS := -I$(top_srcdir)/src/include $(CPPFLAGS)
170 override CPPFLAGS := -I$(top_builddir)/src/include $(CPPFLAGS)
177 CFLAGS += -Wall -Wmissing-prototypes -Wmissing-declarations
185 FLEXFLAGS = @FLEXFLAGS@ $(LFLAGS)
191 with_gnu_ld = @with_gnu_ld@
192 ld_R_works = @ld_R_works@
203 perl_archlibexp = @perl_archlibexp@
204 perl_privlibexp = @perl_privlibexp@
205 perl_useshrplib = @perl_useshrplib@
206 perl_embed_ldflags = @perl_embed_ldflags@
213 MSGMERGE = @MSGMERGE@
216 XGETTEXT = @XGETTEXT@
223 INSTALL = $(SHELL) $(top_srcdir)/config/install-sh -c
225 INSTALL_PROGRAM = $(INSTALL_PROGRAM_ENV) $(INSTALL) $(INSTALL_STRIP_FLAG)
226 INSTALL_SCRIPT = $(INSTALL) -m 755
227 INSTALL_DATA = $(INSTALL) -m 644
228 INSTALL_STLIB = $(INSTALL_STLIB_ENV) $(INSTALL_DATA) $(INSTALL_STRIP_FLAG)
229 INSTALL_SHLIB = $(INSTALL_SHLIB_ENV) $(INSTALL) $(INSTALL_SHLIB_OPTS) $(INSTALL_STRIP_FLAG)
230 # Override in Makefile.port if necessary
231 INSTALL_SHLIB_OPTS = -m 755
233 mkinstalldirs = $(SHELL) $(top_srcdir)/config/mkinstalldirs
234 missing = $(SHELL) $(top_srcdir)/config/missing
237 STRIP_STATIC_LIB = @STRIP_STATIC_LIB@
238 STRIP_SHARED_LIB = @STRIP_SHARED_LIB@
248 DEF_PGPORT = @default_port@
249 WANTED_LANGUAGES = @WANTED_LANGUAGES@
252 ##########################################################################
254 # Additional platform-specific settings
257 # Name of the "template"
262 host_cpu = @host_cpu@
264 # Make HAVE_IPV6 available for initdb script creation
265 HAVE_IPV6= @HAVE_IPV6@
267 # The HP-UX port makefile, for one, needs access to this symbol
268 HAVE_POSIX_SIGNALS= @HAVE_POSIX_SIGNALS@
270 # This is mainly for use on FreeBSD, where we have both a.out and elf
271 # systems now. May be applicable to other systems to?
272 ELF_SYSTEM= @ELF_SYS@
274 # Pull in platform-specific magic
275 include $(top_builddir)/src/Makefile.port
277 ifeq ($(enable_rpath), yes)
282 ##########################################################################
284 # Some variables needed to find some client interfaces
286 libpq_srcdir = $(top_srcdir)/src/interfaces/libpq
287 libpq_builddir = $(top_builddir)/src/interfaces/libpq
288 libpq = -L$(libpq_builddir) -lpq
291 $(MAKE) -C $(libpq_builddir) all
294 $(MAKE) -C $(top_builddir)/src/port all
296 .PHONY: submake-libpq submake-libpgport
299 ##########################################################################
303 # This includes your local customizations if Makefile.custom exists
304 # in the source directory. This file doesn't exist in the original
305 # distribution so that it doesn't get overwritten when you upgrade.
307 # NOTE: Makefile.custom is from the pre-Autoconf days of PostgreSQL.
308 # You are liable to shoot yourself in the foot if you use it without
309 # knowing exactly what you're doing. The preferred (and more
310 # reliable) method is to communicate what you want to do to the
311 # configure script, and leave the makefiles alone.
313 -include $(top_srcdir)/src/Makefile.custom
315 ifneq ($(CUSTOM_INSTALL),)
316 INSTALL= $(CUSTOM_INSTALL)
319 ifneq ($(CUSTOM_CC),)
323 ifneq ($(CUSTOM_COPT),)
338 ##########################################################################
340 # substitute implementations of the C library
342 LIBOBJS = @LIBOBJS@ noblock.o path.o pgsleep.o pgstrcasecmp.o sprompt.o thread.o
346 LDFLAGS := -L$(top_builddir)/src/port $(LDFLAGS)
349 # to make ws2_32.lib the last library
350 ifeq ($(PORTNAME),win32)
354 # Not really standard libc functions, used by the backend.
358 ##########################################################################
360 # Global targets and rules
368 # Remake Makefile.global from Makefile.global.in if the latter
369 # changed. In order to trigger this rule, the including file must
370 # write `include $(top_builddir)/src/Makefile.global', not some
372 $(top_builddir)/src/Makefile.global: $(top_srcdir)/src/Makefile.global.in $(top_builddir)/config.status
373 cd $(top_builddir) && ./config.status src/Makefile.global
375 # Remake pg_config.h from pg_config.h.in if the latter changed.
376 # config.status will not change the timestamp on pg_config.h if it
377 # doesn't change, so as to avoid recompiling the entire tree
378 # unnecessarily. Therefore we make config.status update a timestamp file
379 # stamp-h everytime it runs, so that we don't trigger this rule everytime.
380 # (We do trigger the null rule for stamp-h to pg_config.h everytime; so it's
381 # important for that rule to be null!)
383 # Of course you need to turn on dependency tracking to get any
384 # dependencies on pg_config.h.
385 $(top_builddir)/src/include/pg_config.h: $(top_builddir)/src/include/stamp-h
387 $(top_builddir)/src/include/stamp-h: $(top_srcdir)/src/include/pg_config.h.in $(top_builddir)/config.status
388 cd $(top_builddir) && ./config.status src/include/pg_config.h
390 # When configure changes, rerun configure with the same options as
391 # last time. To change configure, you need to run autoconf manually.
392 $(top_builddir)/config.status: $(top_srcdir)/configure
393 cd $(top_builddir) && ./config.status --recheck
397 @$(MAKE) INSTALL_PROGRAM_ENV="STRIPPROG='$(STRIP)'" \
398 INSTALL_STLIB_ENV="STRIPPROG='$(STRIP_STATIC_LIB)'" \
399 INSTALL_SHLIB_ENV="STRIPPROG='$(STRIP_SHARED_LIB)'" \
400 INSTALL_STRIP_FLAG=-s \
404 ##########################################################################
406 # Automatic dependency generation
407 # -------------------------------
408 # When we configure with --enable-depend then we override the default
409 # compilation rule with the magic below. While or after creating the
410 # actual output file we also create a dependency list for the .c file.
411 # Next time we invoke make we will have top-notch information about
412 # whether this file needs to be updated. The dependency files are kept
413 # in the .deps subdirectory of each directory.
415 # The sed command is necessary to post-process the dependency file:
416 # Each dependency file becomes a target of its own, without
417 # dependencies or commands. This is because if you happen to remove a
418 # file that is a dependency (say, you rename a header file) the
419 # dependency would point to a non-existing file and make would fail.
420 # But if the file is listed as a target of its own, without
421 # prerequisites and commands, and doesn't exist then make will
422 # consider it updated. (That in turn also has the nice side effect
423 # that make will update all files that depended on the now removed
426 autodepend = @autodepend@
428 ifeq ($(autodepend), yes)
431 COMPILE.c = $(CC) $(CFLAGS) $(CPPFLAGS) -c
437 # This converts a .d file in the current directory to a .P file in the .deps
438 # subdirectory, with the dummy targets as explained above.
439 define postprocess-depend
440 @if test ! -d $(DEPDIR); then mkdir $(DEPDIR); fi
442 @sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \
443 -e '/^$$/ d' -e 's/$$/ :/' < $*.d >> $(df).P
449 # GCC allows us to create object and dependency file in one invocation.
451 $(COMPILE.c) -o $@ $< -MMD
452 $(postprocess-depend)
456 # Include all the dependency files generated for the current
457 # directory. List /dev/null as dummy because if the wildcard expands
458 # to nothing then make would complain.
459 -include $(wildcard $(DEPDIR)/*.P) /dev/null
462 clean distclean maintainer-clean: clean-deps
466 @rm -rf $(DEPDIR) *.d
471 ##########################################################################
473 # Native language support
475 ifeq ($(enable_nls), yes)
476 ifneq (,$(wildcard $(srcdir)/nls.mk))
478 include $(top_srcdir)/src/nls-global.mk