OSDN Git Service

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