1 #-------------------------------------------------------------------------
3 # Makefile for src/bin/psql
5 # Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
6 # Portions Copyright (c) 1994, Regents of the University of California
8 # $PostgreSQL: pgsql/src/bin/psql/Makefile,v 1.48 2004/10/04 13:43:57 momjian 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) -DFRONTEND
20 OBJS= command.o common.o help.o input.o stringutils.o mainloop.o copy.o \
21 startup.o prompt.o variables.o large_obj.o print.o describe.o \
22 psqlscan.o tab-complete.o mbprint.o
27 all: submake-libpq submake-libpgport psql
29 psql: $(OBJS) $(libpq_builddir)/libpq.a
30 $(CC) $(CFLAGS) $(OBJS) $(libpq) $(LDFLAGS) $(LIBS) -o $@$(X)
32 help.o: $(srcdir)/sql_help.h
35 $(srcdir)/sql_help.h: create_help.pl $(wildcard $(REFDOCDIR)/*.sgml)
36 $(PERL) $< $(REFDOCDIR) $@
39 @echo "*** Perl is needed to build psql help."
42 $(srcdir)/psqlscan.c: psqlscan.l
44 $(FLEX) $(FLEXFLAGS) -o'$@' $<
46 @$(missing) flex $< $@
49 distprep: $(srcdir)/sql_help.h $(srcdir)/psqlscan.c
51 install: all installdirs
52 $(INSTALL_PROGRAM) psql$(X) $(DESTDIR)$(bindir)/psql$(X)
53 $(INSTALL_DATA) $(srcdir)/psqlrc.sample $(DESTDIR)$(datadir)/psqlrc.sample
56 $(mkinstalldirs) $(DESTDIR)$(bindir)
59 rm -f $(DESTDIR)$(bindir)/psql$(X)
61 # psqlscan.c is in the distribution tarball, so is not cleaned here
63 rm -f psql$(X) $(OBJS)
65 maintainer-clean: distclean
66 rm -f $(srcdir)/sql_help.h $(srcdir)/psqlscan.c