]> granicus.if.org Git - postgresql/blob - src/interfaces/libpq/Makefile
Remove dllist.c from libpq. It's overkill for what libpq needs; we can
[postgresql] / src / interfaces / libpq / Makefile
1 #-------------------------------------------------------------------------
2 #
3 # Makefile for src/interfaces/libpq library
4 #
5 # Portions Copyright (c) 1996-2004, 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.120 2004/10/16 22:52:49 tgl 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= 3
20 SO_MINOR_VERSION= 2
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), win32)
35 OBJS += win32.o libpqrc.o
36 libpqrc.o : libpq.rc
37         windres -i libpq.rc -o libpqrc.o
38 DLL_DEFFILE=libpqdll.def
39 ifeq ($(enable_thread_safety), yes)
40 # This doesn't work yet because configure test fails.  2004-06-19
41 OBJS += pthread-win32.o
42 PTHREAD_H_WIN32 = yes
43 endif
44 endif
45
46
47 # Add libraries that libpq depends (or might depend) on into the
48 # shared library link.  (The order in which you list them here doesn't
49 # matter.)
50 SHLIB_LINK += $(filter -lcrypt -ldes -lkrb -lcom_err -lcrypto -lk5crypto -lkrb5 -lssl -lsocket -lnsl -lresolv -lintl, $(LIBS)) $(PTHREAD_LIBS)
51 ifeq ($(PORTNAME), win32)
52 SHLIB_LINK += -lwsock32 -lws2_32 $(filter -leay32 -lssleay32, $(LIBS))
53 endif
54
55
56 all: $(PTHREAD_H_WIN32) $(top_builddir)/src/port/pg_config_paths.h def-files all-lib
57
58 # Shared library stuff
59 include $(top_srcdir)/src/Makefile.shlib
60 backend_src = $(top_srcdir)/src/backend
61
62
63 # We use several backend modules verbatim, but since we need to
64 # compile with appropriate options to build a shared lib, we can't
65 # necessarily use the same object files as the backend uses. Instead,
66 # symlink the source files in here and build our own object file.
67 # For port modules, this only happens if configure decides the module
68 # is needed (see filter hack in OBJS, above).
69
70 crypt.c getaddrinfo.c inet_aton.c noblock.c pgstrcasecmp.c snprintf.c strerror.c open.c thread.c: % : $(top_srcdir)/src/port/%
71         rm -f $@ && $(LN_S) $< .
72
73 md5.c ip.c: % : $(backend_src)/libpq/%
74         rm -f $@ && $(LN_S) $< .
75
76 encnames.c wchar.c : % : $(backend_src)/utils/mb/%
77         rm -f $@ && $(LN_S) $< .
78
79
80 # We need several not-quite-identical variants of .DEF files to build libpq
81 # DLLs for Windows.  These are made from the single source file exports.txt.
82 # Since we can't assume that Windows boxes will have sed, the .DEF files are
83 # always built and included in distribution tarballs.
84
85 distprep: def-files
86
87 .PHONY: def-files
88
89 def-files: $(srcdir)/libpqdll.def $(srcdir)/libpqddll.def $(srcdir)/blibpqdll.def
90
91 $(srcdir)/libpqdll.def: exports.txt
92         echo '; DEF file for MS VC++' > $@
93         echo 'LIBRARY LIBPQ' >> $@
94         echo 'DESCRIPTION "PostgreSQL Client Library"' >> $@
95         echo 'EXPORTS' >> $@
96         sed -e '/^#/d' -e 's/^\(.* \)\([0-9][0-9]*\)/    \1@ \2/' < $< >> $@
97
98 $(srcdir)/libpqddll.def: exports.txt
99         echo '; DEF file for MS VC++' > $@
100         echo 'LIBRARY LIBPQD' >> $@
101         echo 'DESCRIPTION "PostgreSQL Client Library"' >> $@
102         echo 'EXPORTS' >> $@
103         sed -e '/^#/d' -e 's/^\(.* \)\([0-9][0-9]*\)/    \1@ \2/' < $< >> $@
104
105 $(srcdir)/blibpqdll.def: exports.txt
106         echo '; DEF file for Borland C++ Builder' > $@
107         echo 'LIBRARY BLIBPQ' >> $@
108         echo 'DESCRIPTION "PostgreSQL Client Library"' >> $@
109         echo 'EXPORTS' >> $@
110         sed -e '/^#/d' -e 's/^\(.* \)\([0-9][0-9]*\)/    _\1@ \2/' < $< >> $@
111         echo '' >> $@
112         echo '; Aliases for MS compatible names' >> $@
113         sed -e '/^#/d' -e 's/^\(.* \)\([0-9][0-9]*\)/    \1= _\1/' < $< | sed 's/ *$$//' >> $@
114
115
116 ifneq ($(PTHREAD_H_WIN32), "")
117 pthread.h : % : $(top_srcdir)/src/interfaces/libpq/pthread.h.win
118         rm -f $@ && $(LN_S) $< .
119 endif
120
121 $(top_srcdir)/src/port/pg_config_paths.h:
122         $(MAKE) -C $(top_srcdir)/src/port pg_config_paths.h
123
124 install: all installdirs install-lib
125         $(INSTALL_DATA) $(srcdir)/libpq-fe.h $(DESTDIR)$(includedir)
126         $(INSTALL_DATA) $(srcdir)/libpq-int.h $(DESTDIR)$(includedir_internal)
127         $(INSTALL_DATA) $(srcdir)/pqexpbuffer.h $(DESTDIR)$(includedir_internal)
128         $(INSTALL_DATA) $(srcdir)/pg_service.conf.sample $(DESTDIR)$(datadir)/pg_service.conf.sample
129
130 installdirs:
131         $(mkinstalldirs) $(DESTDIR)$(libdir) $(DESTDIR)$(includedir) $(DESTDIR)$(includedir_internal)
132
133 uninstall: uninstall-lib
134         rm -f $(DESTDIR)$(includedir)/libpq-fe.h $(DESTDIR)$(includedir_internal)/libpq-int.h $(DESTDIR)$(includedir_internal)/pqexpbuffer.h
135
136 clean distclean: clean-lib
137         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
138
139 maintainer-clean: distclean
140         rm -f $(srcdir)/libpqdll.def $(srcdir)/libpqddll.def $(srcdir)/blibpqdll.def