22#
33# Makefile for src/interfaces/libpq library
44#
5- # Copyright (c) 1994, Regents of the University of California
5+ # Portions Copyright (c) 1996-2004, PostgreSQL Global Development Group
6+ # Portions Copyright (c) 1994, Regents of the University of California
67#
7- # $PostgreSQL: pgsql/src/interfaces/libpq/Makefile,v 1.118 2004/10/1603:26:43 momjian Exp $
8+ # $PostgreSQL: pgsql/src/interfaces/libpq/Makefile,v 1.119 2004/10/1620:10:56 tgl Exp $
89#
910# -------------------------------------------------------------------------
1011
@@ -52,7 +53,7 @@ SHLIB_LINK += -lwsock32 -lws2_32 $(filter -leay32 -lssleay32, $(LIBS))
5253endif
5354
5455
55- all :$(PTHREAD_H_WIN32 ) $(top_builddir ) /src/port/pg_config_paths.h all-lib
56+ all :$(PTHREAD_H_WIN32 ) $(top_builddir ) /src/port/pg_config_paths.hdef-files all-lib
5657
5758# Shared library stuff
5859include $(top_srcdir ) /src/Makefile.shlib
@@ -79,6 +80,42 @@ encnames.c wchar.c : % : $(backend_src)/utils/mb/%
7980rm -f$@ && $(LN_S ) $< .
8081
8182
83+ # We need several not-quite-identical variants of .DEF files to build libpq
84+ # DLLs for Windows. These are made from the single source file exports.txt.
85+ # Since we can't assume that Windows boxes will have sed, the .DEF files are
86+ # always built and included in distribution tarballs.
87+
88+ distprep : def-files
89+
90+ .PHONY : def-files
91+
92+ def-files :$(srcdir ) /libpqdll.def$(srcdir ) /libpqddll.def$(srcdir ) /blibpqdll.def
93+
94+ $(srcdir ) /libpqdll.def : exports.txt
95+ echo ' ; DEF file for MS VC++' > $@
96+ echo ' LIBRARY LIBPQ' >> $@
97+ echo ' DESCRIPTION "PostgreSQL Client Library"' >> $@
98+ echo ' EXPORTS' >> $@
99+ sed -e' /^#/d' -e' s/^\(.* \)\([0-9][0-9]*\)/ \1@ \2/' < $< >> $@
100+
101+ $(srcdir ) /libpqddll.def : exports.txt
102+ echo ' ; DEF file for MS VC++' > $@
103+ echo ' LIBRARY LIBPQD' >> $@
104+ echo ' DESCRIPTION "PostgreSQL Client Library"' >> $@
105+ echo ' EXPORTS' >> $@
106+ sed -e' /^#/d' -e' s/^\(.* \)\([0-9][0-9]*\)/ \1@ \2/' < $< >> $@
107+
108+ $(srcdir ) /blibpqdll.def : exports.txt
109+ echo ' ; DEF file for Borland C++ Builder' > $@
110+ echo ' LIBRARY BLIBPQ' >> $@
111+ echo ' DESCRIPTION "PostgreSQL Client Library"' >> $@
112+ echo ' EXPORTS' >> $@
113+ sed -e' /^#/d' -e' s/^\(.* \)\([0-9][0-9]*\)/ _\1@ \2/' < $< >> $@
114+ echo ' ' >> $@
115+ echo ' ; Aliases for MS compatible names' >> $@
116+ sed -e' /^#/d' -e' s/^\(.* \)\([0-9][0-9]*\)/ \1= _\1/' < $< | sed' s/ *$$//' >> $@
117+
118+
82119ifneq ($(PTHREAD_H_WIN32 ) , "")
83120pthread.h :% :$(top_srcdir ) /src/interfaces/libpq/pthread.h.win
84121rm -f$@ && $(LN_S ) $< .
@@ -99,5 +136,8 @@ installdirs:
99136uninstall : uninstall-lib
100137rm -f$(DESTDIR )$(includedir ) /libpq-fe.h$(DESTDIR )$(includedir_internal ) /libpq-int.h$(DESTDIR )$(includedir_internal ) /pqexpbuffer.h
101138
102- clean distclean maintainer-clean : clean-lib
139+ clean distclean : clean-lib
103140rm -f$(OBJS ) crypt.c getaddrinfo.c inet_aton.c noblock.c pgstrcasecmp.c snprintf.c strerror.c open.c thread.c dllist.c md5.c ip.c encnames.c wchar.c pthread.h
141+
142+ maintainer-clean : distclean
143+ rm -f$(srcdir ) /libpqdll.def$(srcdir ) /libpqddll.def$(srcdir ) /blibpqdll.def