Makefile 2.0 KB
Newer Older
1 2 3 4 5 6
#-------------------------------------------------------------------------
#
# Makefile for src/bin/psql
#
# Copyright (c) 1994, Regents of the University of California
#
7
# $Header: /cvsroot/pgsql/src/bin/psql/Makefile,v 1.25 2000/09/17 13:02:43 petere Exp $
8 9 10 11 12
#
#-------------------------------------------------------------------------

subdir = src/bin/psql
top_builddir = ../../..
13
include $(top_builddir)/src/Makefile.global
14 15 16

REFDOCDIR= $(top_srcdir)/doc/src/sgml/ref

17
CPPFLAGS+= -I$(libpq_srcdir)
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49

OBJS=command.o common.o help.o input.o stringutils.o mainloop.o \
	copy.o startup.o prompt.o variables.o large_obj.o print.o describe.o \
	tab-complete.o

all: submake psql$(X)

ifdef STRDUP
OBJS+=$(top_builddir)/src/utils/strdup.o

$(top_builddir)/src/utils/strdup.o:
	$(MAKE) -C $(top_builddir)/src/utils strdup.o
endif

# Move these to the utils directory?

ifdef STRERROR
OBJS+=$(top_builddir)/src/backend/port/strerror.o

$(top_builddir)/src/backend/port/strerror.o:
	$(MAKE) -C $(top_builddir)/src/backend/port strerror.o
endif

ifdef SNPRINTF
OBJS+=$(top_builddir)/src/backend/port/snprintf.o

$(top_builddir)/src/backend/port/snprintf.o:
	$(MAKE) -C $(top_builddir)/src/backend/port snprintf.o
endif

# End of hacks for picking up backend 'port' modules

50 51
psql$(X): $(OBJS) $(libpq_builddir)/libpq.a
	$(CC) $(CFLAGS) -o $@ $(OBJS) $(libpq) $(LDFLAGS)
52 53 54 55 56 57 58 59 60 61 62 63 64 65

help.o: $(srcdir)/sql_help.h

ifdef PERL
$(srcdir)/sql_help.h: create_help.pl $(wildcard $(REFDOCDIR)/*.sgml)
	$(PERL) $< $(REFDOCDIR) $@
else
$(srcdir)/sql_help.h:
	@echo "*** Perl is needed to build psql help."
endif

.PHONY: submake

submake:
66
	$(MAKE) -C $(libpq_builddir) all
67

68 69
distprep: $(srcdir)/sql_help.h

70
install: all installdirs
71
	$(INSTALL_PROGRAM) psql$(X) $(DESTDIR)$(bindir)/psql$(X)
72 73

installdirs:
74
	$(mkinstalldirs) $(DESTDIR)$(bindir)
75 76

uninstall:
77
	rm -f $(DESTDIR)$(bindir)/psql$(X)
78 79 80 81 82 83 84 85 86 87 88 89 90

depend dep:
	$(CC) -MM -MG $(CFLAGS) *.c >depend

clean distclean:
	rm -f psql$(X) $(OBJS)

maintainer-clean: distclean
	rm -f sql_help.h

ifeq (depend,$(wildcard depend))
include depend
endif