]> granicus.if.org Git - postgresql/blob - src/Makefile.global.in
Force thread flags for all Unixware builds if threading is requested.
[postgresql] / src / Makefile.global.in
1 # -*-makefile-*-
2 # $PostgreSQL: pgsql/src/Makefile.global.in,v 1.183 2004/05/13 23:05:54 momjian Exp $
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 .PHONY: all install install-strip installdirs uninstall clean distclean maintainer-clean distprep check installcheck maintainer-check
22 .SILENT: installdirs
23
24 # make `all' the default target
25 all:
26
27 # Delete target files if the command fails after it has
28 # started to update the file.
29 .DELETE_ON_ERROR:
30
31 # PostgreSQL version number
32 VERSION = @PACKAGE_VERSION@
33
34 # Support for VPATH builds
35 vpath_build = @vpath_build@
36 abs_top_srcdir = @abs_top_srcdir@
37
38 ifneq ($(vpath_build),yes)
39 top_srcdir = $(top_builddir)
40 srcdir = .
41 else # vpath_build = yes
42 top_srcdir = $(abs_top_srcdir)
43 srcdir = $(top_srcdir)/$(subdir)
44 VPATH = $(srcdir)
45 endif
46
47 # Saved arguments from configure
48 configure_args = @configure_args@
49
50
51 ##########################################################################
52 #
53 # Installation directories
54 #
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.
58
59 prefix := @prefix@
60 exec_prefix := @exec_prefix@
61
62 bindir := @bindir@
63 sbindir := @sbindir@
64
65 libexecdir := @libexecdir@
66 ifeq "$(findstring pgsql, $(libexecdir))" ""
67 ifeq "$(findstring postgres, $(libexecdir))" ""
68 override libexecdir := $(libexecdir)/postgresql
69 endif
70 endif
71
72 datadir := @datadir@
73 ifeq "$(findstring pgsql, $(datadir))" ""
74 ifeq "$(findstring postgres, $(datadir))" ""
75 override datadir := $(datadir)/postgresql
76 endif
77 endif
78
79 sysconfdir := @sysconfdir@
80 ifeq "$(findstring pgsql, $(sysconfdir))" ""
81 ifeq "$(findstring postgres, $(sysconfdir))" ""
82 override sysconfdir := $(sysconfdir)/postgresql
83 endif
84 endif
85
86 libdir := @libdir@
87 pkglibdir = $(libdir)
88 ifeq "$(findstring pgsql, $(pkglibdir))" ""
89 ifeq "$(findstring postgres, $(pkglibdir))" ""
90 override pkglibdir := $(pkglibdir)/postgresql
91 endif
92 endif
93
94 includedir := @includedir@
95 pkgincludedir = $(includedir)
96 ifeq "$(findstring pgsql, $(pkgincludedir))" ""
97 ifeq "$(findstring postgres, $(pkgincludedir))" ""
98 override pkgincludedir := $(pkgincludedir)/postgresql
99 endif
100 endif
101 includedir_server = $(pkgincludedir)/server
102 includedir_internal = $(pkgincludedir)/internal
103
104 mandir := @mandir@
105 sqlmansect_dummy = l
106
107 docdir := @docdir@
108 ifeq "$(findstring pgsql, $(docdir))" ""
109 ifeq "$(findstring postgres, $(docdir))" ""
110 override docdir := $(docdir)/postgresql
111 endif
112 endif
113
114 localedir := @localedir@
115
116
117 ##########################################################################
118 #
119 # Features
120 #
121 # Records the choice of the various --enable-xxx and --with-xxx options.
122
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@
131
132 python_includespec      = @python_includespec@
133 python_libspec          = @python_libspec@
134 python_configdir        = @python_configdir@
135
136 krb_srvtab = @krb_srvtab@
137
138 TCLSH                   = @TCLSH@
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@
145
146 TK_LIBS                 = @TK_LIBS@
147 TK_LIB_SPEC             = @TK_LIB_SPEC@
148 TK_XINCLUDES            = @TK_XINCLUDES@
149
150 USE_PGTZ                = @USE_PGTZ@
151
152 PTHREAD_CFLAGS          = @PTHREAD_CFLAGS@
153 PTHREAD_LIBS            = @PTHREAD_LIBS@
154
155 have_docbook    = @have_docbook@
156 DOCBOOKSTYLE    = @DOCBOOKSTYLE@
157 COLLATEINDEX    = @COLLATEINDEX@
158
159
160 ##########################################################################
161 #
162 # Programs and flags
163
164 # Compilers
165
166 CPP = @CPP@
167 CPPFLAGS = @CPPFLAGS@
168 override CPPFLAGS := -I$(top_srcdir)/src/include $(CPPFLAGS)
169 ifdef VPATH
170 override CPPFLAGS := -I$(top_builddir)/src/include $(CPPFLAGS)
171 endif
172
173 CC = @CC@
174 GCC = @GCC@
175 CFLAGS = @CFLAGS@
176 ifeq ($(GCC), yes)
177   CFLAGS += -Wall -Wmissing-prototypes -Wmissing-declarations
178 endif
179
180 # Unixware needs threads for everything that uses libpq
181 ifeq ($(PORTNAME),unixware)
182   CFLAGS += "$PTHREAD_CFLAGS"
183 endif
184
185
186 # Kind-of compilers
187
188 YACC = @YACC@
189 YFLAGS = @YFLAGS@
190 FLEX = @FLEX@
191 FLEXFLAGS = @FLEXFLAGS@ $(LFLAGS)
192
193 # Linking
194
195 LIBS = @LIBS@
196 LD = @LD@
197 with_gnu_ld = @with_gnu_ld@
198 ld_R_works = @ld_R_works@
199 LDFLAGS = @LDFLAGS@
200 LDREL = -r
201 LDOUT = -o
202 RANLIB = @RANLIB@
203 LORDER = @LORDER@
204 X = @EXEEXT@
205
206 # Perl 
207
208 PERL                    = @PERL@
209 perl_archlibexp         = @perl_archlibexp@
210 perl_privlibexp         = @perl_privlibexp@
211 perl_useshrplib         = @perl_useshrplib@
212 perl_embed_ldflags      = @perl_embed_ldflags@
213
214 # Miscellaneous
215
216 AWK     = @AWK@
217 LN_S    = @LN_S@
218 MSGFMT  = @MSGFMT@
219 MSGMERGE = @MSGMERGE@
220 PYTHON  = @PYTHON@
221 TAR     = @TAR@
222 XGETTEXT = @XGETTEXT@
223
224 GZIP    = gzip
225 BZIP2   = bzip2
226
227 # Installation.
228
229 INSTALL = $(SHELL) $(top_srcdir)/config/install-sh -c
230
231 INSTALL_PROGRAM = $(INSTALL_PROGRAM_ENV) $(INSTALL) $(INSTALL_STRIP_FLAG)
232 INSTALL_SCRIPT  = $(INSTALL) -m 755
233 INSTALL_DATA    = $(INSTALL) -m 644
234 INSTALL_STLIB   = $(INSTALL_STLIB_ENV) $(INSTALL_DATA) $(INSTALL_STRIP_FLAG)
235 INSTALL_SHLIB   = $(INSTALL_SHLIB_ENV) $(INSTALL) $(INSTALL_SHLIB_OPTS) $(INSTALL_STRIP_FLAG)
236 # Override in Makefile.port if necessary
237 INSTALL_SHLIB_OPTS = -m 755
238
239 mkinstalldirs   = $(SHELL) $(top_srcdir)/config/mkinstalldirs
240 missing         = $(SHELL) $(top_srcdir)/config/missing
241
242 STRIP           = @STRIP@
243 STRIP_STATIC_LIB = @STRIP_STATIC_LIB@
244 STRIP_SHARED_LIB = @STRIP_SHARED_LIB@
245
246 # Documentation
247
248 JADE    = @JADE@
249 NSGMLS  = @NSGMLS@
250 SGMLSPL = @SGMLSPL@
251
252 # Feature settings
253
254 DEF_PGPORT = @default_port@
255 WANTED_LANGUAGES = @WANTED_LANGUAGES@
256
257
258 ##########################################################################
259 #
260 # Additional platform-specific settings
261 #
262
263 # Name of the "template"
264 PORTNAME= @PORTNAME@
265
266 host_tuple = @host@
267 host_os = @host_os@
268 host_cpu = @host_cpu@
269
270 # Make HAVE_IPV6 available for initdb script creation
271 HAVE_IPV6= @HAVE_IPV6@
272
273 # The HP-UX port makefile, for one, needs access to this symbol
274 HAVE_POSIX_SIGNALS= @HAVE_POSIX_SIGNALS@
275
276 # This is mainly for use on FreeBSD, where we have both a.out and elf
277 # systems now.  May be applicable to other systems to?
278 ELF_SYSTEM= @ELF_SYS@
279
280 # Pull in platform-specific magic
281 include $(top_builddir)/src/Makefile.port
282
283 ifeq ($(enable_rpath), yes)
284 LDFLAGS += $(rpath)
285 endif
286
287
288 ##########################################################################
289 #
290 # Some variables needed to find some client interfaces
291
292 libpq_srcdir = $(top_srcdir)/src/interfaces/libpq
293 libpq_builddir = $(top_builddir)/src/interfaces/libpq
294 libpq = -L$(libpq_builddir) -lpq
295
296 submake-libpq:
297         $(MAKE) -C $(libpq_builddir) all
298
299 submake-libpgport:
300         $(MAKE) -C $(top_builddir)/src/port all
301
302 .PHONY: submake-libpq submake-libpgport
303
304
305 ##########################################################################
306 #
307 # Customization
308 #
309 # This includes your local customizations if Makefile.custom exists
310 # in the source directory.  This file doesn't exist in the original
311 # distribution so that it doesn't get overwritten when you upgrade.
312 #
313 # NOTE:  Makefile.custom is from the pre-Autoconf days of PostgreSQL.
314 # You are liable to shoot yourself in the foot if you use it without
315 # knowing exactly what you're doing.  The preferred (and more
316 # reliable) method is to communicate what you want to do to the
317 # configure script, and leave the makefiles alone.
318
319 -include $(top_srcdir)/src/Makefile.custom
320
321 ifneq ($(CUSTOM_INSTALL),)
322 INSTALL= $(CUSTOM_INSTALL)
323 endif
324
325 ifneq ($(CUSTOM_CC),)
326   CC= $(CUSTOM_CC)
327 endif
328
329 ifneq ($(CUSTOM_COPT),)
330   COPT= $(CUSTOM_COPT)
331 endif
332
333 ifdef COPT
334    CFLAGS+= $(COPT)
335    LDFLAGS+= $(COPT)
336 endif
337
338 ifdef PROFILE
339    CFLAGS+= $(PROFILE)
340    LDFLAGS+= $(PROFILE)
341 endif
342
343
344 ##########################################################################
345 #
346 # substitute implementations of the C library
347
348 LIBOBJS = @LIBOBJS@ exec.o noblock.o path.o pipe.o pgsleep.o pgstrcasecmp.o sprompt.o thread.o
349
350 ifneq (,$(LIBOBJS))
351 LIBS += -lpgport
352 LDFLAGS := -L$(top_builddir)/src/port $(LDFLAGS)
353 endif
354
355 # to make ws2_32.lib the last library
356 ifeq ($(PORTNAME),win32)
357 LIBS += -lws2_32
358 endif
359
360 # Not really standard libc functions, used by the backend.
361 TAS         = @TAS@
362
363
364 ##########################################################################
365 #
366 # Global targets and rules
367
368 %.gz: %
369         $(GZIP) -f --best $<
370
371 %.bz2: %
372         $(BZIP2) -f $<
373
374 # Remake Makefile.global from Makefile.global.in if the latter
375 # changed. In order to trigger this rule, the including file must
376 # write `include $(top_builddir)/src/Makefile.global', not some
377 # shortcut thereof.
378 $(top_builddir)/src/Makefile.global: $(top_srcdir)/src/Makefile.global.in $(top_builddir)/config.status
379         cd $(top_builddir) && ./config.status src/Makefile.global
380
381 # Remake pg_config.h from pg_config.h.in if the latter changed.
382 # config.status will not change the timestamp on pg_config.h if it
383 # doesn't change, so as to avoid recompiling the entire tree
384 # unnecessarily. Therefore we make config.status update a timestamp file
385 # stamp-h everytime it runs, so that we don't trigger this rule everytime.
386 # (We do trigger the null rule for stamp-h to pg_config.h everytime; so it's
387 # important for that rule to be null!)
388 #
389 # Of course you need to turn on dependency tracking to get any
390 # dependencies on pg_config.h.
391 $(top_builddir)/src/include/pg_config.h: $(top_builddir)/src/include/stamp-h
392
393 $(top_builddir)/src/include/stamp-h: $(top_srcdir)/src/include/pg_config.h.in $(top_builddir)/config.status
394         cd $(top_builddir) && ./config.status src/include/pg_config.h
395
396 # When configure changes, rerun configure with the same options as
397 # last time. To change configure, you need to run autoconf manually.
398 $(top_builddir)/config.status: $(top_srcdir)/configure
399         cd $(top_builddir) && ./config.status --recheck
400
401
402 install-strip:
403         @$(MAKE) INSTALL_PROGRAM_ENV="STRIPPROG='$(STRIP)'" \
404             INSTALL_STLIB_ENV="STRIPPROG='$(STRIP_STATIC_LIB)'" \
405             INSTALL_SHLIB_ENV="STRIPPROG='$(STRIP_SHARED_LIB)'" \
406             INSTALL_STRIP_FLAG=-s \
407             install
408
409
410 ##########################################################################
411 #
412 # Automatic dependency generation
413 # -------------------------------
414 # When we configure with --enable-depend then we override the default
415 # compilation rule with the magic below. While or after creating the
416 # actual output file we also create a dependency list for the .c file.
417 # Next time we invoke make we will have top-notch information about
418 # whether this file needs to be updated. The dependency files are kept
419 # in the .deps subdirectory of each directory.
420 #
421 # The sed command is necessary to post-process the dependency file:
422 # Each dependency file becomes a target of its own, without
423 # dependencies or commands. This is because if you happen to remove a
424 # file that is a dependency (say, you rename a header file) the
425 # dependency would point to a non-existing file and make would fail.
426 # But if the file is listed as a target of its own, without
427 # prerequisites and commands, and doesn't exist then make will
428 # consider it updated. (That in turn also has the nice side effect
429 # that make will update all files that depended on the now removed
430 # file.)
431
432 autodepend = @autodepend@
433
434 ifeq ($(autodepend), yes)
435
436 ifndef COMPILE.c
437 COMPILE.c = $(CC) $(CFLAGS) $(CPPFLAGS) -c
438 endif
439
440 DEPDIR = .deps
441 df = $(DEPDIR)/$(*F)
442
443 # This converts a .d file in the current directory to a .P file in the .deps
444 # subdirectory, with the dummy targets as explained above.
445 define postprocess-depend
446 @if test ! -d $(DEPDIR); then mkdir $(DEPDIR); fi
447 @cp $*.d $(df).P
448 @sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \
449      -e '/^$$/ d' -e 's/$$/ :/' < $*.d >> $(df).P
450 @rm -f $*.d
451 endef
452
453 ifeq ($(GCC), yes)
454
455 # GCC allows us to create object and dependency file in one invocation.
456 %.o : %.c
457         $(COMPILE.c) -o $@ $< -MMD
458         $(postprocess-depend)
459
460 endif # GCC
461
462 # Include all the dependency files generated for the current
463 # directory. List /dev/null as dummy because if the wildcard expands
464 # to nothing then make would complain.
465 -include $(wildcard $(DEPDIR)/*.P) /dev/null
466
467 # hook for clean-up
468 clean distclean maintainer-clean: clean-deps
469
470 .PHONY: clean-deps
471 clean-deps:
472         @rm -rf $(DEPDIR) *.d
473
474 endif # autodepend
475
476
477 ##########################################################################
478 #
479 # Native language support
480
481 ifeq ($(enable_nls), yes)
482 ifneq (,$(wildcard $(srcdir)/nls.mk))
483
484 include $(top_srcdir)/src/nls-global.mk
485
486 endif # nls.mk
487 endif # enable_nls