OSDN Git Service

Update copyright for 2009.
[pg-rex/syncrep.git] / src / bin / psql / Makefile
1 #-------------------------------------------------------------------------
2 #
3 # Makefile for src/bin/psql
4 #
5 # Portions Copyright (c) 1996-2009, 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.61 2009/01/01 17:23:54 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 := -I$(srcdir) -I$(libpq_srcdir) -I$(top_srcdir)/src/bin/pg_dump $(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 dumputils.o $(WIN32RES)
25
26 EXTRA_OBJS = $(top_builddir)/src/backend/parser/keywords.o
27
28 FLEXFLAGS = -Cfe
29
30
31 all: submake-libpq submake-libpgport submake-backend psql
32
33 psql: $(OBJS) $(libpq_builddir)/libpq.a
34         $(CC) $(CFLAGS) $(OBJS) $(EXTRA_OBJS) $(libpq_pgport) $(LDFLAGS) $(LIBS) -o $@$(X)
35
36 help.o: $(srcdir)/sql_help.h
37
38 dumputils.c: % : $(top_srcdir)/src/bin/pg_dump/%
39         rm -f $@ && $(LN_S) $< .
40
41 ifdef PERL
42 $(srcdir)/sql_help.h: create_help.pl $(wildcard $(REFDOCDIR)/*.sgml)
43         $(PERL) $< $(REFDOCDIR) $@
44 else
45 $(srcdir)/sql_help.h:
46         @echo "*** Perl is needed to build psql help."
47 endif
48
49 $(srcdir)/psqlscan.c: psqlscan.l
50 ifdef FLEX
51         $(FLEX) $(FLEXFLAGS) -o'$@' $<
52 else
53         @$(missing) flex $< $@
54 endif
55
56 .PHONY: submake-backend
57 submake-backend:
58         $(MAKE) -C $(top_builddir)/src/backend/parser keywords.o
59
60 distprep: $(srcdir)/sql_help.h $(srcdir)/psqlscan.c
61
62 install: all installdirs
63         $(INSTALL_PROGRAM) psql$(X) '$(DESTDIR)$(bindir)/psql$(X)'
64         $(INSTALL_DATA) $(srcdir)/psqlrc.sample '$(DESTDIR)$(datadir)/psqlrc.sample'
65
66 installdirs:
67         $(mkinstalldirs) '$(DESTDIR)$(bindir)'
68
69 uninstall:
70         rm -f '$(DESTDIR)$(bindir)/psql$(X)' '$(DESTDIR)$(datadir)/psqlrc.sample'
71
72 # psqlscan.c is in the distribution tarball, so is not cleaned here
73 clean distclean:
74         rm -f psql$(X) $(OBJS) dumputils.c
75
76 maintainer-clean: distclean
77         rm -f $(srcdir)/sql_help.h $(srcdir)/psqlscan.c