1 #-------------------------------------------------------------------------
3 # Makefile for src/bin/psql
5 # Portions Copyright (c) 1996-2025, 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 # make this available to TAP test scripts
22 REFDOCDIR
= $(top_srcdir
)/doc
/src
/sgml
/ref
24 override CPPFLAGS
:= -I.
-I
$(srcdir) -I
$(libpq_srcdir
) $(CPPFLAGS
)
25 LDFLAGS_INTERNAL
+= -L
$(top_builddir
)/src
/fe_utils
-lpgfeutils
$(libpq_pgport
)
49 psql
: $(OBJS
) | submake-libpq submake-libpgport submake-libpgfeutils
50 $(CC
) $(CFLAGS
) $(OBJS
) $(LDFLAGS
) $(LDFLAGS_EX
) $(LIBS
) -o
$@
$(X
)
54 # See notes in src/backend/parser/Makefile about the following two rules
55 sql_help.c
: sql_help.h
58 sql_help.h
: create_help.pl
$(wildcard $(REFDOCDIR
)/*.sgml
)
59 $(PERL
) $< --docdir
$(REFDOCDIR
) --basename $*
61 psqlscanslash.c
: FLEXFLAGS
= -Cfe
-p
-p
62 psqlscanslash.c
: FLEX_NO_BACKUP
=yes
64 tab-complete.c
: gen_tabcomplete.pl tab-complete.in.c
65 $(PERL
) $^
--outfile
$@
67 install: all installdirs
68 $(INSTALL_PROGRAM
) psql
$(X
) '$(DESTDIR)$(bindir)/psql$(X)'
69 $(INSTALL_DATA
) $(srcdir)/psqlrc.sample
'$(DESTDIR)$(datadir)/psqlrc.sample'
72 $(MKDIR_P
) '$(DESTDIR)$(bindir)' '$(DESTDIR)$(datadir)'
75 rm -f
'$(DESTDIR)$(bindir)/psql$(X)' '$(DESTDIR)$(datadir)/psqlrc.sample'
78 rm -f psql
$(X
) $(OBJS
) lex.backup
80 rm -f sql_help.h sql_help.c psqlscanslash.c tab-complete.c