1 #-------------------------------------------------------------------------
3 # Makefile for src/bin/initdb
5 # Portions Copyright (c) 1996-2021, PostgreSQL Global Development Group
6 # Portions Copyright (c) 1994, Regents of the University of California
8 # src/bin/initdb/Makefile
10 #-------------------------------------------------------------------------
12 PGFILEDESC
= "initdb - initialize a new database cluster"
15 subdir
= src
/bin
/initdb
16 top_builddir
= ..
/..
/..
17 include $(top_builddir
)/src
/Makefile.global
19 override CPPFLAGS
:= -DFRONTEND
-I
$(libpq_srcdir
) -I
$(top_srcdir
)/src
/timezone
$(CPPFLAGS
)
21 # Note: it's important that we link to encnames.o from libpgcommon, not
22 # from libpq, else we have risks of version skew if we run with a libpq
23 # shared library from a different PG version. The libpq_pgport macro
24 # should ensure that that happens.
26 # We need libpq only because fe_utils does.
27 LDFLAGS_INTERNAL
+= -L
$(top_builddir
)/src
/fe_utils
-lpgfeutils
$(libpq_pgport
)
29 # use system timezone data?
30 ifneq (,$(with_system_tzdata
))
31 override CPPFLAGS
+= '-DSYSTEMTZDIR="$(with_system_tzdata)"'
42 initdb
: $(OBJS
) | submake-libpq submake-libpgport submake-libpgfeutils
43 $(CC
) $(CFLAGS
) $(OBJS
) $(LDFLAGS
) $(LDFLAGS_EX
) $(LIBS
) -o
$@
$(X
)
45 # We must pull in localtime.c from src/timezones
46 localtime.c
: % : $(top_srcdir
)/src
/timezone
/%
47 rm -f
$@
&& $(LN_S
) $< .
49 install: all installdirs
50 $(INSTALL_PROGRAM
) initdb
$(X
) '$(DESTDIR)$(bindir)/initdb$(X)'
53 $(MKDIR_P
) '$(DESTDIR)$(bindir)'
56 rm -f
'$(DESTDIR)$(bindir)/initdb$(X)'
58 clean distclean maintainer-clean
:
59 rm -f initdb
$(X
) $(OBJS
) localtime.c
62 # ensure that changes in datadir propagate into object file
63 initdb.o
: initdb.c
$(top_builddir
)/src
/Makefile.global