2 # $Header: /cvsroot/pgsql/src/Makefile.global.in,v 1.138 2001/09/17 23:00:27 petere 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 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
34 # Support for VPATH builds
35 abs_top_srcdir = @abs_top_srcdir@
38 top_srcdir = $(top_builddir)
41 top_srcdir = $(abs_top_srcdir)
42 srcdir = $(top_srcdir)/$(subdir)
47 ##########################################################################
49 # Installation directories
51 # These are set by the equivalent --xxxdir configure options. We
52 # append "postgresql" to some of them, if the string does not already
53 # contain "pgsql" or "postgres", in order to avoid directory clutter.
56 exec_prefix := @exec_prefix@
61 libexecdir := @libexecdir@
62 ifeq "$(findstring pgsql, $(libexecdir))" ""
63 ifeq "$(findstring postgres, $(libexecdir))" ""
64 override libexecdir := $(libexecdir)/postgresql
69 ifeq "$(findstring pgsql, $(datadir))" ""
70 ifeq "$(findstring postgres, $(datadir))" ""
71 override datadir := $(datadir)/postgresql
75 sysconfdir := @sysconfdir@
76 ifeq "$(findstring pgsql, $(sysconfdir))" ""
77 ifeq "$(findstring postgres, $(sysconfdir))" ""
78 override sysconfdir := $(sysconfdir)/postgresql
84 ifeq "$(findstring pgsql, $(pkglibdir))" ""
85 ifeq "$(findstring postgres, $(pkglibdir))" ""
86 override pkglibdir := $(pkglibdir)/postgresql
90 includedir := @includedir@
91 pkgincludedir = $(includedir)
92 ifeq "$(findstring pgsql, $(pkgincludedir))" ""
93 ifeq "$(findstring postgres, $(pkgincludedir))" ""
94 override pkgincludedir := $(pkgincludedir)/postgresql
97 includedir_server = $(pkgincludedir)/server
98 includedir_internal = $(pkgincludedir)/internal
104 ifeq "$(findstring pgsql, $(docdir))" ""
105 ifeq "$(findstring postgres, $(docdir))" ""
106 override docdir := $(docdir)/postgresql
110 odbcinst_ini_dir = @odbcinst_ini_dir@
112 javadir := $(DESTDIR)$(datadir)/java
113 localedir := @localedir@
116 ##########################################################################
120 # Records the choice of the various --enable-xxx and --with-xxx options.
122 with_CXX = @with_CXX@
123 with_java = @with_java@
124 with_perl = @with_perl@
125 with_python = @with_python@
126 with_tcl = @with_tcl@
127 enable_pltcl_unknown = @enable_pltcl_unknown@
129 enable_odbc = @enable_odbc@
130 MULTIBYTE = @MULTIBYTE@
131 enable_shared = @enable_shared@
132 enable_rpath = @enable_rpath@
133 enable_nls = @enable_nls@
135 python_version = @python_version@
136 python_includespec = @python_includespec@
137 python_moduledir = @python_moduledir@
138 python_moduleexecdir = @python_moduleexecdir@
139 python_libspec = @python_libspec@
140 python_configdir = @python_configdir@
142 krb_srvtab = @krb_srvtab@
144 TCL_CONFIG_SH = @TCL_CONFIG_SH@
145 TK_CONFIG_SH = @TK_CONFIG_SH@
148 have_docbook = @have_docbook@
149 DOCBOOKSTYLE = @DOCBOOKSTYLE@
152 ##########################################################################
159 CPPFLAGS = @CPPFLAGS@
160 override CPPFLAGS := -I$(top_srcdir)/src/include $(CPPFLAGS)
162 override CPPFLAGS := -I$(top_builddir)/src/include $(CPPFLAGS)
169 CFLAGS += -Wall -Wmissing-prototypes -Wmissing-declarations
174 CXXFLAGS = @CXXFLAGS@
184 FLEXFLAGS = @FLEXFLAGS@ $(LFLAGS)
190 with_gnu_ld = @with_gnu_ld@
191 ld_R_works = @ld_R_works@
202 perl_installsitearch = @perl_installsitearch@
203 perl_installsitelib = @perl_installsitelib@
204 perl_installman3dir = @perl_installman3dir@
212 MSGMERGE = @MSGMERGE@
216 XGETTEXT = @XGETTEXT@
223 INSTALL = $(SHELL) $(top_srcdir)/config/install-sh -c
225 INSTALL_PROGRAM = $(INSTALL)
226 INSTALL_SCRIPT = $(INSTALL) -m 755
227 INSTALL_DATA = $(INSTALL) -m 644
228 INSTALL_SHLIB = $(INSTALL) $(INSTALL_SHLIB_OPTS)
229 # Override in Makefile.port if necessary
230 INSTALL_SHLIB_OPTS = -m 755
232 mkinstalldirs = $(SHELL) $(top_srcdir)/config/mkinstalldirs
233 missing = $(SHELL) $(top_srcdir)/config/missing
243 DEF_PGPORT = @default_port@
244 WANTED_LANGUAGES = @WANTED_LANGUAGES@
247 ##########################################################################
249 # Additional platform-specific settings
252 # Name of the "template"
257 host_cpu = @host_cpu@
259 # Grungy things needed for HP-UX
260 HAVE_POSIX_SIGNALS= @HAVE_POSIX_SIGNALS@
261 HPUXMATHLIB= @HPUXMATHLIB@
263 # This is mainly for use on FreeBSD, where we have both a.out and elf
264 # systems now. May be applicable to other systems to?
265 ELF_SYSTEM= @ELF_SYS@
267 # Pull in platform-specific magic
268 include $(top_builddir)/src/Makefile.port
270 ifeq ($(enable_rpath), yes)
274 ##########################################################################
276 # Some variables needed to find some client interfaces
278 libpq_srcdir = $(top_srcdir)/src/interfaces/libpq
279 libpq_builddir = $(top_builddir)/src/interfaces/libpq
280 libpq = -L$(libpq_builddir) -lpq
283 ##########################################################################
287 # This includes your local customizations if Makefile.custom exists
288 # in the source directory. This file doesn't exist in the original
289 # distribution so that it doesn't get overwritten when you upgrade.
291 # NOTE: Makefile.custom is from the pre-Autoconf days of PostgreSQL.
292 # You are liable to shoot yourself in the foot if you use it without
293 # knowing exactly what you're doing. The preferred (and more
294 # reliable) method is to communicate what you want to do to the
295 # configure script, and leave the makefiles alone.
297 -include $(top_srcdir)/src/Makefile.custom
299 ifneq ($(CUSTOM_INSTALL),)
300 INSTALL= $(CUSTOM_INSTALL)
303 ifneq ($(CUSTOM_CC),)
307 ifneq ($(CUSTOM_COPT),)
322 ##########################################################################
324 # substitute implementations of the C library
326 INET_ATON = @INET_ATON@
327 STRERROR = @STRERROR@
328 SNPRINTF = @SNPRINTF@
333 ##########################################################################
335 # Global targets and rules
343 # Remake Makefile.global from Makefile.global.in if the latter
344 # changed. In order to trigger this rule, the including file must
345 # write `include $(top_builddir)/src/Makefile.global', not some
347 $(top_builddir)/src/Makefile.global: $(top_srcdir)/src/Makefile.global.in $(top_builddir)/config.status
348 cd $(top_builddir) && CONFIG_FILES=src/Makefile.global CONFIG_HEADERS= ./config.status
350 # Remake pg_config.h from pg_config.h.in if the latter changed.
351 # config.status will not change the timestamp on pg_config.h if it
352 # doesn't change, so as to avoid recompiling the entire tree
353 # unnecessarily. Therefore we make config.status update a timestamp file
354 # stamp-h everytime it runs, so that we don't trigger this rule everytime.
355 # (We do trigger the null rule for stamp-h to pg_config.h everytime; so it's
356 # important for that rule to be null!)
358 # Of course you need to turn on dependency tracking to get any
359 # dependencies on pg_config.h.
360 $(top_builddir)/src/include/pg_config.h: $(top_builddir)/src/include/stamp-h
362 $(top_builddir)/src/include/stamp-h: $(top_srcdir)/src/include/pg_config.h.in $(top_builddir)/config.status
363 cd $(top_builddir) && CONFIG_FILES= CONFIG_HEADERS=src/include/pg_config.h ./config.status
365 # When configure changes, rerun configure with the same options as
366 # last time. To change configure, you need to run autoconf manually.
367 $(top_builddir)/config.status: $(top_srcdir)/configure
368 cd $(top_builddir) && ./config.status --recheck
371 ##########################################################################
373 # Automatic dependency generation
374 # -------------------------------
375 # When we configure with --enable-depend then we override the default
376 # compilation rule with the magic below. While or after creating the
377 # actual output file we also create a dependency list for the .c file.
378 # Next time we invoke make we will have top-notch information about
379 # whether this file needs to be updated. The dependency files are kept
380 # in the .deps subdirectory of each directory.
382 # The sed command is necessary to post-process the dependency file:
383 # Each dependency file becomes a target of its own, without
384 # dependencies or commands. This is because if you happen to remove a
385 # file that is a dependency (say, you rename a header file) the
386 # dependency would point to a non-existing file and make would fail.
387 # But if the file is listed as a target of its own, without
388 # prerequisites and commands, and doesn't exist then make will
389 # consider it updated. (That in turn also has the nice side effect
390 # that make will update all files that depended on the now removed
393 autodepend = @autodepend@
395 ifeq ($(autodepend), yes)
398 COMPILE.c = $(CC) $(CFLAGS) $(CPPFLAGS) -c
402 COMPILE.cc = $(CXX) $(CXXFLAGS) $(CPPFLAGS) -c
408 # This converts a .d file in the current directory to a .P file in the .deps
409 # subdirectory, with the dummy targets as explained above.
410 define postprocess-depend
411 @if test ! -d $(DEPDIR); then mkdir $(DEPDIR); fi
413 @sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \
414 -e '/^$$/ d' -e 's/$$/ :/' < $*.d >> $(df).P
420 # GCC allows us to create object and dependency file in one invocation.
422 $(COMPILE.c) -o $@ $< -MMD
423 $(postprocess-depend)
430 $(COMPILE.cc) -o $@ $< -MMD
431 $(postprocess-depend)
435 # Include all the dependency files generated for the current
436 # directory. List /dev/null as dummy because if the wildcard expands
437 # to nothing then make would complain.
438 -include $(wildcard $(DEPDIR)/*.P) /dev/null
441 clean distclean maintainer-clean: clean-deps
445 @rm -rf $(DEPDIR) *.d
450 ##########################################################################
452 # Native language support
454 ifeq ($(enable_nls), yes)
455 ifneq (,$(wildcard $(srcdir)/nls.mk))
457 include $(top_srcdir)/src/nls-global.mk