]> granicus.if.org Git - postgresql/blob - src/Makefile.global.in
Support cross compilation by compiling "zic" with a native compiler. This
[postgresql] / src / Makefile.global.in
1 # -*-makefile-*-
2 # $PostgreSQL: pgsql/src/Makefile.global.in,v 1.215 2005/07/03 18:54:28 petere 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 # docdir can be an empty string to signify --without-docdir
109 ifneq (,$(docdir))
110 ifeq "$(findstring pgsql, $(docdir))" ""
111 ifeq "$(findstring postgres, $(docdir))" ""
112 override docdir := $(docdir)/postgresql
113 endif
114 endif
115 endif
116
117 localedir := @localedir@
118
119 pgxsdir = $(pkglibdir)/pgxs
120
121
122 ##########################################################################
123 #
124 # Features
125 #
126 # Records the choice of the various --enable-xxx and --with-xxx options.
127
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@
136
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@
143
144 krb_srvtab = @krb_srvtab@
145
146 TCLSH                   = @TCLSH@
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@
153
154 TK_LIBS                 = @TK_LIBS@
155 TK_LIB_SPEC             = @TK_LIB_SPEC@
156 TK_XINCLUDES            = @TK_XINCLUDES@
157
158 PTHREAD_CFLAGS          = @PTHREAD_CFLAGS@
159 PTHREAD_LIBS            = @PTHREAD_LIBS@
160
161 have_docbook    = @have_docbook@
162 DOCBOOKSTYLE    = @DOCBOOKSTYLE@
163 COLLATEINDEX    = @COLLATEINDEX@
164
165
166 ##########################################################################
167 #
168 # Programs and flags
169
170 # Compilers
171
172 CPP = @CPP@
173 CPPFLAGS = @CPPFLAGS@
174
175 ifdef PGXS
176 override CPPFLAGS := -I$(includedir_server) -I$(includedir_internal) $(CPPFLAGS)
177 else # not PGXS
178 override CPPFLAGS := -I$(top_srcdir)/src/include $(CPPFLAGS)
179 ifdef VPATH
180 override CPPFLAGS := -I$(top_builddir)/src/include $(CPPFLAGS)
181 endif
182 endif # not PGXS
183
184 CC = @CC@
185 CC_FOR_BUILD = @CC_FOR_BUILD@
186 GCC = @GCC@
187 CFLAGS = @CFLAGS@
188
189 # Kind-of compilers
190
191 YACC = @YACC@
192 YFLAGS = @YFLAGS@
193 FLEX = @FLEX@
194 FLEXFLAGS = @FLEXFLAGS@ $(LFLAGS)
195
196 # Linking
197
198 LIBS = @LIBS@
199 LD = @LD@
200 with_gnu_ld = @with_gnu_ld@
201 ld_R_works = @ld_R_works@
202 LDFLAGS = @LDFLAGS@
203 LDFLAGS_SL = @LDFLAGS_SL@
204 LDREL = -r
205 LDOUT = -o
206 RANLIB = @RANLIB@
207 LORDER = @LORDER@
208 X = @EXEEXT@
209
210 # Perl 
211
212 # quoted for pathname with spaces
213 PERL                    = "@PERL@"
214 perl_archlibexp         = @perl_archlibexp@
215 perl_privlibexp         = @perl_privlibexp@
216 perl_useshrplib         = @perl_useshrplib@
217 perl_embed_ldflags      = @perl_embed_ldflags@
218
219 # Miscellaneous
220
221 AWK     = @AWK@
222 LN_S    = @LN_S@
223 MSGFMT  = @MSGFMT@
224 MSGMERGE = @MSGMERGE@
225 PYTHON  = @PYTHON@
226 TAR     = @TAR@
227 XGETTEXT = @XGETTEXT@
228
229 GZIP    = gzip
230 BZIP2   = bzip2
231
232 PL_TESTDB = pl_regression
233 CONTRIB_TESTDB = contrib_regression
234
235 # Installation.
236
237 INSTALL = $(SHELL) $(top_srcdir)/config/install-sh -c
238
239 INSTALL_SCRIPT_MODE     = 755
240 INSTALL_DATA_MODE       = 644
241 INSTALL_PROGRAM = $(INSTALL_PROGRAM_ENV) $(INSTALL) $(INSTALL_STRIP_FLAG)
242 INSTALL_SCRIPT  = $(INSTALL) -m $(INSTALL_SCRIPT_MODE)
243 INSTALL_DATA    = $(INSTALL) -m $(INSTALL_DATA_MODE)
244 INSTALL_STLIB   = $(INSTALL_STLIB_ENV) $(INSTALL_DATA) $(INSTALL_STRIP_FLAG)
245 INSTALL_SHLIB   = $(INSTALL_SHLIB_ENV) $(INSTALL) $(INSTALL_SHLIB_OPTS) $(INSTALL_STRIP_FLAG)
246 # Override in Makefile.port if necessary
247 INSTALL_SHLIB_OPTS = -m 755
248
249 mkinstalldirs   = $(SHELL) $(top_srcdir)/config/mkinstalldirs
250 missing         = $(SHELL) $(top_srcdir)/config/missing
251
252 STRIP           = @STRIP@
253 STRIP_STATIC_LIB = @STRIP_STATIC_LIB@
254 STRIP_SHARED_LIB = @STRIP_SHARED_LIB@
255
256 # Documentation
257
258 JADE    = @JADE@
259 NSGMLS  = @NSGMLS@
260 SGMLSPL = @SGMLSPL@
261
262 # Feature settings
263
264 DEF_PGPORT = @default_port@
265 WANTED_LANGUAGES = @WANTED_LANGUAGES@
266
267
268 ##########################################################################
269 #
270 # Additional platform-specific settings
271 #
272
273 # Name of the "template"
274 PORTNAME= @PORTNAME@
275
276 host_tuple = @host@
277 host_os = @host_os@
278 host_cpu = @host_cpu@
279
280 # Make HAVE_IPV6 available for initdb script creation
281 HAVE_IPV6= @HAVE_IPV6@
282
283 # The HP-UX port makefile, for one, needs access to this symbol
284 HAVE_POSIX_SIGNALS= @HAVE_POSIX_SIGNALS@
285
286 # This is mainly for use on FreeBSD, where we have both a.out and elf
287 # systems now.  May be applicable to other systems to?
288 ELF_SYSTEM= @ELF_SYS@
289
290 # Pull in platform-specific magic
291 include $(top_builddir)/src/Makefile.port
292
293 # Set up rpath if enabled.  By default it will point to our libdir,
294 # but individual Makefiles can force other rpath paths if needed.
295 rpathdir = $(libdir)
296
297 ifeq ($(enable_rpath), yes)
298 LDFLAGS += $(rpath)
299 endif
300
301
302 ##########################################################################
303 #
304 # Some variables needed to find some client interfaces
305
306 ifdef PGXS
307 # some contribs assumes headers and libs are in the source tree...
308 libpq_srcdir = $(includedir)
309 libpq_builddir = $(libdir)
310 else
311 libpq_srcdir = $(top_srcdir)/src/interfaces/libpq
312 libpq_builddir = $(top_builddir)/src/interfaces/libpq
313 endif
314
315 # This is for use for libraries linking to libpq.  Because libpqport
316 # isn't created with the same link flags as libpq, it can't be used.
317 libpq = -L$(libpq_builddir) -lpq
318   
319 # If doing static linking, shared library dependency can't be
320 # used so we specify pthread libs for every usage of libpq
321 ifeq ($(enable_shared), no)
322 libpq += $(PTHREAD_LIBS)
323 else
324 # AIX libraries do not remember their required libs so we have to force
325 # thread dependent libraires in the link
326 ifeq ($(PORTNAME), aix)
327 libpq += $(PTHREAD_LIBS)
328 endif
329 endif
330
331 # Force clients to pull symbols from the non-shared library libpgport 
332 # rather than pulling some libpgport symbols from libpq just because 
333 # libpq uses those functions too.  This makes applications less 
334 # dependent on changes in libpq's usage of pgport.  To do this we link to
335 # pgport before libpq.  This does cause duplicate -lpgport's to appear
336 # on client link lines.
337 ifdef PGXS
338 libpq_pgport = -L$(libdir) -lpgport $(libpq)
339 else
340 libpq_pgport = -L$(top_builddir)/src/port -lpgport $(libpq)
341 endif
342
343
344 submake-libpq:
345         $(MAKE) -C $(libpq_builddir) all
346
347 submake-libpgport:
348         $(MAKE) -C $(top_builddir)/src/port all
349
350 .PHONY: submake-libpq submake-libpgport
351
352
353 ##########################################################################
354 #
355 # Customization
356 #
357 # This includes your local customizations if Makefile.custom exists
358 # in the source directory.  This file doesn't exist in the original
359 # distribution so that it doesn't get overwritten when you upgrade.
360 #
361 # NOTE:  Makefile.custom is from the pre-Autoconf days of PostgreSQL.
362 # You are liable to shoot yourself in the foot if you use it without
363 # knowing exactly what you're doing.  The preferred (and more
364 # reliable) method is to communicate what you want to do to the
365 # configure script, and leave the makefiles alone.
366
367 -include $(top_srcdir)/src/Makefile.custom
368
369 ifneq ($(CUSTOM_INSTALL),)
370 INSTALL= $(CUSTOM_INSTALL)
371 endif
372
373 ifneq ($(CUSTOM_CC),)
374   CC= $(CUSTOM_CC)
375 endif
376
377 ifneq ($(CUSTOM_COPT),)
378   COPT= $(CUSTOM_COPT)
379 endif
380
381 ifdef COPT
382    CFLAGS += $(COPT)
383    LDFLAGS += $(COPT)
384 endif
385
386 ifdef PROFILE
387    CFLAGS += $(PROFILE)
388    LDFLAGS += $(PROFILE)
389 endif
390
391
392 ##########################################################################
393 #
394 # substitute implementations of the C library
395
396 LIBOBJS = @LIBOBJS@ dirmod.o exec.o noblock.o path.o pipe.o pgsleep.o pgstrcasecmp.o sprompt.o thread.o
397
398 ifneq (,$(LIBOBJS))
399 LIBS := -lpgport $(LIBS)
400 ifdef PGXS
401 # where libpgport.a is installed
402 override LDFLAGS := -L$(libdir) $(LDFLAGS)
403 else
404 override LDFLAGS := -L$(top_builddir)/src/port $(LDFLAGS)
405 endif
406 endif
407
408 # to make ws2_32.lib the last library, and always link with shfolder,
409 # so SHGetFolderName isn't picked up from shell32.dll
410 ifeq ($(PORTNAME),win32)
411 LIBS += -lws2_32 -lshfolder
412 endif
413
414 # Not really standard libc functions, used by the backend.
415 TAS         = @TAS@
416
417
418 ##########################################################################
419 #
420 # Global targets and rules
421
422 %.gz: %
423         $(GZIP) -f --best $<
424
425 %.bz2: %
426         $(BZIP2) -f $<
427
428 ifeq ($(PORTNAME),win32)
429 # Build rules to add versioninfo resources to win32 binaries
430 WIN32RES += win32ver.o
431 ifeq ($(PGFILESHLIB),1)
432 PGFTYPE=VFT_DLL
433 else
434 PGFTYPE=VFT_APP
435 endif
436 ifneq (,$(PGAPPICON))
437 PGICOSTR=$(subst /,\/,IDI_ICON ICON \"$(top_builddir)/src/port/$(PGAPPICON).ico\")
438 endif
439 win32ver.rc: $(top_builddir)/src/port/win32ver.rc
440         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
441 win32ver.o: $(top_builddir)/src/port/win32ver.rc
442         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
443         windres -i win32ver.rc -o win32ver.o --include-dir=$(top_builddir)/src/include
444         rm -f win32ver.rc
445 endif
446
447 ifndef PGXS
448
449 # Remake Makefile.global from Makefile.global.in if the latter
450 # changed. In order to trigger this rule, the including file must
451 # write `include $(top_builddir)/src/Makefile.global', not some
452 # shortcut thereof.
453 $(top_builddir)/src/Makefile.global: $(top_srcdir)/src/Makefile.global.in $(top_builddir)/config.status
454         cd $(top_builddir) && ./config.status src/Makefile.global
455
456 # Remake pg_config.h from pg_config.h.in if the latter changed.
457 # config.status will not change the timestamp on pg_config.h if it
458 # doesn't change, so as to avoid recompiling the entire tree
459 # unnecessarily. Therefore we make config.status update a timestamp file
460 # stamp-h everytime it runs, so that we don't trigger this rule everytime.
461 # (We do trigger the null rule for stamp-h to pg_config.h everytime; so it's
462 # important for that rule to be null!)
463 #
464 # Of course you need to turn on dependency tracking to get any
465 # dependencies on pg_config.h.
466 $(top_builddir)/src/include/pg_config.h: $(top_builddir)/src/include/stamp-h
467
468 $(top_builddir)/src/include/stamp-h: $(top_srcdir)/src/include/pg_config.h.in $(top_builddir)/config.status
469         cd $(top_builddir) && ./config.status src/include/pg_config.h
470
471 # When configure changes, rerun configure with the same options as
472 # last time. To change configure, you need to run autoconf manually.
473 $(top_builddir)/config.status: $(top_srcdir)/configure
474         cd $(top_builddir) && ./config.status --recheck
475
476 endif # not PGXS
477
478
479 install-strip:
480         @$(MAKE) INSTALL_PROGRAM_ENV="STRIPPROG='$(STRIP)'" \
481             INSTALL_STLIB_ENV="STRIPPROG='$(STRIP_STATIC_LIB)'" \
482             INSTALL_SHLIB_ENV="STRIPPROG='$(STRIP_SHARED_LIB)'" \
483             INSTALL_STRIP_FLAG=-s \
484             install
485
486
487 ##########################################################################
488 #
489 # Automatic dependency generation
490 # -------------------------------
491 # When we configure with --enable-depend then we override the default
492 # compilation rule with the magic below. While or after creating the
493 # actual output file we also create a dependency list for the .c file.
494 # Next time we invoke make we will have top-notch information about
495 # whether this file needs to be updated. The dependency files are kept
496 # in the .deps subdirectory of each directory.
497 #
498 # The sed command is necessary to post-process the dependency file:
499 # Each dependency file becomes a target of its own, without
500 # dependencies or commands. This is because if you happen to remove a
501 # file that is a dependency (say, you rename a header file) the
502 # dependency would point to a non-existing file and make would fail.
503 # But if the file is listed as a target of its own, without
504 # prerequisites and commands, and doesn't exist then make will
505 # consider it updated. (That in turn also has the nice side effect
506 # that make will update all files that depended on the now removed
507 # file.)
508
509 autodepend = @autodepend@
510
511 ifeq ($(autodepend), yes)
512
513 ifndef COMPILE.c
514 COMPILE.c = $(CC) $(CFLAGS) $(CPPFLAGS) -c
515 endif
516
517 DEPDIR = .deps
518 df = $(DEPDIR)/$(*F)
519
520 # This converts a .d file in the current directory to a .P file in the .deps
521 # subdirectory, with the dummy targets as explained above.
522 define postprocess-depend
523 @if test ! -d $(DEPDIR); then mkdir $(DEPDIR); fi
524 @cp $*.d $(df).P
525 @sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \
526      -e '/^$$/ d' -e 's/$$/ :/' < $*.d >> $(df).P
527 @rm -f $*.d
528 endef
529
530 ifeq ($(GCC), yes)
531
532 # GCC allows us to create object and dependency file in one invocation.
533 %.o : %.c
534         $(COMPILE.c) -o $@ $< -MMD
535         $(postprocess-depend)
536
537 endif # GCC
538
539 # Include all the dependency files generated for the current
540 # directory. List /dev/null as dummy because if the wildcard expands
541 # to nothing then make would complain.
542 -include $(wildcard $(DEPDIR)/*.P) /dev/null
543
544 # hook for clean-up
545 clean distclean maintainer-clean: clean-deps
546
547 .PHONY: clean-deps
548 clean-deps:
549         @rm -rf $(DEPDIR) *.d
550
551 endif # autodepend
552
553
554 ##########################################################################
555 #
556 # Native language support
557
558 ifeq ($(enable_nls), yes)
559 ifneq (,$(wildcard $(srcdir)/nls.mk))
560
561 include $(top_srcdir)/src/nls-global.mk
562
563 endif # nls.mk
564 endif # enable_nls