]> granicus.if.org Git - postgresql/blob - src/Makefile.global.in
ef488cbd40456f5d2b053bba857b94f8fe9a5162
[postgresql] / src / Makefile.global.in
1 # -*-makefile-*-
2 # $Header: /cvsroot/pgsql/src/Makefile.global.in,v 1.121 2001/03/03 15:53:41 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
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
84 includedir := @includedir@
85 ifeq "$(findstring pgsql, $(includedir))" ""
86 ifeq "$(findstring postgres, $(includedir))" ""
87 override includedir := $(includedir)/postgresql
88 endif
89 endif
90
91 mandir := @mandir@
92
93 docdir := @docdir@
94 ifeq "$(findstring pgsql, $(docdir))" ""
95 ifeq "$(findstring postgres, $(docdir))" ""
96 override docdir := $(docdir)/postgresql
97 endif
98 endif
99
100 odbcinst_ini_dir = @odbcinst_ini_dir@
101
102
103 ##########################################################################
104 #
105 # Features
106 #
107 # Records the choice of the various --enable-xxx and --with-xxx options.
108
109 with_CXX        = @with_CXX@
110 with_perl       = @with_perl@
111 with_python     = @with_python@
112 with_tcl        = @with_tcl@
113 with_tk         = @with_tk@
114 enable_odbc     = @enable_odbc@
115 MULTIBYTE       = @MULTIBYTE@
116 enable_shared   = @enable_shared@
117 enable_rpath    = @enable_rpath@
118
119 python_extmakefile = @python_extmakefile@
120 python_moduledir = @python_moduledir@
121
122 krb_srvtab = @krb_srvtab@
123
124 TCL_CONFIG_SH = @TCL_CONFIG_SH@
125 TK_CONFIG_SH = @TK_CONFIG_SH@
126
127 have_docbook    = @have_docbook@
128 DOCBOOKSTYLE    = @DOCBOOKSTYLE@
129
130
131 ##########################################################################
132 #
133 # Programs and flags
134
135 # Compilers
136
137 CPP = @CPP@
138 CPPFLAGS = @CPPFLAGS@
139 override CPPFLAGS := $(sort -I$(top_srcdir)/src/include -I$(top_builddir)/src/include) $(CPPFLAGS)
140
141 CC = @CC@
142 GCC = @GCC@
143 CFLAGS = @CFLAGS@
144 ifeq ($(GCC), yes)
145   CFLAGS += -Wall -Wmissing-prototypes -Wmissing-declarations
146 endif
147
148 CXX = @CXX@
149 GXX = @GXX@
150 CXXFLAGS = @CXXFLAGS@
151 ifeq ($(GXX), yes)
152   CXXFLAGS += -Wall
153 endif
154
155 # Kind-of compilers
156
157 YACC = @YACC@
158 YFLAGS = @YFLAGS@
159 FLEX = @FLEX@
160 FLEXFLAGS = @FLEXFLAGS@ $(LFLAGS)
161
162 # Linking
163
164 LIBS = @LIBS@
165 LD = @LD@
166 with_gnu_ld = @with_gnu_ld@
167 ld_R_works = @ld_R_works@
168 LDFLAGS = @LDFLAGS@
169 LDREL = -r
170 LDOUT = -o
171 RANLIB = @RANLIB@
172 LORDER = @LORDER@
173 X = @EXEEXT@
174
175 # Miscellaneous
176
177 AWK     = @AWK@
178 LN_S    = @LN_S@
179 PERL    = @PERL@
180 PYTHON  = @PYTHON@
181 TAR     = @TAR@
182 WISH    = @WISH@
183
184 # Installation.
185
186 INSTALL = @INSTALL@
187
188 INSTALL_PROGRAM = @INSTALL_PROGRAM@
189 INSTALL_SCRIPT  = @INSTALL_SCRIPT@
190 INSTALL_DATA    = @INSTALL_DATA@
191 INSTALL_SHLIB   = @INSTALL_SHLIB@
192
193 mkinstalldirs   = $(SHELL) $(top_srcdir)/config/mkinstalldirs
194 missing         = $(SHELL) $(top_srcdir)/config/missing
195
196 # Documentation
197
198 JADE    = @JADE@
199 NSGMLS  = @NSGMLS@
200 SGMLSPL = @SGMLSPL@
201
202 # Feature settings
203
204 DEF_PGPORT = @default_port@
205
206
207 ##########################################################################
208 #
209 # Additional platform-specific settings
210 #
211
212 # Name of the "template"
213 PORTNAME= @PORTNAME@
214
215 host_tuple = @host@
216 host_os = @host_os@
217 host_cpu = @host_cpu@
218
219 # Grungy things needed for HP-UX
220 HAVE_POSIX_SIGNALS= @HAVE_POSIX_SIGNALS@
221 HPUXMATHLIB= @HPUXMATHLIB@
222
223 # This is mainly for use on FreeBSD, where we have both a.out and elf
224 # systems now.  May be applicable to other systems to?
225 ELF_SYSTEM= @ELF_SYS@
226
227 # Pull in platform-specific magic
228 include $(top_builddir)/src/Makefile.port
229
230 ifeq ($(enable_rpath), yes)
231 LDFLAGS += $(rpath)
232 endif
233
234 ##########################################################################
235 #
236 # Some variables needed to find some client interfaces
237
238 libpq_srcdir = $(top_srcdir)/src/interfaces/libpq
239 libpq_builddir = $(top_builddir)/src/interfaces/libpq
240 libpq = -L$(libpq_builddir) -lpq
241
242
243 ##########################################################################
244 #
245 # Customization
246 #
247 # This includes your local customizations if Makefile.custom exists
248 # in the source directory.  This file doesn't exist in the original
249 # distribution so that it doesn't get overwritten when you upgrade.
250 #
251 # NOTE:  Makefile.custom is from the pre-Autoconf days of PostgreSQL.
252 # You are liable to shoot yourself in the foot if you use it without
253 # knowing exactly what you're doing.  The preferred (and more
254 # reliable) method is to communicate what you want to do to the
255 # configure script, and leave the makefiles alone.
256
257 -include $(top_srcdir)/src/Makefile.custom
258
259 ifneq ($(CUSTOM_INSTALL),)
260 INSTALL= $(CUSTOM_INSTALL)
261 endif
262
263 ifneq ($(CUSTOM_CC),)
264   CC= $(CUSTOM_CC)
265 endif
266
267 ifneq ($(CUSTOM_COPT),)
268   COPT= $(CUSTOM_COPT)
269 endif
270
271 ifdef COPT
272    CFLAGS+= $(COPT)
273    LDFLAGS+= $(COPT)
274 endif
275
276 ifdef PROFILE
277    CFLAGS+= $(PROFILE)
278    LDFLAGS+= $(PROFILE)
279 endif
280
281
282 ##########################################################################
283 #
284 # substitute implementations of the C library
285
286 INET_ATON = @INET_ATON@
287 STRERROR = @STRERROR@
288 SNPRINTF = @SNPRINTF@
289 STRDUP = @STRDUP@
290 STRTOUL = @STRTOUL@
291
292
293 ##########################################################################
294 #
295 # Global targets
296
297 # Remake Makefile.global from Makefile.global.in if the latter
298 # changed. In order to trigger this rule, the including file must
299 # write `include $(top_builddir)/src/Makefile.global', not some
300 # shortcut thereof.
301 $(top_builddir)/src/Makefile.global: $(top_srcdir)/src/Makefile.global.in $(top_builddir)/config.status
302         cd $(top_builddir) && CONFIG_FILES=src/Makefile.global CONFIG_HEADERS= ./config.status
303
304 # Remake config.h from config.h.in if the latter changed.
305 # config.status will not change the timestamp on config.h if it
306 # doesn't change, so as to avoid recompiling the entire tree
307 # unnecessarily. Therefore we make config.status update a timestamp file
308 # stamp-h everytime it runs, so that we don't trigger this rule everytime.
309 # (We do trigger the null rule for stamp-h to config.h everytime; so it's
310 # important for that rule to be null!)
311 #
312 # Of course you need to turn on dependency tracking to get any
313 # dependencies on config.h.
314 $(top_builddir)/src/include/config.h: $(top_builddir)/src/include/stamp-h
315
316 $(top_builddir)/src/include/stamp-h: $(top_srcdir)/src/include/config.h.in $(top_builddir)/config.status
317         cd $(top_builddir) && CONFIG_FILES= CONFIG_HEADERS=src/include/config.h ./config.status
318
319 # When configure changes, rerun configure with the same options as
320 # last time. To change configure, you need to run autoconf manually.
321 $(top_builddir)/config.status: $(top_srcdir)/configure
322         cd $(top_builddir) && ./config.status --recheck
323
324
325 ##########################################################################
326 #
327 # Automatic dependency generation
328 # -------------------------------
329 # When we configure with --enable-depend then we override the default
330 # compilation rule with the magic below. While or after creating the
331 # actual output file we also create a dependency list for the .c file.
332 # Next time we invoke make we will have top-notch information about
333 # whether this file needs to be updated. The dependency files are kept
334 # in the .deps subdirectory of each directory.
335 #
336 # The sed command is necessary to post-process the dependency file:
337 # Each dependency file becomes a target of its own, without
338 # dependencies or commands. This is because if you happen to remove a
339 # file that is a dependency (say, you rename a header file) the
340 # dependency would point to a non-existing file and make would fail.
341 # But if the file is listed as a target of its own, without
342 # prerequisites and commands, and doesn't exist then make will
343 # consider it updated. (That in turn also has the nice side effect
344 # that make will update all files that depended on the now removed
345 # file.)
346
347 autodepend = @autodepend@
348
349 ifeq ($(autodepend), yes)
350
351 ifndef COMPILE.c
352 COMPILE.c = $(CC) $(CFLAGS) $(CPPFLAGS) -c
353 endif
354
355 ifndef COMPILE.cc
356 COMPILE.cc = $(CXX) $(CXXFLAGS) $(CPPFLAGS) -c
357 endif
358
359 DEPDIR = .deps
360 df = $(DEPDIR)/$(*F)
361
362 # This converts a .d file in the current directory to a .P file in the .deps
363 # subdirectory, with the dummy targets as explained above.
364 define postprocess-depend
365 @if test ! -d $(DEPDIR); then mkdir $(DEPDIR); fi
366 @cp $*.d $(df).P
367 @sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \
368      -e '/^$$/ d' -e 's/$$/ :/' < $*.d >> $(df).P
369 @rm -f $*.d
370 endef
371
372 ifeq ($(GCC), yes)
373
374 # GCC allows us to create object and dependency file in one invocation.
375 %.o : %.c
376         $(COMPILE.c) -o $@ $< -MMD
377         $(postprocess-depend)
378
379 endif # GCC
380
381 ifeq ($(GXX), yes)
382
383 %.o : %.cc
384         $(COMPILE.cc) -o $@ $< -MMD
385         $(postprocess-depend)
386
387 endif # GXX
388
389 # Include all the dependency files generated for the current
390 # directory. List /dev/null as dummy because if the wildcard expands
391 # to nothing then make would complain.
392 -include $(wildcard $(DEPDIR)/*.P) /dev/null
393
394 # hook for clean-up
395 clean distclean maintainer-clean: clean-deps
396
397 .PHONY: clean-deps
398 clean-deps:
399         @rm -rf $(DEPDIR) *.d
400
401 endif # autodepend