1 #-------------------------------------------------------------------------
3 # Makefile for src/bin/psql
5 # Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
6 # Portions Copyright (c) 1994, Regents of the University of California
8 # $Header: /cvsroot/pgsql/src/bin/psql/Makefile,v 1.30 2001/02/27 08:13:27 ishii Exp $
10 #-------------------------------------------------------------------------
13 top_builddir = ../../..
14 include $(top_builddir)/src/Makefile.global
16 REFDOCDIR= $(top_srcdir)/doc/src/sgml/ref
18 override CPPFLAGS := -I$(libpq_srcdir) $(CPPFLAGS)
20 OBJS=command.o common.o help.o input.o stringutils.o mainloop.o \
21 copy.o startup.o prompt.o variables.o large_obj.o print.o describe.o \
27 OBJS+=$(top_builddir)/src/utils/strdup.o
29 $(top_builddir)/src/utils/strdup.o:
30 $(MAKE) -C $(top_builddir)/src/utils strdup.o
33 # Move these to the utils directory?
36 OBJS+=$(top_builddir)/src/backend/port/strerror.o
38 $(top_builddir)/src/backend/port/strerror.o:
39 $(MAKE) -C $(top_builddir)/src/backend/port strerror.o
43 OBJS+=$(top_builddir)/src/backend/port/snprintf.o
45 $(top_builddir)/src/backend/port/snprintf.o:
46 $(MAKE) -C $(top_builddir)/src/backend/port snprintf.o
50 OBJS+=$(top_builddir)/src/backend/port/strtoul.o
52 $(top_builddir)/src/backend/port/strtoul.o:
53 $(MAKE) -C $(top_builddir)/src/backend/port strtoul.o
56 # End of hacks for picking up backend 'port' modules
58 psql: $(OBJS) $(libpq_builddir)/libpq.a
59 $(CC) $(CFLAGS) $(OBJS) $(libpq) $(LDFLAGS) $(LIBS) -o $@
61 help.o: $(srcdir)/sql_help.h
64 $(srcdir)/sql_help.h: create_help.pl $(wildcard $(REFDOCDIR)/*.sgml)
65 $(PERL) $< $(REFDOCDIR) $@
68 @echo "*** Perl is needed to build psql help."
74 $(MAKE) -C $(libpq_builddir) all
76 distprep: $(srcdir)/sql_help.h
78 install: all installdirs
79 $(INSTALL_PROGRAM) psql$(X) $(DESTDIR)$(bindir)/psql$(X)
82 $(mkinstalldirs) $(DESTDIR)$(bindir)
85 rm -f $(DESTDIR)$(bindir)/psql$(X)
88 $(CC) -MM -MG $(CFLAGS) *.c >depend
91 rm -f psql$(X) $(OBJS)
93 maintainer-clean: distclean
94 rm -f $(srcdir)/sql_help.h
96 ifeq (depend,$(wildcard depend))