]> granicus.if.org Git - postgresql/blob - src/Makefile.global.in
Assorted fixes for Cygwin:
[postgresql] / src / Makefile.global.in
1 # -*-makefile-*-
2 # $Header: /cvsroot/pgsql/src/Makefile.global.in,v 1.155 2002/09/04 22:54:18 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 ifeq "$(findstring pgsql, $(docdir))" ""
109 ifeq "$(findstring postgres, $(docdir))" ""
110 override docdir := $(docdir)/postgresql
111 endif
112 endif
113
114 javadir := $(DESTDIR)$(datadir)/java
115 localedir := @localedir@
116
117
118 ##########################################################################
119 #
120 # Features
121 #
122 # Records the choice of the various --enable-xxx and --with-xxx options.
123
124 with_java       = @with_java@
125 with_perl       = @with_perl@
126 with_python     = @with_python@
127 with_tcl        = @with_tcl@
128 with_tk         = @with_tk@
129 enable_shared   = @enable_shared@
130 enable_rpath    = @enable_rpath@
131 enable_nls      = @enable_nls@
132 enable_debug    = @enable_debug@
133
134 python_version          = @python_version@
135 python_includespec      = @python_includespec@
136 python_moduledir        = @python_moduledir@
137 python_moduleexecdir    = @python_moduleexecdir@
138 python_libspec          = @python_libspec@
139 python_configdir        = @python_configdir@
140
141 krb_srvtab = @krb_srvtab@
142
143 TCLSH                   = @TCLSH@
144 TCL_LIB_FILE            = @TCL_LIB_FILE@
145 TCL_LIBS                = @TCL_LIBS@
146 TCL_LIB_SPEC            = @TCL_LIB_SPEC@
147 TCL_SHARED_BUILD        = @TCL_SHARED_BUILD@
148 TCL_SHLIB_LD_LIBS       = @TCL_SHLIB_LD_LIBS@
149
150 TK_LIBS                 = @TK_LIBS@
151 TK_LIB_SPEC             = @TK_LIB_SPEC@
152 TK_XINCLUDES            = @TK_XINCLUDES@
153
154 have_docbook    = @have_docbook@
155 DOCBOOKSTYLE    = @DOCBOOKSTYLE@
156 COLLATEINDEX    = @COLLATEINDEX@
157
158
159 ##########################################################################
160 #
161 # Programs and flags
162
163 # Compilers
164
165 CPP = @CPP@
166 CPPFLAGS = @CPPFLAGS@
167 override CPPFLAGS := -I$(top_srcdir)/src/include $(CPPFLAGS)
168 ifdef VPATH
169 override CPPFLAGS := -I$(top_builddir)/src/include $(CPPFLAGS)
170 endif
171
172 CC = @CC@
173 GCC = @GCC@
174 CFLAGS = @CFLAGS@
175 ifeq ($(GCC), yes)
176   CFLAGS += -Wall -Wmissing-prototypes -Wmissing-declarations
177 endif
178
179 # Kind-of compilers
180
181 YACC = @YACC@
182 YFLAGS = @YFLAGS@
183 FLEX = @FLEX@
184 FLEXFLAGS = @FLEXFLAGS@ $(LFLAGS)
185
186 # Linking
187
188 LIBS = @LIBS@
189 LD = @LD@
190 with_gnu_ld = @with_gnu_ld@
191 ld_R_works = @ld_R_works@
192 LDFLAGS = @LDFLAGS@
193 LDREL = -r
194 LDOUT = -o
195 RANLIB = @RANLIB@
196 LORDER = @LORDER@
197 X = @EXEEXT@
198
199 # Perl 
200
201 PERL                    = @PERL@
202 perl_archlibexp         = @perl_archlibexp@
203 perl_privlibexp         = @perl_privlibexp@
204 perl_useshrplib         = @perl_useshrplib@
205 perl_embed_ldflags      = @perl_embed_ldflags@
206
207 # Miscellaneous
208
209 ANT     = @ANT@
210 AWK     = @AWK@
211 LN_S    = @LN_S@
212 MSGFMT  = @MSGFMT@
213 MSGMERGE = @MSGMERGE@
214 PYTHON  = @PYTHON@
215 TAR     = @TAR@
216 XGETTEXT = @XGETTEXT@
217
218 GZIP    = gzip
219 BZIP2   = bzip2
220
221 # Installation.
222
223 INSTALL = $(SHELL) $(top_srcdir)/config/install-sh -c
224
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
232
233 mkinstalldirs   = $(SHELL) $(top_srcdir)/config/mkinstalldirs
234 missing         = $(SHELL) $(top_srcdir)/config/missing
235
236 STRIP           = @STRIP@
237 STRIP_STATIC_LIB = @STRIP_STATIC_LIB@
238 STRIP_SHARED_LIB = @STRIP_SHARED_LIB@
239
240 # Documentation
241
242 JADE    = @JADE@
243 NSGMLS  = @NSGMLS@
244 SGMLSPL = @SGMLSPL@
245
246 # Feature settings
247
248 DEF_PGPORT = @default_port@
249 WANTED_LANGUAGES = @WANTED_LANGUAGES@
250
251
252 ##########################################################################
253 #
254 # Additional platform-specific settings
255 #
256
257 # Name of the "template"
258 PORTNAME= @PORTNAME@
259
260 host_tuple = @host@
261 host_os = @host_os@
262 host_cpu = @host_cpu@
263
264 # Grungy things needed for HP-UX
265 HAVE_POSIX_SIGNALS= @HAVE_POSIX_SIGNALS@
266 HPUXMATHLIB= @HPUXMATHLIB@
267
268 # This is mainly for use on FreeBSD, where we have both a.out and elf
269 # systems now.  May be applicable to other systems to?
270 ELF_SYSTEM= @ELF_SYS@
271
272 # Pull in platform-specific magic
273 include $(top_builddir)/src/Makefile.port
274
275 ifeq ($(enable_rpath), yes)
276 LDFLAGS += $(rpath)
277 endif
278
279
280 ##########################################################################
281 #
282 # Some variables needed to find some client interfaces
283
284 libpq_srcdir = $(top_srcdir)/src/interfaces/libpq
285 libpq_builddir = $(top_builddir)/src/interfaces/libpq
286 libpq = -L$(libpq_builddir) -lpq
287
288 submake-libpq:
289         $(MAKE) -C $(libpq_builddir) all
290
291 submake-libpgport:
292         $(MAKE) -C $(top_builddir)/src/port all
293
294 .PHONY: submake-libpq submake-libpgport
295
296
297 ##########################################################################
298 #
299 # Customization
300 #
301 # This includes your local customizations if Makefile.custom exists
302 # in the source directory.  This file doesn't exist in the original
303 # distribution so that it doesn't get overwritten when you upgrade.
304 #
305 # NOTE:  Makefile.custom is from the pre-Autoconf days of PostgreSQL.
306 # You are liable to shoot yourself in the foot if you use it without
307 # knowing exactly what you're doing.  The preferred (and more
308 # reliable) method is to communicate what you want to do to the
309 # configure script, and leave the makefiles alone.
310
311 -include $(top_srcdir)/src/Makefile.custom
312
313 ifneq ($(CUSTOM_INSTALL),)
314 INSTALL= $(CUSTOM_INSTALL)
315 endif
316
317 ifneq ($(CUSTOM_CC),)
318   CC= $(CUSTOM_CC)
319 endif
320
321 ifneq ($(CUSTOM_COPT),)
322   COPT= $(CUSTOM_COPT)
323 endif
324
325 ifdef COPT
326    CFLAGS+= $(COPT)
327    LDFLAGS+= $(COPT)
328 endif
329
330 ifdef PROFILE
331    CFLAGS+= $(PROFILE)
332    LDFLAGS+= $(PROFILE)
333 endif
334
335
336 ##########################################################################
337 #
338 # substitute implementations of the C library
339
340 LIBOBJS = @LIBOBJS@
341
342 ifneq (,$(LIBOBJS))
343 LIBS += -lpgport
344 LDFLAGS := -L$(top_builddir)/src/port $(LDFLAGS)
345 endif
346
347 # Not really standard libc functions, used by the backend.
348 TAS         = @TAS@
349
350
351 ##########################################################################
352 #
353 # Global targets and rules
354
355 %.gz: %
356         $(GZIP) -f --best $<
357
358 %.bz2: %
359         $(BZIP2) -f $<
360
361 # Remake Makefile.global from Makefile.global.in if the latter
362 # changed. In order to trigger this rule, the including file must
363 # write `include $(top_builddir)/src/Makefile.global', not some
364 # shortcut thereof.
365 $(top_builddir)/src/Makefile.global: $(top_srcdir)/src/Makefile.global.in $(top_builddir)/config.status
366         cd $(top_builddir) && ./config.status src/Makefile.global
367
368 # Remake pg_config.h from pg_config.h.in if the latter changed.
369 # config.status will not change the timestamp on pg_config.h if it
370 # doesn't change, so as to avoid recompiling the entire tree
371 # unnecessarily. Therefore we make config.status update a timestamp file
372 # stamp-h everytime it runs, so that we don't trigger this rule everytime.
373 # (We do trigger the null rule for stamp-h to pg_config.h everytime; so it's
374 # important for that rule to be null!)
375 #
376 # Of course you need to turn on dependency tracking to get any
377 # dependencies on pg_config.h.
378 $(top_builddir)/src/include/pg_config.h: $(top_builddir)/src/include/stamp-h
379
380 $(top_builddir)/src/include/stamp-h: $(top_srcdir)/src/include/pg_config.h.in $(top_builddir)/config.status
381         cd $(top_builddir) && ./config.status src/include/pg_config.h
382
383 # When configure changes, rerun configure with the same options as
384 # last time. To change configure, you need to run autoconf manually.
385 $(top_builddir)/config.status: $(top_srcdir)/configure
386         cd $(top_builddir) && ./config.status --recheck
387
388
389 install-strip:
390         @$(MAKE) INSTALL_PROGRAM_ENV="STRIPPROG='$(STRIP)'" \
391             INSTALL_STLIB_ENV="STRIPPROG='$(STRIP_STATIC_LIB)'" \
392             INSTALL_SHLIB_ENV="STRIPPROG='$(STRIP_SHARED_LIB)'" \
393             INSTALL_STRIP_FLAG=-s \
394             install
395
396
397 ##########################################################################
398 #
399 # Automatic dependency generation
400 # -------------------------------
401 # When we configure with --enable-depend then we override the default
402 # compilation rule with the magic below. While or after creating the
403 # actual output file we also create a dependency list for the .c file.
404 # Next time we invoke make we will have top-notch information about
405 # whether this file needs to be updated. The dependency files are kept
406 # in the .deps subdirectory of each directory.
407 #
408 # The sed command is necessary to post-process the dependency file:
409 # Each dependency file becomes a target of its own, without
410 # dependencies or commands. This is because if you happen to remove a
411 # file that is a dependency (say, you rename a header file) the
412 # dependency would point to a non-existing file and make would fail.
413 # But if the file is listed as a target of its own, without
414 # prerequisites and commands, and doesn't exist then make will
415 # consider it updated. (That in turn also has the nice side effect
416 # that make will update all files that depended on the now removed
417 # file.)
418
419 autodepend = @autodepend@
420
421 ifeq ($(autodepend), yes)
422
423 ifndef COMPILE.c
424 COMPILE.c = $(CC) $(CFLAGS) $(CPPFLAGS) -c
425 endif
426
427 DEPDIR = .deps
428 df = $(DEPDIR)/$(*F)
429
430 # This converts a .d file in the current directory to a .P file in the .deps
431 # subdirectory, with the dummy targets as explained above.
432 define postprocess-depend
433 @if test ! -d $(DEPDIR); then mkdir $(DEPDIR); fi
434 @cp $*.d $(df).P
435 @sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \
436      -e '/^$$/ d' -e 's/$$/ :/' < $*.d >> $(df).P
437 @rm -f $*.d
438 endef
439
440 ifeq ($(GCC), yes)
441
442 # GCC allows us to create object and dependency file in one invocation.
443 %.o : %.c
444         $(COMPILE.c) -o $@ $< -MMD
445         $(postprocess-depend)
446
447 endif # GCC
448
449 # Include all the dependency files generated for the current
450 # directory. List /dev/null as dummy because if the wildcard expands
451 # to nothing then make would complain.
452 -include $(wildcard $(DEPDIR)/*.P) /dev/null
453
454 # hook for clean-up
455 clean distclean maintainer-clean: clean-deps
456
457 .PHONY: clean-deps
458 clean-deps:
459         @rm -rf $(DEPDIR) *.d
460
461 endif # autodepend
462
463
464 ##########################################################################
465 #
466 # Native language support
467
468 ifeq ($(enable_nls), yes)
469 ifneq (,$(wildcard $(srcdir)/nls.mk))
470
471 include $(top_srcdir)/src/nls-global.mk
472
473 endif # nls.mk
474 endif # enable_nls