]> granicus.if.org Git - postgresql/blob - src/interfaces/libpq/Makefile
Bump minor version numbers for 8.1 compared to 8.0.
[postgresql] / src / interfaces / libpq / Makefile
1 #-------------------------------------------------------------------------
2 #
3 # Makefile for src/interfaces/libpq library
4 #
5 # Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
6 # Portions Copyright (c) 1994, Regents of the University of California
7 #
8 # $PostgreSQL: pgsql/src/interfaces/libpq/Makefile,v 1.130 2005/03/14 17:27:50 momjian Exp $
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= 4
20 SO_MINOR_VERSION= 1
21 DLTYPE= library
22
23 override CPPFLAGS :=  -DFRONTEND -I$(srcdir) $(CPPFLAGS) -I$(top_builddir)/src/port
24 override CFLAGS += $(PTHREAD_CFLAGS)
25
26 # Need to recomple any libpgport object files
27 LIBS := $(patsubst -lpgport,, $(LIBS))
28
29 OBJS=   fe-auth.o fe-connect.o fe-exec.o fe-misc.o fe-print.o fe-lobj.o \
30         fe-protocol2.o fe-protocol3.o pqexpbuffer.o pqsignal.o fe-secure.o \
31         md5.o ip.o wchar.o encnames.o noblock.o pgstrcasecmp.o thread.o \
32         $(filter crypt.o getaddrinfo.o inet_aton.o open.o snprintf.o strerror.o, $(LIBOBJS))
33
34 ifeq ($(PORTNAME), cygwin)
35 override shlib = cyg$(NAME)$(DLSUFFIX)
36 endif
37
38 ifeq ($(PORTNAME), win32)
39 OBJS += win32.o libpqrc.o
40 DLL_DEFFILE=libpqdll.def
41
42 libpqrc.o: libpq.rc
43         windres -i libpq.rc -o libpqrc.o
44
45 ifeq ($(enable_thread_safety), yes)
46 # This doesn't work yet because configure test fails.  2004-06-19
47 OBJS += pthread-win32.o
48 PTHREAD_H_WIN32 = pthread.h
49 endif
50 endif
51
52
53 # Add libraries that libpq depends (or might depend) on into the
54 # shared library link.  (The order in which you list them here doesn't
55 # matter.)
56 SHLIB_LINK += $(filter -lcrypt -ldes -lkrb -lcom_err -lcrypto -lk5crypto -lkrb5 -lssl -lsocket -lnsl -lresolv -lintl, $(LIBS)) $(PTHREAD_LIBS)
57 ifeq ($(PORTNAME), win32)
58 SHLIB_LINK += -lshfolder -lwsock32 -lws2_32 $(filter -leay32 -lssleay32, $(LIBS))
59 endif
60
61
62 all: $(PTHREAD_H_WIN32) def-files $(srcdir)/libpq.rc all-lib
63
64 # Shared library stuff
65 include $(top_srcdir)/src/Makefile.shlib
66 backend_src = $(top_srcdir)/src/backend
67
68
69 # We use several backend modules verbatim, but since we need to
70 # compile with appropriate options to build a shared lib, we can't
71 # necessarily use the same object files as the backend uses. Instead,
72 # symlink the source files in here and build our own object file.
73 # For port modules, this only happens if configure decides the module
74 # is needed (see filter hack in OBJS, above).
75
76 crypt.c getaddrinfo.c inet_aton.c noblock.c pgstrcasecmp.c snprintf.c strerror.c open.c thread.c: % : $(top_srcdir)/src/port/%
77         rm -f $@ && $(LN_S) $< .
78
79 md5.c ip.c: % : $(backend_src)/libpq/%
80         rm -f $@ && $(LN_S) $< .
81
82 encnames.c wchar.c : % : $(backend_src)/utils/mb/%
83         rm -f $@ && $(LN_S) $< .
84
85
86 # We need several not-quite-identical variants of .DEF files to build libpq
87 # DLLs for Windows.  These are made from the single source file exports.txt.
88 # Since we can't assume that Windows boxes will have sed, the .DEF files are
89 # always built and included in distribution tarballs.
90
91 distprep: def-files $(srcdir)/libpq.rc
92
93 .PHONY: def-files
94
95 def-files: $(srcdir)/libpqdll.def $(srcdir)/libpqddll.def $(srcdir)/blibpqdll.def
96
97 $(srcdir)/libpqdll.def: exports.txt
98         echo '; DEF file for MS VC++' > $@
99         echo 'LIBRARY LIBPQ' >> $@
100         echo 'DESCRIPTION "PostgreSQL Client Library"' >> $@
101         echo 'EXPORTS' >> $@
102         sed -e '/^#/d' -e 's/^\(.* \)\([0-9][0-9]*\)/    \1@ \2/' < $< >> $@
103
104 $(srcdir)/libpqddll.def: exports.txt
105         echo '; DEF file for MS VC++' > $@
106         echo 'LIBRARY LIBPQD' >> $@
107         echo 'DESCRIPTION "PostgreSQL Client Library"' >> $@
108         echo 'EXPORTS' >> $@
109         sed -e '/^#/d' -e 's/^\(.* \)\([0-9][0-9]*\)/    \1@ \2/' < $< >> $@
110
111 $(srcdir)/blibpqdll.def: exports.txt
112         echo '; DEF file for Borland C++ Builder' > $@
113         echo 'LIBRARY BLIBPQ' >> $@
114         echo 'DESCRIPTION "PostgreSQL Client Library"' >> $@
115         echo 'EXPORTS' >> $@
116         sed -e '/^#/d' -e 's/^\(.* \)\([0-9][0-9]*\)/    _\1@ \2/' < $< >> $@
117         echo '' >> $@
118         echo '; Aliases for MS compatible names' >> $@
119         sed -e '/^#/d' -e 's/^\(.* \)\([0-9][0-9]*\)/    \1= _\1/' < $< | sed 's/ *$$//' >> $@
120
121 # depend on Makefile.global to force rebuild on re-run of configure
122 $(srcdir)/libpq.rc: libpq.rc.in $(top_builddir)/src/Makefile.global
123         sed -e 's/\(VERSION.*\),0 *$$/\1,'`date '+%y%j' | sed 's/^0*//'`'/' < $< > $@
124
125 ifneq ($(PTHREAD_H_WIN32), "")
126 pthread.h: $(top_srcdir)/src/interfaces/libpq/pthread.h.win
127         rm -f $@ && $(LN_S) $< .
128 endif
129
130 fe-connect.o: fe-connect.c $(top_builddir)/src/port/pg_config_paths.h
131
132 $(top_builddir)/src/port/pg_config_paths.h:
133         $(MAKE) -C $(top_builddir)/src/port pg_config_paths.h
134
135 install: all installdirs install-lib
136         $(INSTALL_DATA) $(srcdir)/libpq-fe.h $(DESTDIR)$(includedir)
137         $(INSTALL_DATA) $(srcdir)/libpq-int.h $(DESTDIR)$(includedir_internal)
138         $(INSTALL_DATA) $(srcdir)/pqexpbuffer.h $(DESTDIR)$(includedir_internal)
139         $(INSTALL_DATA) $(srcdir)/pg_service.conf.sample $(DESTDIR)$(datadir)/pg_service.conf.sample
140
141 installdirs:
142         $(mkinstalldirs) $(DESTDIR)$(libdir) $(DESTDIR)$(includedir) $(DESTDIR)$(includedir_internal)
143
144 uninstall: uninstall-lib
145         rm -f $(DESTDIR)$(includedir)/libpq-fe.h $(DESTDIR)$(includedir_internal)/libpq-int.h $(DESTDIR)$(includedir_internal)/pqexpbuffer.h
146
147 clean distclean: clean-lib
148         rm -f $(OBJS) crypt.c getaddrinfo.c inet_aton.c noblock.c pgstrcasecmp.c snprintf.c strerror.c open.c thread.c md5.c ip.c encnames.c wchar.c pthread.h
149
150 maintainer-clean: distclean
151         rm -f $(srcdir)/libpqdll.def $(srcdir)/libpqddll.def $(srcdir)/blibpqdll.def $(srcdir)/libpq.rc