OSDN Git Service

Have libpgport link before libpq so that PG client applications are more
[pg-rex/syncrep.git] / src / bin / psql / Makefile
1 #-------------------------------------------------------------------------
2 #
3 # Makefile for src/bin/psql
4 #
5 # Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
6 # Portions Copyright (c) 1994, Regents of the University of California
7 #
8 # $PostgreSQL: pgsql/src/bin/psql/Makefile,v 1.53 2005/03/25 18:17:13 momjian Exp $
9 #
10 #-------------------------------------------------------------------------
11
12 PGFILEDESC = "psql - the PostgreSQL interactive terminal"
13 PGAPPICON=win32
14 subdir = src/bin/psql
15 top_builddir = ../../..
16 include $(top_builddir)/src/Makefile.global
17
18 REFDOCDIR= $(top_srcdir)/doc/src/sgml/ref
19
20 override CPPFLAGS := -DFRONTEND -I$(libpq_srcdir) $(CPPFLAGS)
21
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 $(WIN32RES)
25
26 FLEXFLAGS = -Cfe
27
28
29 all: submake-libpq submake-libpgport psql
30
31 psql: $(OBJS) $(libpq_builddir)/libpq.a
32         $(CC) $(CFLAGS) $(OBJS) $(libpq_pgport) $(LDFLAGS) $(LIBS) -o $@$(X)
33
34 help.o: $(srcdir)/sql_help.h
35
36 ifdef PERL
37 $(srcdir)/sql_help.h: create_help.pl $(wildcard $(REFDOCDIR)/*.sgml)
38         $(PERL) $< $(REFDOCDIR) $@
39 else
40 $(srcdir)/sql_help.h:
41         @echo "*** Perl is needed to build psql help."
42 endif
43
44 $(srcdir)/psqlscan.c: psqlscan.l
45 ifdef FLEX
46         $(FLEX) $(FLEXFLAGS) -o'$@' $<
47 else
48         @$(missing) flex $< $@
49 endif
50
51 distprep: $(srcdir)/sql_help.h $(srcdir)/psqlscan.c
52
53 install: all installdirs
54         $(INSTALL_PROGRAM) psql$(X) $(DESTDIR)$(bindir)/psql$(X)
55         $(INSTALL_DATA) $(srcdir)/psqlrc.sample $(DESTDIR)$(datadir)/psqlrc.sample
56
57 installdirs:
58         $(mkinstalldirs) $(DESTDIR)$(bindir)
59
60 uninstall:
61         rm -f $(DESTDIR)$(bindir)/psql$(X)
62
63 # psqlscan.c is in the distribution tarball, so is not cleaned here
64 clean distclean:
65         rm -f psql$(X) $(OBJS)
66
67 maintainer-clean: distclean
68         rm -f $(srcdir)/sql_help.h $(srcdir)/psqlscan.c