OSDN Git Service

Fix the makefiles to fail cleanly if Perl is needed but not present. This
[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.63 2009/06/23 03:46:00 tgl 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 keywords.o kwlookup.o \
25         $(WIN32RES)
26
27 FLEXFLAGS = -Cfe
28
29
30 all: submake-libpq submake-libpgport psql
31
32 psql: $(OBJS) $(libpq_builddir)/libpq.a
33         $(CC) $(CFLAGS) $(OBJS) $(libpq_pgport) $(LDFLAGS) $(LIBS) -o $@$(X)
34
35 help.o: $(srcdir)/sql_help.h
36
37 dumputils.c keywords.c: % : $(top_srcdir)/src/bin/pg_dump/%
38         rm -f $@ && $(LN_S) $< .
39
40 kwlookup.c: % : $(top_srcdir)/src/backend/parser/%
41         rm -f $@ && $(LN_S) $< .
42
43 $(srcdir)/sql_help.h: create_help.pl $(wildcard $(REFDOCDIR)/*.sgml)
44         $(PERL) $< $(REFDOCDIR) $@
45
46 $(srcdir)/psqlscan.c: psqlscan.l
47 ifdef FLEX
48         $(FLEX) $(FLEXFLAGS) -o'$@' $<
49 else
50         @$(missing) flex $< $@
51 endif
52
53 distprep: $(srcdir)/sql_help.h $(srcdir)/psqlscan.c
54
55 install: all installdirs
56         $(INSTALL_PROGRAM) psql$(X) '$(DESTDIR)$(bindir)/psql$(X)'
57         $(INSTALL_DATA) $(srcdir)/psqlrc.sample '$(DESTDIR)$(datadir)/psqlrc.sample'
58
59 installdirs:
60         $(mkinstalldirs) '$(DESTDIR)$(bindir)'
61
62 uninstall:
63         rm -f '$(DESTDIR)$(bindir)/psql$(X)' '$(DESTDIR)$(datadir)/psqlrc.sample'
64
65 # psqlscan.c is in the distribution tarball, so is not cleaned here
66 clean distclean:
67         rm -f psql$(X) $(OBJS) dumputils.c keywords.c kwlookup.c
68
69 maintainer-clean: distclean
70         rm -f $(srcdir)/sql_help.h $(srcdir)/psqlscan.c