OSDN Git Service

3b54c44da8e35321dd90ae7a8b4a0c90a1ddbe57
[pg-rex/syncrep.git] / src / bin / psql / Makefile
1 #-------------------------------------------------------------------------
2 #
3 # Makefile for src/bin/psql
4 #
5 # Copyright (c) 1994, Regents of the University of California
6 #
7 # $Header: /cvsroot/pgsql/src/bin/psql/Makefile,v 1.27 2000/11/30 20:36:12 petere Exp $
8 #
9 #-------------------------------------------------------------------------
10
11 subdir = src/bin/psql
12 top_builddir = ../../..
13 include $(top_builddir)/src/Makefile.global
14
15 REFDOCDIR= $(top_srcdir)/doc/src/sgml/ref
16
17 override CPPFLAGS+= -I$(libpq_srcdir)
18
19 OBJS=command.o common.o help.o input.o stringutils.o mainloop.o \
20         copy.o startup.o prompt.o variables.o large_obj.o print.o describe.o \
21         tab-complete.o
22
23 all: submake psql
24
25 ifdef STRDUP
26 OBJS+=$(top_builddir)/src/utils/strdup.o
27
28 $(top_builddir)/src/utils/strdup.o:
29         $(MAKE) -C $(top_builddir)/src/utils strdup.o
30 endif
31
32 # Move these to the utils directory?
33
34 ifdef STRERROR
35 OBJS+=$(top_builddir)/src/backend/port/strerror.o
36
37 $(top_builddir)/src/backend/port/strerror.o:
38         $(MAKE) -C $(top_builddir)/src/backend/port strerror.o
39 endif
40
41 ifdef SNPRINTF
42 OBJS+=$(top_builddir)/src/backend/port/snprintf.o
43
44 $(top_builddir)/src/backend/port/snprintf.o:
45         $(MAKE) -C $(top_builddir)/src/backend/port snprintf.o
46 endif
47
48 # End of hacks for picking up backend 'port' modules
49
50 psql: $(OBJS) $(libpq_builddir)/libpq.a
51         $(CC) $(CFLAGS) $(LDFLAGS) $(OBJS) $(libpq) $(LIBS) -o $@
52
53 help.o: $(srcdir)/sql_help.h
54
55 ifdef PERL
56 $(srcdir)/sql_help.h: create_help.pl $(wildcard $(REFDOCDIR)/*.sgml)
57         $(PERL) $< $(REFDOCDIR) $@
58 else
59 $(srcdir)/sql_help.h:
60         @echo "*** Perl is needed to build psql help."
61 endif
62
63 .PHONY: submake
64
65 submake:
66         $(MAKE) -C $(libpq_builddir) all
67
68 distprep: $(srcdir)/sql_help.h
69
70 install: all installdirs
71         $(INSTALL_PROGRAM) psql$(X) $(DESTDIR)$(bindir)/psql$(X)
72
73 installdirs:
74         $(mkinstalldirs) $(DESTDIR)$(bindir)
75
76 uninstall:
77         rm -f $(DESTDIR)$(bindir)/psql$(X)
78
79 depend dep:
80         $(CC) -MM -MG $(CFLAGS) *.c >depend
81
82 clean distclean:
83         rm -f psql$(X) $(OBJS)
84
85 maintainer-clean: distclean
86         rm -f $(srcdir)/sql_help.h
87
88 ifeq (depend,$(wildcard depend))
89 include depend
90 endif