]> granicus.if.org Git - postgresql/blob - src/interfaces/libpq/Makefile
Stamp shared-library minor version numbers for 9.5.
[postgresql] / src / interfaces / libpq / Makefile
1 #-------------------------------------------------------------------------
2 #
3 # Makefile for src/interfaces/libpq library
4 #
5 # Portions Copyright (c) 1996-2014, PostgreSQL Global Development Group
6 # Portions Copyright (c) 1994, Regents of the University of California
7 #
8 # src/interfaces/libpq/Makefile
9 #
10 #-------------------------------------------------------------------------
11
12 subdir = src/interfaces/libpq
13 top_builddir = ../../..
14 include $(top_builddir)/src/Makefile.global
15
16
17 # shared library parameters
18 NAME= pq
19 SO_MAJOR_VERSION= 5
20 SO_MINOR_VERSION= 8
21
22 override CPPFLAGS :=  -DFRONTEND -DUNSAFE_STAT_OK -I$(srcdir) $(CPPFLAGS) -I$(top_builddir)/src/port -I$(top_srcdir)/src/port
23 ifneq ($(PORTNAME), win32)
24 override CFLAGS += $(PTHREAD_CFLAGS)
25 endif
26
27 # Need to recompile any external C files because we need
28 # all object files to use the same compile flags as libpq; some
29 # platforms require special flags.
30 LIBS := $(LIBS:-lpgport=)
31
32 # We can't use Makefile variables here because the MSVC build system scrapes
33 # OBJS from this file.
34 OBJS=   fe-auth.o fe-connect.o fe-exec.o fe-misc.o fe-print.o fe-lobj.o \
35         fe-protocol2.o fe-protocol3.o pqexpbuffer.o fe-secure.o \
36         libpq-events.o
37 # libpgport C files we always use
38 OBJS += chklocale.o inet_net_ntop.o noblock.o pgstrcasecmp.o pqsignal.o \
39         thread.o
40 # libpgport C files that are needed if identified by configure
41 OBJS += $(filter crypt.o getaddrinfo.o getpeereid.o inet_aton.o open.o system.o snprintf.o strerror.o strlcpy.o win32error.o win32setlocale.o, $(LIBOBJS))
42 # backend/libpq
43 OBJS += ip.o md5.o
44 # utils/mb
45 OBJS += encnames.o wchar.o
46
47 ifeq ($(PORTNAME), cygwin)
48 override shlib = cyg$(NAME)$(DLSUFFIX)
49 endif
50
51 ifeq ($(PORTNAME), win32)
52 # pgsleep.o is from libpgport
53 OBJS += pgsleep.o win32.o libpqrc.o
54
55 libpqrc.o: libpq.rc
56         $(WINDRES) -i $< -o $@
57
58 ifeq ($(enable_thread_safety), yes)
59 OBJS += pthread-win32.o
60 endif
61 endif
62
63
64 # Add libraries that libpq depends (or might depend) on into the
65 # shared library link.  (The order in which you list them here doesn't
66 # matter.)
67 ifneq ($(PORTNAME), win32)
68 SHLIB_LINK += $(filter -lcrypt -ldes -lcom_err -lcrypto -lk5crypto -lkrb5 -lgssapi_krb5 -lgss -lgssapi -lssl -lsocket -lnsl -lresolv -lintl, $(LIBS)) $(LDAP_LIBS_FE) $(PTHREAD_LIBS)
69 else
70 SHLIB_LINK += $(filter -lcrypt -ldes -lcom_err -lcrypto -lk5crypto -lkrb5 -lgssapi32 -lssl -lsocket -lnsl -lresolv -lintl $(PTHREAD_LIBS), $(LIBS)) $(LDAP_LIBS_FE)
71 endif
72 ifeq ($(PORTNAME), win32)
73 SHLIB_LINK += -lshfolder -lwsock32 -lws2_32 -lsecur32 $(filter -leay32 -lssleay32 -lcomerr32 -lkrb5_32, $(LIBS))
74 endif
75
76 SHLIB_EXPORTS = exports.txt
77
78 all: all-lib
79
80 # Shared library stuff
81 include $(top_srcdir)/src/Makefile.shlib
82 backend_src = $(top_srcdir)/src/backend
83
84
85 # We use several libpgport and backend modules verbatim, but since we need
86 # to compile with appropriate options to build a shared lib, we can't
87 # necessarily use the same object files built for libpgport and the backend.
88 # Instead, symlink the source files in here and build our own object files.
89 # For some libpgport modules, this only happens if configure decides
90 # the module is needed (see filter hack in OBJS, above).
91
92 chklocale.c crypt.c getaddrinfo.c getpeereid.c inet_aton.c inet_net_ntop.c noblock.c open.c system.c pgsleep.c pgstrcasecmp.c pqsignal.c snprintf.c strerror.c strlcpy.c thread.c win32error.c win32setlocale.c: % : $(top_srcdir)/src/port/%
93         rm -f $@ && $(LN_S) $< .
94
95 ip.c md5.c: % : $(backend_src)/libpq/%
96         rm -f $@ && $(LN_S) $< .
97
98 encnames.c wchar.c: % : $(backend_src)/utils/mb/%
99         rm -f $@ && $(LN_S) $< .
100
101
102 distprep: libpq-dist.rc
103
104 libpq.rc libpq-dist.rc: libpq.rc.in
105         sed -e 's/\(VERSION.*\),0 *$$/\1,'`date '+%y%j' | sed 's/^0*//'`'/' $< >$@
106
107 # Depend on Makefile.global to force rebuild on re-run of configure.
108 # (But libpq-dist.rc is shipped in the distribution for shell-less
109 # installations and is only updated by distprep.)
110 libpq.rc: $(top_builddir)/src/Makefile.global
111
112 fe-connect.o: fe-connect.c $(top_builddir)/src/port/pg_config_paths.h
113 fe-misc.o: fe-misc.c $(top_builddir)/src/port/pg_config_paths.h
114
115 $(top_builddir)/src/port/pg_config_paths.h:
116         $(MAKE) -C $(top_builddir)/src/port pg_config_paths.h
117
118 install: all installdirs install-lib
119         $(INSTALL_DATA) $(srcdir)/libpq-fe.h '$(DESTDIR)$(includedir)'
120         $(INSTALL_DATA) $(srcdir)/libpq-events.h '$(DESTDIR)$(includedir)'
121         $(INSTALL_DATA) $(srcdir)/libpq-int.h '$(DESTDIR)$(includedir_internal)'
122         $(INSTALL_DATA) $(srcdir)/pqexpbuffer.h '$(DESTDIR)$(includedir_internal)'
123         $(INSTALL_DATA) $(srcdir)/pg_service.conf.sample '$(DESTDIR)$(datadir)/pg_service.conf.sample'
124 ifneq (,$(findstring $(PORTNAME), win32 cygwin))
125         $(INSTALL_DATA) $(shlib) '$(DESTDIR)$(bindir)/$(shlib)'
126 endif
127
128 installcheck:
129         $(MAKE) -C test $@
130
131 installdirs: installdirs-lib
132         $(MKDIR_P) '$(DESTDIR)$(includedir)' '$(DESTDIR)$(includedir_internal)' '$(DESTDIR)$(datadir)'
133 ifneq (,$(findstring $(PORTNAME), win32 cygwin))
134         $(MKDIR_P) '$(DESTDIR)$(bindir)'
135 endif
136
137 uninstall: uninstall-lib
138         rm -f '$(DESTDIR)$(includedir)/libpq-fe.h'
139         rm -f '$(DESTDIR)$(includedir)/libpq-events.h'
140         rm -f '$(DESTDIR)$(includedir_internal)/libpq-int.h'
141         rm -f '$(DESTDIR)$(includedir_internal)/pqexpbuffer.h'
142         rm -f '$(DESTDIR)$(datadir)/pg_service.conf.sample'
143 ifneq (,$(findstring $(PORTNAME), win32 cygwin))
144         rm -f '$(DESTDIR)$(bindir)/$(shlib)'
145 endif
146
147 clean distclean: clean-lib
148         $(MAKE) -C test $@
149         rm -f $(OBJS) pthread.h libpq.rc
150 # Might be left over from a Win32 client-only build
151         rm -f pg_config_paths.h
152         rm -f inet_net_ntop.c noblock.c pgstrcasecmp.c pqsignal.c thread.c
153         rm -f chklocale.c crypt.c getaddrinfo.c getpeereid.c inet_aton.c open.c system.c snprintf.c strerror.c strlcpy.c win32error.c win32setlocale.c
154         rm -f pgsleep.c
155         rm -f md5.c ip.c
156         rm -f encnames.c wchar.c
157
158 maintainer-clean: distclean maintainer-clean-lib
159         $(MAKE) -C test $@
160         rm -f libpq-dist.rc