2
# $PostgreSQL: pgsql/src/Makefile.global.in,v 1.208.4.4 2005-03-25 18:18:39 momjian 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
# docdir can be an empty string to signify --without-docdir
110
ifeq "$(findstring pgsql, $(docdir))" ""
111
ifeq "$(findstring postgres, $(docdir))" ""
112
override docdir := $(docdir)/postgresql
117
localedir := @localedir@
119
pgxsdir = $(pkglibdir)/pgxs
122
##########################################################################
126
# Records the choice of the various --enable-xxx and --with-xxx options.
128
with_perl = @with_perl@
129
with_python = @with_python@
130
with_tcl = @with_tcl@
131
enable_shared = @enable_shared@
132
enable_rpath = @enable_rpath@
133
enable_nls = @enable_nls@
134
enable_debug = @enable_debug@
135
enable_thread_safety = @enable_thread_safety@
137
python_includespec = @python_includespec@
138
python_libdir = @python_libdir@
139
python_libspec = @python_libspec@
140
python_additional_libs = @python_additional_libs@
141
python_configdir = @python_configdir@
142
python_version = @python_version@
144
krb_srvtab = @krb_srvtab@
147
TCL_LIB_FILE = @TCL_LIB_FILE@
148
TCL_LIBS = @TCL_LIBS@
149
TCL_LIB_SPEC = @TCL_LIB_SPEC@
150
TCL_INCLUDE_SPEC = @TCL_INCLUDE_SPEC@
151
TCL_SHARED_BUILD = @TCL_SHARED_BUILD@
152
TCL_SHLIB_LD_LIBS = @TCL_SHLIB_LD_LIBS@
155
TK_LIB_SPEC = @TK_LIB_SPEC@
156
TK_XINCLUDES = @TK_XINCLUDES@
158
PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
159
PTHREAD_LIBS = @PTHREAD_LIBS@
161
have_docbook = @have_docbook@
162
DOCBOOKSTYLE = @DOCBOOKSTYLE@
163
COLLATEINDEX = @COLLATEINDEX@
166
##########################################################################
173
CPPFLAGS = @CPPFLAGS@
176
override CPPFLAGS := -I$(includedir_server) -I$(includedir_internal) $(CPPFLAGS)
178
override CPPFLAGS := -I$(top_srcdir)/src/include $(CPPFLAGS)
180
override CPPFLAGS := -I$(top_builddir)/src/include $(CPPFLAGS)
193
FLEXFLAGS = @FLEXFLAGS@ $(LFLAGS)
199
with_gnu_ld = @with_gnu_ld@
200
ld_R_works = @ld_R_works@
202
LDFLAGS_SL = @LDFLAGS_SL@
211
# quoted for pathname with spaces
213
perl_archlibexp = @perl_archlibexp@
214
perl_privlibexp = @perl_privlibexp@
215
perl_useshrplib = @perl_useshrplib@
216
perl_embed_ldflags = @perl_embed_ldflags@
223
MSGMERGE = @MSGMERGE@
226
XGETTEXT = @XGETTEXT@
233
INSTALL = $(SHELL) $(top_srcdir)/config/install-sh -c
235
INSTALL_PROGRAM = $(INSTALL_PROGRAM_ENV) $(INSTALL) $(INSTALL_STRIP_FLAG)
236
INSTALL_SCRIPT = $(INSTALL) -m 755
237
INSTALL_DATA = $(INSTALL) -m 644
238
INSTALL_STLIB = $(INSTALL_STLIB_ENV) $(INSTALL_DATA) $(INSTALL_STRIP_FLAG)
239
INSTALL_SHLIB = $(INSTALL_SHLIB_ENV) $(INSTALL) $(INSTALL_SHLIB_OPTS) $(INSTALL_STRIP_FLAG)
240
# Override in Makefile.port if necessary
241
INSTALL_SHLIB_OPTS = -m 755
243
mkinstalldirs = $(SHELL) $(top_srcdir)/config/mkinstalldirs
244
missing = $(SHELL) $(top_srcdir)/config/missing
247
STRIP_STATIC_LIB = @STRIP_STATIC_LIB@
248
STRIP_SHARED_LIB = @STRIP_SHARED_LIB@
258
DEF_PGPORT = @default_port@
259
WANTED_LANGUAGES = @WANTED_LANGUAGES@
262
##########################################################################
264
# Additional platform-specific settings
267
# Name of the "template"
272
host_cpu = @host_cpu@
274
# Make HAVE_IPV6 available for initdb script creation
275
HAVE_IPV6= @HAVE_IPV6@
277
# The HP-UX port makefile, for one, needs access to this symbol
278
HAVE_POSIX_SIGNALS= @HAVE_POSIX_SIGNALS@
280
# This is mainly for use on FreeBSD, where we have both a.out and elf
281
# systems now. May be applicable to other systems to?
282
ELF_SYSTEM= @ELF_SYS@
284
# Pull in platform-specific magic
285
include $(top_builddir)/src/Makefile.port
287
# Set up rpath if enabled. By default it will point to our libdir,
288
# but individual Makefiles can force other rpath paths if needed.
291
ifeq ($(enable_rpath), yes)
296
##########################################################################
298
# Some variables needed to find some client interfaces
301
# some contribs assumes headers and libs are in the source tree...
302
libpq_srcdir = $(includedir)
303
libpq_builddir = $(libdir)
305
libpq_srcdir = $(top_srcdir)/src/interfaces/libpq
306
libpq_builddir = $(top_builddir)/src/interfaces/libpq
309
# This is for use for libraries linking to libpq. Because libpqport
310
# isn't created with the same link flags as libpq, it can't be used.
311
libpq = -L$(libpq_builddir) -lpq
313
# If doing static linking, shared library dependency can't be
314
# used so we specify pthread libs for every usage of libpq
315
ifeq ($(enable_shared), no)
316
libpq += $(PTHREAD_LIBS)
318
# AIX libraries do not remember their required libs so we have to force
319
# thread dependent libraires in the link
320
ifeq ($(PORTNAME), aix)
321
libpq += $(PTHREAD_LIBS)
325
# Force clients to pull symbols from the non-shared library libpgport
326
# rather than pulling some libpgport symbols from libpq just because
327
# libpq uses those functions too. This makes applications less
328
# dependent on changes in libpq's usage of pgport. To do this we link to
329
# pgport before libpq. This does cause duplicate -lpgport's to appear
330
# on client link lines.
332
libpq_pgport = -L$(libdir) -lpgport $(libpq)
334
libpq_pgport = -L$(top_builddir)/src/port -lpgport $(libpq)
339
$(MAKE) -C $(libpq_builddir) all
342
$(MAKE) -C $(top_builddir)/src/port all
344
.PHONY: submake-libpq submake-libpgport
347
##########################################################################
351
# This includes your local customizations if Makefile.custom exists
352
# in the source directory. This file doesn't exist in the original
353
# distribution so that it doesn't get overwritten when you upgrade.
355
# NOTE: Makefile.custom is from the pre-Autoconf days of PostgreSQL.
356
# You are liable to shoot yourself in the foot if you use it without
357
# knowing exactly what you're doing. The preferred (and more
358
# reliable) method is to communicate what you want to do to the
359
# configure script, and leave the makefiles alone.
361
-include $(top_srcdir)/src/Makefile.custom
363
ifneq ($(CUSTOM_INSTALL),)
364
INSTALL= $(CUSTOM_INSTALL)
367
ifneq ($(CUSTOM_CC),)
371
ifneq ($(CUSTOM_COPT),)
382
LDFLAGS += $(PROFILE)
386
##########################################################################
388
# substitute implementations of the C library
390
LIBOBJS = @LIBOBJS@ dirmod.o exec.o noblock.o path.o pipe.o pgsleep.o pgstrcasecmp.o sprompt.o thread.o
393
LIBS := -lpgport $(LIBS)
395
# where libpgport.a is installed
396
override LDFLAGS := -L$(libdir) $(LDFLAGS)
398
override LDFLAGS := -L$(top_builddir)/src/port $(LDFLAGS)
402
# to make ws2_32.lib the last library, and always link with shfolder,
403
# so SHGetFolderName isn't picked up from shell32.dll
404
ifeq ($(PORTNAME),win32)
405
LIBS += -lws2_32 -lshfolder
408
# Not really standard libc functions, used by the backend.
412
##########################################################################
414
# Global targets and rules
422
ifeq ($(PORTNAME),win32)
423
# Build rules to add versioninfo resources to win32 binaries
424
WIN32RES += win32ver.o
425
ifeq ($(PGFILESHLIB),1)
430
ifneq (,$(PGAPPICON))
431
PGICOSTR=$(subst /,\/,IDI_ICON ICON \"$(top_builddir)/src/port/$(PGAPPICON).ico\")
433
win32ver.rc: $(top_builddir)/src/port/win32ver.rc
434
sed -e 's;FILEDESC;$(PGFILEDESC);' -e 's;VFT_APP;$(PGFTYPE);' -e 's;_ICO_;$(PGICOSTR);' -e 's;\(VERSION.*\),0 *$$;\1,'`date '+%y%j' | sed 's/^0*//'`';' $(top_builddir)/src/port/win32ver.rc > win32ver.rc
435
win32ver.o: $(top_builddir)/src/port/win32ver.rc
436
sed -e 's;FILEDESC;$(PGFILEDESC);' -e 's;VFT_APP;$(PGFTYPE);' -e 's;_ICO_;$(PGICOSTR);' -e 's;\(VERSION.*\),0 *$$;\1,'`date '+%y%j' | sed 's/^0*//'`';' $(top_builddir)/src/port/win32ver.rc > win32ver.rc
437
windres -i win32ver.rc -o win32ver.o --include-dir=$(top_builddir)/src/include
443
# Remake Makefile.global from Makefile.global.in if the latter
444
# changed. In order to trigger this rule, the including file must
445
# write `include $(top_builddir)/src/Makefile.global', not some
447
$(top_builddir)/src/Makefile.global: $(top_srcdir)/src/Makefile.global.in $(top_builddir)/config.status
448
cd $(top_builddir) && ./config.status src/Makefile.global
450
# Remake pg_config.h from pg_config.h.in if the latter changed.
451
# config.status will not change the timestamp on pg_config.h if it
452
# doesn't change, so as to avoid recompiling the entire tree
453
# unnecessarily. Therefore we make config.status update a timestamp file
454
# stamp-h everytime it runs, so that we don't trigger this rule everytime.
455
# (We do trigger the null rule for stamp-h to pg_config.h everytime; so it's
456
# important for that rule to be null!)
458
# Of course you need to turn on dependency tracking to get any
459
# dependencies on pg_config.h.
460
$(top_builddir)/src/include/pg_config.h: $(top_builddir)/src/include/stamp-h
462
$(top_builddir)/src/include/stamp-h: $(top_srcdir)/src/include/pg_config.h.in $(top_builddir)/config.status
463
cd $(top_builddir) && ./config.status src/include/pg_config.h
465
# When configure changes, rerun configure with the same options as
466
# last time. To change configure, you need to run autoconf manually.
467
$(top_builddir)/config.status: $(top_srcdir)/configure
468
cd $(top_builddir) && ./config.status --recheck
474
@$(MAKE) INSTALL_PROGRAM_ENV="STRIPPROG='$(STRIP)'" \
475
INSTALL_STLIB_ENV="STRIPPROG='$(STRIP_STATIC_LIB)'" \
476
INSTALL_SHLIB_ENV="STRIPPROG='$(STRIP_SHARED_LIB)'" \
477
INSTALL_STRIP_FLAG=-s \
481
##########################################################################
483
# Automatic dependency generation
484
# -------------------------------
485
# When we configure with --enable-depend then we override the default
486
# compilation rule with the magic below. While or after creating the
487
# actual output file we also create a dependency list for the .c file.
488
# Next time we invoke make we will have top-notch information about
489
# whether this file needs to be updated. The dependency files are kept
490
# in the .deps subdirectory of each directory.
492
# The sed command is necessary to post-process the dependency file:
493
# Each dependency file becomes a target of its own, without
494
# dependencies or commands. This is because if you happen to remove a
495
# file that is a dependency (say, you rename a header file) the
496
# dependency would point to a non-existing file and make would fail.
497
# But if the file is listed as a target of its own, without
498
# prerequisites and commands, and doesn't exist then make will
499
# consider it updated. (That in turn also has the nice side effect
500
# that make will update all files that depended on the now removed
503
autodepend = @autodepend@
505
ifeq ($(autodepend), yes)
508
COMPILE.c = $(CC) $(CFLAGS) $(CPPFLAGS) -c
514
# This converts a .d file in the current directory to a .P file in the .deps
515
# subdirectory, with the dummy targets as explained above.
516
define postprocess-depend
517
@if test ! -d $(DEPDIR); then mkdir $(DEPDIR); fi
519
@sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \
520
-e '/^$$/ d' -e 's/$$/ :/' < $*.d >> $(df).P
526
# GCC allows us to create object and dependency file in one invocation.
528
$(COMPILE.c) -o $@ $< -MMD
529
$(postprocess-depend)
533
# Include all the dependency files generated for the current
534
# directory. List /dev/null as dummy because if the wildcard expands
535
# to nothing then make would complain.
536
-include $(wildcard $(DEPDIR)/*.P) /dev/null
539
clean distclean maintainer-clean: clean-deps
543
@rm -rf $(DEPDIR) *.d
548
##########################################################################
550
# Native language support
552
ifeq ($(enable_nls), yes)
553
ifneq (,$(wildcard $(srcdir)/nls.mk))
555
include $(top_srcdir)/src/nls-global.mk