mirror of
https://github.com/postgres/postgres.git
synced 2026-04-24 15:47:01 -04:00
The original coding here was not nearly careful enough about quoting special characters, and it didn't get corner cases right for constructing the pg_ctl path either. Use join_path_components() and appendShellString() to do it honestly, so that the string will more likely work if blindly copied-and-pasted. While at it, teach appendShellString() not to quote strings that clearly don't need it, so that the output from initdb doesn't become uglier than it was before in typical cases where quoting is not needed. Ryan Murphy, reviewed by Michael Paquier and myself Discussion: <CAHeEsBeAe1FeBypT3E8R1ZVZU0e8xv3A-7BHg6bEOi=jZny2Uw@mail.gmail.com>
68 lines
1.9 KiB
Makefile
68 lines
1.9 KiB
Makefile
#-------------------------------------------------------------------------
|
|
#
|
|
# Makefile for src/bin/initdb
|
|
#
|
|
# Portions Copyright (c) 1996-2016, PostgreSQL Global Development Group
|
|
# Portions Copyright (c) 1994, Regents of the University of California
|
|
#
|
|
# src/bin/initdb/Makefile
|
|
#
|
|
#-------------------------------------------------------------------------
|
|
|
|
PGFILEDESC = "initdb - initialize a new database cluster"
|
|
PGAPPICON=win32
|
|
|
|
subdir = src/bin/initdb
|
|
top_builddir = ../../..
|
|
include $(top_builddir)/src/Makefile.global
|
|
|
|
override CPPFLAGS := -DFRONTEND -I$(libpq_srcdir) -I$(top_srcdir)/src/timezone $(CPPFLAGS)
|
|
|
|
# note: we need libpq only because fe_utils does
|
|
LDFLAGS += -L$(top_builddir)/src/fe_utils -lpgfeutils $(libpq_pgport)
|
|
|
|
# use system timezone data?
|
|
ifneq (,$(with_system_tzdata))
|
|
override CPPFLAGS += '-DSYSTEMTZDIR="$(with_system_tzdata)"'
|
|
endif
|
|
|
|
OBJS= initdb.o findtimezone.o localtime.o encnames.o $(WIN32RES)
|
|
|
|
all: initdb
|
|
|
|
initdb: $(OBJS) | submake-libpgport
|
|
$(CC) $(CFLAGS) $(OBJS) $(LDFLAGS) $(LDFLAGS_EX) $(LIBS) -o $@$(X)
|
|
|
|
# We used to pull in all of libpq to get encnames.c, but that
|
|
# exposes us to risks of version skew if we link to a shared library.
|
|
# Do it the hard way, instead, so that we're statically linked.
|
|
|
|
encnames.c: % : $(top_srcdir)/src/backend/utils/mb/%
|
|
rm -f $@ && $(LN_S) $< .
|
|
|
|
# Likewise, pull in localtime.c from src/timezones
|
|
|
|
localtime.c: % : $(top_srcdir)/src/timezone/%
|
|
rm -f $@ && $(LN_S) $< .
|
|
|
|
install: all installdirs
|
|
$(INSTALL_PROGRAM) initdb$(X) '$(DESTDIR)$(bindir)/initdb$(X)'
|
|
|
|
installdirs:
|
|
$(MKDIR_P) '$(DESTDIR)$(bindir)'
|
|
|
|
uninstall:
|
|
rm -f '$(DESTDIR)$(bindir)/initdb$(X)'
|
|
|
|
clean distclean maintainer-clean:
|
|
rm -f initdb$(X) $(OBJS) encnames.c localtime.c
|
|
rm -rf tmp_check
|
|
|
|
# ensure that changes in datadir propagate into object file
|
|
initdb.o: initdb.c $(top_builddir)/src/Makefile.global
|
|
|
|
check:
|
|
$(prove_check)
|
|
|
|
installcheck:
|
|
$(prove_installcheck)
|