1 #-------------------------------------------------------------------------
3 # Makefile for src/bin/psql
5 # Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group
6 # Portions Copyright (c) 1994, Regents of the University of California
8 # $PostgreSQL: pgsql/src/bin/psql/Makefile,v 1.63 2009/06/23 03:46:00 tgl Exp $
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 keywords.o kwlookup.o \
30 all: submake-libpq submake-libpgport psql
32 psql: $(OBJS) $(libpq_builddir)/libpq.a
33 $(CC) $(CFLAGS) $(OBJS) $(libpq_pgport) $(LDFLAGS) $(LIBS) -o $@$(X)
35 help.o: $(srcdir)/sql_help.h
37 dumputils.c keywords.c: % : $(top_srcdir)/src/bin/pg_dump/%
38 rm -f $@ && $(LN_S) $< .
40 kwlookup.c: % : $(top_srcdir)/src/backend/parser/%
41 rm -f $@ && $(LN_S) $< .
43 $(srcdir)/sql_help.h: create_help.pl $(wildcard $(REFDOCDIR)/*.sgml)
44 $(PERL) $< $(REFDOCDIR) $@
46 $(srcdir)/psqlscan.c: psqlscan.l
48 $(FLEX) $(FLEXFLAGS) -o'$@' $<
50 @$(missing) flex $< $@
53 distprep: $(srcdir)/sql_help.h $(srcdir)/psqlscan.c
55 install: all installdirs
56 $(INSTALL_PROGRAM) psql$(X) '$(DESTDIR)$(bindir)/psql$(X)'
57 $(INSTALL_DATA) $(srcdir)/psqlrc.sample '$(DESTDIR)$(datadir)/psqlrc.sample'
60 $(mkinstalldirs) '$(DESTDIR)$(bindir)'
63 rm -f '$(DESTDIR)$(bindir)/psql$(X)' '$(DESTDIR)$(datadir)/psqlrc.sample'
65 # psqlscan.c is in the distribution tarball, so is not cleaned here
67 rm -f psql$(X) $(OBJS) dumputils.c keywords.c kwlookup.c
69 maintainer-clean: distclean
70 rm -f $(srcdir)/sql_help.h $(srcdir)/psqlscan.c