]> granicus.if.org Git - postgresql/blob - src/bin/psql/Makefile
Re-add elog() to exec.c, per Tom.
[postgresql] / src / bin / psql / Makefile
1 #-------------------------------------------------------------------------
2 #
3 # Makefile for src/bin/psql
4 #
5 # Portions Copyright (c) 1996-2002, 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.46 2004/05/19 17:15:21 momjian Exp $
9 #
10 #-------------------------------------------------------------------------
11
12 subdir = src/bin/psql
13 top_builddir = ../../..
14 include $(top_builddir)/src/Makefile.global
15
16 REFDOCDIR= $(top_srcdir)/doc/src/sgml/ref
17
18 override CPPFLAGS := -I$(libpq_srcdir) $(CPPFLAGS) -DFRONTEND
19
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 \
23         $(filter exec.o, $(LIBOBJS))
24
25 FLEXFLAGS = -Cfe
26
27
28 all: submake-libpq submake-libpgport psql
29
30 psql: $(OBJS) $(libpq_builddir)/libpq.a
31         $(CC) $(CFLAGS) $(OBJS) $(libpq) $(LDFLAGS) $(LIBS) -o $@$(X)
32
33 exec.c: % : $(top_srcdir)/src/port/%
34         rm -f $@ && $(LN_S) $< .
35
36 help.o: $(srcdir)/sql_help.h
37
38 ifdef PERL
39 $(srcdir)/sql_help.h: create_help.pl $(wildcard $(REFDOCDIR)/*.sgml)
40         $(PERL) $< $(REFDOCDIR) $@
41 else
42 $(srcdir)/sql_help.h:
43         @echo "*** Perl is needed to build psql help."
44 endif
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)
64
65 # psqlscan.c is in the distribution tarball, so is not cleaned here
66 clean distclean:
67         rm -f psql$(X) $(OBJS) exec.c
68
69 maintainer-clean: distclean
70         rm -f $(srcdir)/sql_help.h $(srcdir)/psqlscan.c