1#------------------------------------------------------------------------- 2# 3# Makefile for src/bin/initdb 4# 5# Portions Copyright (c) 1996-2017, PostgreSQL Global Development Group 6# Portions Copyright (c) 1994, Regents of the University of California 7# 8# src/bin/initdb/Makefile 9# 10#------------------------------------------------------------------------- 11 12PGFILEDESC = "initdb - initialize a new database cluster" 13PGAPPICON=win32 14 15subdir = src/bin/initdb 16top_builddir = ../../.. 17include $(top_builddir)/src/Makefile.global 18 19override CPPFLAGS := -DFRONTEND -I$(libpq_srcdir) -I$(top_srcdir)/src/timezone $(CPPFLAGS) 20 21# note: we need libpq only because fe_utils does 22LDFLAGS_INTERNAL += -L$(top_builddir)/src/fe_utils -lpgfeutils $(libpq_pgport) 23 24# use system timezone data? 25ifneq (,$(with_system_tzdata)) 26override CPPFLAGS += '-DSYSTEMTZDIR="$(with_system_tzdata)"' 27endif 28 29OBJS= initdb.o findtimezone.o localtime.o encnames.o $(WIN32RES) 30 31all: initdb 32 33initdb: $(OBJS) | submake-libpq submake-libpgport submake-libpgfeutils 34 $(CC) $(CFLAGS) $(OBJS) $(LDFLAGS) $(LDFLAGS_EX) $(LIBS) -o $@$(X) 35 36# We used to pull in all of libpq to get encnames.c, but that 37# exposes us to risks of version skew if we link to a shared library. 38# Do it the hard way, instead, so that we're statically linked. 39 40encnames.c: % : $(top_srcdir)/src/backend/utils/mb/% 41 rm -f $@ && $(LN_S) $< . 42 43# Likewise, pull in localtime.c from src/timezones 44 45localtime.c: % : $(top_srcdir)/src/timezone/% 46 rm -f $@ && $(LN_S) $< . 47 48install: all installdirs 49 $(INSTALL_PROGRAM) initdb$(X) '$(DESTDIR)$(bindir)/initdb$(X)' 50 51installdirs: 52 $(MKDIR_P) '$(DESTDIR)$(bindir)' 53 54uninstall: 55 rm -f '$(DESTDIR)$(bindir)/initdb$(X)' 56 57clean distclean maintainer-clean: 58 rm -f initdb$(X) $(OBJS) encnames.c localtime.c 59 rm -rf tmp_check 60 61# ensure that changes in datadir propagate into object file 62initdb.o: initdb.c $(top_builddir)/src/Makefile.global 63 64check: 65 $(prove_check) 66 67installcheck: 68 $(prove_installcheck) 69