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