@@ -29,29 +29,26 @@ endif
2929# platforms require special flags.
3030LIBS :=$(LIBS:-lpgport= )
3131
32- # libpgport C files that are always used by libpq
33- PGPORT = inet_net_ntop noblock pgstrcasecmp thread
34- ifeq ($(PORTNAME ) , win32)
35- PGPORT += pgsleep
36- endif
37- # libpgport C files are used by libpq if identified by configure
38- PGPORT +=$(basename $(filter $(addsuffix .o, crypt getaddrinfo inet_aton open snprintf strerror strlcpy win32error) ,$(LIBOBJS ) ) )
39-
40- # other external C files
41- BACKEND_LIBPQ = md5 ip
42- UTILS_MB = encnames wchar
43-
32+ # 'filter' is used for libpgport C files that are needed by libpq if
33+ # identified by configure, and we optionally add pgsleep.o below.
34+ # We can't use Makefile variables here because the MSVC build system scrapes
35+ # OBJS from this file.
36+ # The last two lines come from backend/libpq and utils/mb.
4437OBJS =fe-auth.o fe-connect.o fe-exec.o fe-misc.o fe-print.o fe-lobj.o\
4538fe-protocol2.o fe-protocol3.o pqexpbuffer.o pqsignal.o fe-secure.o\
4639libpq-events.o\
47- $(addsuffix .o,$(PGPORT ) $(BACKEND_LIBPQ ) $(UTILS_MB ) )
40+ inet_net_ntop.o noblock.o pgstrcasecmp.o thread.o\
41+ $(filter crypt.o getaddrinfo.o inet_aton.o open.o snprintf.o strerror.o strlcpy.o win32error.o,$(LIBOBJS ) ) \
42+ ip.o md5.o\
43+ encnames.o wchar.o
4844
4945ifeq ($(PORTNAME ) , cygwin)
5046override shlib = cyg$(NAME )$(DLSUFFIX )
5147endif
5248
5349ifeq ($(PORTNAME ) , win32)
54- OBJS += win32.o libpqrc.o
50+ # pgsleep.o is from libpgport
51+ OBJS += pgsleep.o win32.o libpqrc.o
5552
5653libpqrc.o : libpq.rc
5754$(WINDRES ) -i$< -o$@
@@ -86,15 +83,17 @@ backend_src = $(top_srcdir)/src/backend
8683# We use several backend modules verbatim, but since we need to
8784# compile with appropriate options to build a shared lib, we can't
8885# necessarily use the same object files as the backend uses. Instead,
89- # we symlink the source files in here and build our own object files.
86+ # symlink the source files in here and build our own object file.
87+ # For some libpgport modules, this only happens if configure decides
88+ # the module is needed (see filter hack in OBJS, above).
9089
91- $( addsuffix .c, $( PGPORT ) ) :% :$(top_srcdir ) /src/port/%
90+ crypt.c getaddrinfo.c inet_aton.c inet_net_ntop.c noblock.c open.c pgsleep.c pgstrcasecmp.c snprintf.c strerror.c strlcpy.c thread.c win32error.c :% :$(top_srcdir ) /src/port/%
9291rm -f$@ && $(LN_S ) $< .
9392
94- $( addsuffix .c, $( BACKEND_LIBPQ ) ) :% :$(backend_src ) /libpq/%
93+ ip.c md5.c :% :$(backend_src ) /libpq/%
9594rm -f$@ && $(LN_S ) $< .
9695
97- $( addsuffix .c, $( UTILS_MB ) ) :% :$(backend_src ) /utils/mb/%
96+ encnames.c wchar.c :% :$(backend_src ) /utils/mb/%
9897rm -f$@ && $(LN_S ) $< .
9998
10099
@@ -131,9 +130,16 @@ uninstall: uninstall-lib
131130rm -f' $(DESTDIR)$(datadir)/pg_service.conf.sample'
132131
133132clean distclean : clean-lib
134- rm -f$(OBJS ) pg_config_paths.h pthread.h libpq.rc$( addsuffix .c, $( PGPORT ) $( BACKEND_LIBPQ ) $( UTILS_MB ) )
133+ rm -f$(OBJS ) pthread.h libpq.rc
135134# Might be left over from a Win32 client-only build
136135rm -f pg_config_paths.h
136+ rm -f inet_net_ntop.c noblock.c pgstrcasecmp.c thread.c
137+ # optional libpgport files
138+ rm -f crypt.c getaddrinfo.c inet_aton.c open.c snprintf.c strerror.c strlcpy.c win32error.c
139+ # optional Win32
140+ rm -f pgsleep.c
141+ rm -f md5.c ip.c
142+ rm -f encnames.c wchar.c
137143
138144maintainer-clean : distclean maintainer-clean-lib
139145rm -f libpq-dist.rc