1996-07-09 08:22:35 +02:00
|
|
|
#-------------------------------------------------------------------------
|
|
|
|
#
|
2000-06-27 02:32:06 +02:00
|
|
|
# Makefile for src/bin/initdb
|
1996-07-09 08:22:35 +02:00
|
|
|
#
|
2024-01-04 02:49:05 +01:00
|
|
|
# Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group
|
2001-02-18 19:34:02 +01:00
|
|
|
# Portions Copyright (c) 1994, Regents of the University of California
|
1996-07-09 08:22:35 +02:00
|
|
|
#
|
2010-09-20 22:08:53 +02:00
|
|
|
# src/bin/initdb/Makefile
|
1996-07-09 08:22:35 +02:00
|
|
|
#
|
|
|
|
#-------------------------------------------------------------------------
|
|
|
|
|
2004-10-05 21:30:25 +02:00
|
|
|
PGFILEDESC = "initdb - initialize a new database cluster"
|
2010-05-12 13:33:10 +02:00
|
|
|
PGAPPICON=win32
|
|
|
|
|
2000-06-27 02:32:06 +02:00
|
|
|
subdir = src/bin/initdb
|
|
|
|
top_builddir = ../../..
|
2000-08-31 18:12:35 +02:00
|
|
|
include $(top_builddir)/src/Makefile.global
|
1996-07-09 08:22:35 +02:00
|
|
|
|
2020-01-16 21:56:32 +01:00
|
|
|
# Note: it's important that we link to encnames.o from libpgcommon, not
|
|
|
|
# from libpq, else we have risks of version skew if we run with a libpq
|
Restore proper linkage of pg_char_to_encoding() and friends.
Back in the 8.3 era we discovered that it was problematic if
libpq.so had encoding ID assignments different from the backend,
which is possible because on some platforms libpq.so might be
of a different major version from the calling programs.
psql should use libpq's assignments, but initdb has to use the
backend's, else it will put wrong values into pg_database.
The solution devised in commit 8468146b0 relied on giving initdb
its own copy of encnames.c rather than relying on the functions
exported by libpq. Later, that metamorphosed into ensuring that
libpgcommon got linked before libpq -- which made things OK for
initdb but broke psql. We didn't notice for lack of any changes
in enum pg_enc since then. Commit 06843df4a reversed that, fixing
the latent bug in psql but adding one in initdb. The meson build
infrastructure is also not being sufficiently careful about link
order, and trying to make it so would be equally fragile.
Hence, let's use a new scheme based on giving the libpq-exported
symbols different real names than the same functions exported from
libpgcommon.a or libpgcommon_srv.a. (We could distinguish those
two cases as well, but there seems no need to.) libpq gets the
official names to avoid an ABI break for libpq clients, while the
other cases use #define's to make the real names "xxx_private"
rather than "xxx". By controlling where the #define's are
applied, we can force any particular client program to use one
set or the other of the encnames.c functions.
We cannot back-patch this, since it'd be an ABI break for backend
loadable modules, but there seems little need to. We're just
trying to ensure that the world is safe for hypothetical future
additions to enum pg_enc.
In passing this should fix "duplicate symbol" linker warnings
that we've been seeing on AIX buildfarm members since commit
06843df4a. It's not very clear why that linker is complaining
now, when there were strictly *more* duplicates visible before,
but in any case this should remove the reason for complaint.
Patch by me; thanks to Andres Freund for review.
Discussion: https://postgr.es/m/2385119.1696354473@sss.pgh.pa.us
2023-10-07 18:08:10 +02:00
|
|
|
# shared library from a different PG version. Define
|
|
|
|
# USE_PRIVATE_ENCODING_FUNCS to ensure that that happens.
|
|
|
|
override CPPFLAGS := -DUSE_PRIVATE_ENCODING_FUNCS -I$(libpq_srcdir) -I$(top_srcdir)/src/timezone $(ICU_CFLAGS) $(CPPFLAGS)
|
|
|
|
|
2020-01-16 21:56:32 +01:00
|
|
|
# We need libpq only because fe_utils does.
|
2023-03-09 19:52:41 +01:00
|
|
|
LDFLAGS_INTERNAL += -L$(top_builddir)/src/fe_utils -lpgfeutils $(libpq_pgport) $(ICU_LIBS)
|
2016-08-20 21:05:25 +02:00
|
|
|
|
2011-09-13 16:58:06 +02:00
|
|
|
# use system timezone data?
|
|
|
|
ifneq (,$(with_system_tzdata))
|
|
|
|
override CPPFLAGS += '-DSYSTEMTZDIR="$(with_system_tzdata)"'
|
|
|
|
endif
|
|
|
|
|
2019-11-05 23:41:07 +01:00
|
|
|
OBJS = \
|
|
|
|
$(WIN32RES) \
|
|
|
|
findtimezone.o \
|
|
|
|
initdb.o \
|
|
|
|
localtime.o
|
2003-11-10 23:51:16 +01:00
|
|
|
|
2010-11-12 21:15:16 +01:00
|
|
|
all: initdb
|
2003-11-10 23:51:16 +01:00
|
|
|
|
2016-08-22 14:01:12 +02:00
|
|
|
initdb: $(OBJS) | submake-libpq submake-libpgport submake-libpgfeutils
|
2022-03-20 10:21:45 +01:00
|
|
|
$(CC) $(CFLAGS) $(OBJS) $(LDFLAGS) $(LDFLAGS_EX) $(LIBS) -o $@$(X)
|
2007-10-13 22:18:42 +02:00
|
|
|
|
2020-01-16 21:56:32 +01:00
|
|
|
# We must pull in localtime.c from src/timezones
|
2011-09-09 23:59:11 +02:00
|
|
|
localtime.c: % : $(top_srcdir)/src/timezone/%
|
|
|
|
rm -f $@ && $(LN_S) $< .
|
|
|
|
|
2000-06-27 02:32:06 +02:00
|
|
|
install: all installdirs
|
2005-12-09 22:19:36 +01:00
|
|
|
$(INSTALL_PROGRAM) initdb$(X) '$(DESTDIR)$(bindir)/initdb$(X)'
|
1996-11-11 14:41:36 +01:00
|
|
|
|
2000-06-27 02:32:06 +02:00
|
|
|
installdirs:
|
2009-08-27 00:24:44 +02:00
|
|
|
$(MKDIR_P) '$(DESTDIR)$(bindir)'
|
1996-12-10 04:40:23 +01:00
|
|
|
|
2000-06-27 02:32:06 +02:00
|
|
|
uninstall:
|
2005-12-09 22:19:36 +01:00
|
|
|
rm -f '$(DESTDIR)$(bindir)/initdb$(X)'
|
2000-06-27 02:32:06 +02:00
|
|
|
|
Remove distprep
A PostgreSQL release tarball contains a number of prebuilt files, in
particular files produced by bison, flex, perl, and well as html and
man documentation. We have done this consistent with established
practice at the time to not require these tools for building from a
tarball. Some of these tools were hard to get, or get the right
version of, from time to time, and shipping the prebuilt output was a
convenience to users.
Now this has at least two problems:
One, we have to make the build system(s) work in two modes: Building
from a git checkout and building from a tarball. This is pretty
complicated, but it works so far for autoconf/make. It does not
currently work for meson; you can currently only build with meson from
a git checkout. Making meson builds work from a tarball seems very
difficult or impossible. One particular problem is that since meson
requires a separate build directory, we cannot make the build update
files like gram.h in the source tree. So if you were to build from a
tarball and update gram.y, you will have a gram.h in the source tree
and one in the build tree, but the way things work is that the
compiler will always use the one in the source tree. So you cannot,
for example, make any gram.y changes when building from a tarball.
This seems impossible to fix in a non-horrible way.
Second, there is increased interest nowadays in precisely tracking the
origin of software. We can reasonably track contributions into the
git tree, and users can reasonably track the path from a tarball to
packages and downloads and installs. But what happens between the git
tree and the tarball is obscure and in some cases non-reproducible.
The solution for both of these issues is to get rid of the step that
adds prebuilt files to the tarball. The tarball now only contains
what is in the git tree (*). Getting the additional build
dependencies is no longer a problem nowadays, and the complications to
keep these dual build modes working are significant. And of course we
want to get the meson build system working universally.
This commit removes the make distprep target altogether. The make
dist target continues to do its job, it just doesn't call distprep
anymore.
(*) - The tarball also contains the INSTALL file that is built at make
dist time, but not by distprep. This is unchanged for now.
The make maintainer-clean target, whose job it is to remove the
prebuilt files in addition to what make distclean does, is now just an
alias to make distprep. (In practice, it is probably obsolete given
that git clean is available.)
The following programs are now hard build requirements in configure
(they were already required by meson.build):
- bison
- flex
- perl
Reviewed-by: Michael Paquier <michael@paquier.xyz>
Reviewed-by: Andres Freund <andres@anarazel.de>
Discussion: https://www.postgresql.org/message-id/flat/e07408d9-e5f2-d9fd-5672-f53354e9305e@eisentraut.org
2023-11-06 14:51:52 +01:00
|
|
|
clean distclean:
|
2020-01-16 21:56:32 +01:00
|
|
|
rm -f initdb$(X) $(OBJS) localtime.c
|
2014-04-25 21:40:35 +02:00
|
|
|
rm -rf tmp_check
|
2003-12-23 22:56:21 +01:00
|
|
|
|
2004-05-11 23:57:15 +02:00
|
|
|
# ensure that changes in datadir propagate into object file
|
2003-12-23 22:56:21 +01:00
|
|
|
initdb.o: initdb.c $(top_builddir)/src/Makefile.global
|
2014-04-15 03:33:46 +02:00
|
|
|
|
2022-03-17 11:11:21 +01:00
|
|
|
export with_icu
|
|
|
|
|
2015-04-30 02:34:22 +02:00
|
|
|
check:
|
2014-04-15 03:33:46 +02:00
|
|
|
$(prove_check)
|
|
|
|
|
|
|
|
installcheck:
|
|
|
|
$(prove_installcheck)
|