1 #-------------------------------------------------------------------------
3 # Makefile for src/bin/psql
5 # Portions Copyright (c) 1996-2010, PostgreSQL Global Development Group
6 # Portions Copyright (c) 1994, Regents of the University of California
8 # src/bin/psql/Makefile
10 #-------------------------------------------------------------------------
12 PGFILEDESC = "psql - the PostgreSQL interactive terminal"
16 top_builddir = ../../..
17 include $(top_builddir)/src/Makefile.global
19 REFDOCDIR= $(top_srcdir)/doc/src/sgml/ref
21 override CPPFLAGS := -I. -I$(srcdir) -I$(libpq_srcdir) -I$(top_srcdir)/src/bin/pg_dump $(CPPFLAGS)
23 OBJS= command.o common.o help.o input.o stringutils.o mainloop.o copy.o \
24 startup.o prompt.o variables.o large_obj.o print.o describe.o \
25 tab-complete.o mbprint.o dumputils.o keywords.o kwlookup.o \
32 all: submake-libpq submake-libpgport psql
34 psql: $(OBJS) $(libpq_builddir)/libpq.a
35 $(CC) $(CFLAGS) $(OBJS) $(libpq_pgport) $(LDFLAGS) $(LDFLAGS_EX) $(LIBS) -o $@$(X)
39 dumputils.c keywords.c: % : $(top_srcdir)/src/bin/pg_dump/%
40 rm -f $@ && $(LN_S) $< .
42 kwlookup.c: % : $(top_srcdir)/src/backend/parser/%
43 rm -f $@ && $(LN_S) $< .
45 sql_help.c: sql_help.h ;
46 sql_help.h: create_help.pl $(wildcard $(REFDOCDIR)/*.sgml)
47 $(PERL) $< $(REFDOCDIR) $*
49 # psqlscan is compiled as part of mainloop
50 mainloop.o: psqlscan.c
52 psqlscan.c: psqlscan.l
54 $(FLEX) $(FLEXFLAGS) -o'$@' $<
56 @$(missing) flex $< $@
59 distprep: sql_help.h psqlscan.c
61 install: all installdirs
62 $(INSTALL_PROGRAM) psql$(X) '$(DESTDIR)$(bindir)/psql$(X)'
63 $(INSTALL_DATA) $(srcdir)/psqlrc.sample '$(DESTDIR)$(datadir)/psqlrc.sample'
66 $(MKDIR_P) '$(DESTDIR)$(bindir)'
69 rm -f '$(DESTDIR)$(bindir)/psql$(X)' '$(DESTDIR)$(datadir)/psqlrc.sample'
71 # psqlscan.c is in the distribution tarball, so is not cleaned here
73 rm -f psql$(X) $(OBJS) dumputils.c keywords.c kwlookup.c
75 maintainer-clean: distclean
76 rm -f sql_help.h sql_help.c psqlscan.c