Skip to content

Commit 279598b

Browse files
committed
Add C version of initdb, from Andrew Dunstan.
This is his original version with a binary rmdir() we might need in the future. I will commit an update version with cleanups shortly.
1 parent 5e8a886 commit 279598b

File tree

4 files changed

+2782
-1169
lines changed

4 files changed

+2782
-1169
lines changed

src/bin/initdb/Makefile

Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -5,33 +5,38 @@
55
# Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
66
# Portions Copyright (c) 1994, Regents of the University of California
77
#
8-
# $Header: /cvsroot/pgsql/src/bin/initdb/Makefile,v 1.29 2003/09/07 03:36:03 tgl Exp $
8+
# $Header: /cvsroot/pgsql/src/bin/initdb/Makefile,v 1.30 2003/11/10 22:51:16 momjian Exp $
99
#
1010
#-------------------------------------------------------------------------
1111

1212
subdir = src/bin/initdb
1313
top_builddir = ../../..
1414
include $(top_builddir)/src/Makefile.global
1515

16-
all: initdb
16+
override CPPFLAGS := -DPGBINDIR=\"$(bindir)\" -DPGDATADIR=\"$(datadir)\" -DFRONTEND -I$(libpq_srcdir) $(CPPFLAGS)
1717

18-
initdb: initdb.sh $(top_builddir)/src/Makefile.global
19-
sed -e 's/@VERSION@/$(VERSION)/g' \
20-
-e 's,@SHELL@,$(SHELL),g' \
21-
-e 's,@HAVE_IPV6@,$(HAVE_IPV6),g' \
22-
-e 's,@bindir@,$(bindir),g' \
23-
-e 's,@datadir@,$(datadir),g' \
24-
$< >$@
25-
chmod a+x $@
18+
OBJS= initdb.o sprompt.o
19+
ifeq ($(PORTNAME), win32)
20+
OBJS+=dirmod.o
21+
endif
22+
23+
all: submake-libpq submake-libpgport initdb
24+
25+
initdb: $(OBJS) $(libpq_builddir)/libpq.a
26+
$(CC) $(CFLAGS) $(OBJS) $(libpq) $(LDFLAGS) $(LIBS) -o $@
27+
28+
dirmod.c sprompt.c: % : $(top_srcdir)/src/port/%
29+
rm -f $@ && $(LN_S) $< .
2630

2731
install: all installdirs
28-
$(INSTALL_SCRIPT) initdb $(DESTDIR)$(bindir)/initdb
32+
$(INSTALL_PROGRAM) initdb$(X) $(DESTDIR)$(bindir)/initdb$(X)
33+
$(INSTALL_DATA) $(srcdir)/system_views.sql $(DESTDIR)$(datadir)/system_views.sql
2934

3035
installdirs:
3136
$(mkinstalldirs) $(DESTDIR)$(bindir)
3237

3338
uninstall:
34-
rm -f $(DESTDIR)$(bindir)/initdb
39+
rm -f $(DESTDIR)$(bindir)/initdb$(X) $(DESTDIR)$(datadir)/system_views.sql
3540

36-
clean distclean maintainer-clean:
37-
rm -f initdb
41+
clean distclean:
42+
rm -f initdb$(X) $(OBJS)

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy