]> granicus.if.org Git - postgresql/blob - src/interfaces/libpq/Makefile
Avoid dependency on backend's multibyte module as possible.
[postgresql] / src / interfaces / libpq / Makefile
1 #-------------------------------------------------------------------------
2 #
3 # Makefile for src/interfaces/libpq library
4 #
5 # Copyright (c) 1994, Regents of the University of California
6 #
7 # $Header: /cvsroot/pgsql/src/interfaces/libpq/Makefile,v 1.47 2000/10/30 10:31:45 ishii Exp $
8 #
9 #-------------------------------------------------------------------------
10
11 subdir = src/interfaces/libpq
12 top_builddir = ../../..
13 include $(top_builddir)/src/Makefile.global
14
15 # shared library parameters
16 NAME= pq
17 SO_MAJOR_VERSION= 2
18 SO_MINOR_VERSION= 1
19
20 override CPPFLAGS += -DFRONTEND -I$(srcdir) -DSYSCONFDIR='"$(sysconfdir)"'
21
22 OBJS= fe-auth.o fe-connect.o fe-exec.o fe-misc.o fe-print.o fe-lobj.o \
23       pqexpbuffer.o dllist.o pqsignal.o $(SNPRINTF) $(INET_ATON)
24
25 ifdef MULTIBYTE
26 OBJS+= common.o wchar.o
27 endif
28
29 # Add libraries that libpq depends (or might depend) on into the
30 # shared library link.  (The order in which you list them here doesn't
31 # matter.)
32 SHLIB_LINK += $(filter -lcrypt -ldes -lkrb -lcom_err -lcrypto -lk5crypto -lkrb5 -lssl -lsocket -lnsl, $(LIBS))
33
34
35 all: all-lib
36
37 # Shared library stuff
38 include $(top_srcdir)/src/Makefile.shlib
39
40
41 # We use several backend modules verbatim, but since we need to
42 # compile with appropriate options to build a shared lib, we can't
43 # necessarily use the same object files as the backend uses. Instead,
44 # symlink the source files in here and build our own object file.
45
46 backend_src = $(top_srcdir)/src/backend
47
48 dllist.c: $(backend_src)/lib/dllist.c
49         rm -f $@ && $(LN_S) $< .
50
51 # this only gets done if configure finds system doesn't have snprintf()
52 snprintf.c: $(backend_src)/port/snprintf.c
53         rm -f $@ && $(LN_S) $< .
54
55 # this only gets done if configure finds system doesn't have inet_aton()
56 inet_aton.c: $(backend_src)/port/inet_aton.c
57         rm -f $@ && $(LN_S) $< .
58
59 ifdef MULTIBYTE
60 common.c wchar.c : % : $(backend_src)/utils/mb/%
61         rm -f $@ && $(LN_S) $< .
62 endif
63
64
65 install: all installdirs install-headers install-lib
66
67 .PHONY: install-headers
68 install-headers: libpq-fe.h libpq-int.h pqexpbuffer.h
69         $(INSTALL_DATA) $(srcdir)/libpq-fe.h $(DESTDIR)$(includedir)
70         $(INSTALL_DATA) $(srcdir)/libpq-int.h $(DESTDIR)$(includedir)
71         $(INSTALL_DATA) $(srcdir)/pqexpbuffer.h $(DESTDIR)$(includedir)
72
73 installdirs:
74         $(mkinstalldirs) $(DESTDIR)$(libdir) $(DESTDIR)$(includedir)
75
76 uninstall: uninstall-lib
77         rm -f $(addprefix $(DESTDIR)$(includedir)/, libpq-fe.h libpq-int.h pqexpbuffer.h)
78
79 clean distclean maintainer-clean: clean-lib
80         rm -f $(OBJS) dllist.c snprintf.c inet_aton.c common.c wchar.c conv.c big5.c
81
82 depend dep:
83         $(CC) -MM $(CFLAGS) *.c >depend
84
85 ifeq (depend,$(wildcard depend))
86 include depend
87 endif