1 #-------------------------------------------------------------------------
3 # Makefile for src/bin/psql
5 # Portions Copyright (c) 1996-2008, PostgreSQL Global Development Group
6 # Portions Copyright (c) 1994, Regents of the University of California
10 #-------------------------------------------------------------------------
12 PGFILEDESC
= "psql - the PostgreSQL interactive terminal"
15 top_builddir
= ..
/..
/..
16 include $(top_builddir
)/src
/Makefile.global
18 REFDOCDIR
= $(top_srcdir
)/doc
/src
/sgml
/ref
20 override CPPFLAGS
:= -I
$(srcdir) -I
$(libpq_srcdir
) -I
$(top_srcdir
)/src
/bin
/pg_dump
$(CPPFLAGS
)
22 OBJS
= command.o common.o help.o input.o stringutils.o mainloop.o copy.o \
23 startup.o prompt.o variables.o large_obj.o
print.o describe.o \
24 psqlscan.o tab-complete.o mbprint.o dumputils.o
$(WIN32RES
)
26 EXTRA_OBJS
= $(top_builddir
)/src
/backend
/parser
/keywords.o
31 all: submake-libpq submake-libpgport submake-backend psql
33 psql
: $(OBJS
) $(libpq_builddir
)/libpq.a
34 $(CC
) $(CFLAGS
) $(OBJS
) $(EXTRA_OBJS
) $(libpq_pgport
) $(LDFLAGS
) $(LIBS
) -o
$@
$(X
)
36 help.o
: $(srcdir)/sql_help.h
38 dumputils.c
: % : $(top_srcdir
)/src
/bin
/pg_dump
/%
39 rm -f
$@
&& $(LN_S
) $< .
42 $(srcdir)/sql_help.h
: create_help.pl
$(wildcard $(REFDOCDIR
)/*.sgml
)
43 $(PERL
) $< $(REFDOCDIR
) $@
46 @echo
"*** Perl is needed to build psql help."
49 $(srcdir)/psqlscan.c
: psqlscan.l
51 $(FLEX
) $(FLEXFLAGS
) -o
'$@' $<
53 @
$(missing
) flex
$< $@
56 .PHONY
: submake-backend
58 $(MAKE
) -C
$(top_builddir
)/src
/backend
/parser keywords.o
60 distprep
: $(srcdir)/sql_help.h
$(srcdir)/psqlscan.c
62 install: all installdirs
63 $(INSTALL_PROGRAM
) psql
$(X
) '$(DESTDIR)$(bindir)/psql$(X)'
64 $(INSTALL_DATA
) $(srcdir)/psqlrc.sample
'$(DESTDIR)$(datadir)/psqlrc.sample'
67 $(mkinstalldirs
) '$(DESTDIR)$(bindir)'
70 rm -f
'$(DESTDIR)$(bindir)/psql$(X)' '$(DESTDIR)$(datadir)/psqlrc.sample'
72 # psqlscan.c is in the distribution tarball, so is not cleaned here
74 rm -f psql
$(X
) $(OBJS
) dumputils.c
76 maintainer-clean
: distclean
77 rm -f
$(srcdir)/sql_help.h
$(srcdir)/psqlscan.c