@@ -24,27 +24,11 @@ ifneq ($(PORTNAME), win32)
24
24
override CFLAGS += $(PTHREAD_CFLAGS )
25
25
endif
26
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
27
# We can't use Makefile variables here because the MSVC build system scrapes
33
28
# OBJS from this file.
34
29
OBJS = fe-auth.o fe-auth-scram.o fe-connect.o fe-exec.o fe-misc.o fe-print.o fe-lobj.o \
35
30
fe-protocol2.o fe-protocol3.o pqexpbuffer.o fe-secure.o \
36
31
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
- snprintf.o strerror.o 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 strlcpy.o strnlen.o win32error.o win32setlocale.o, $(LIBOBJS ) )
42
-
43
- ifeq ($(enable_strong_random ) , yes)
44
- OBJS += pg_strong_random.o
45
- else
46
- OBJS += erand48.o
47
- endif
48
32
49
33
# src/backend/utils/mb
50
34
OBJS += encnames.o wchar.o
@@ -62,8 +46,7 @@ override shlib = cyg$(NAME)$(DLSUFFIX)
62
46
endif
63
47
64
48
ifeq ($(PORTNAME ) , win32)
65
- # pgsleep.o is from libpgport
66
- OBJS += pgsleep.o win32.o libpqrc.o
49
+ OBJS += win32.o libpqrc.o
67
50
68
51
libpqrc.o : libpq.rc
69
52
$(WINDRES ) -i $< -o $@
@@ -76,11 +59,12 @@ endif
76
59
77
60
# Add libraries that libpq depends (or might depend) on into the
78
61
# shared library link. (The order in which you list them here doesn't
79
- # matter.)
62
+ # matter.) Note that we filter out -lpgport from LIBS and instead
63
+ # insert -lpgport_shlib, to get port files that are built correctly.
80
64
ifneq ($(PORTNAME ) , win32)
81
- SHLIB_LINK += $(filter -lcrypt -ldes -lcom_err -lcrypto -lk5crypto -lkrb5 -lgssapi_krb5 -lgss -lgssapi -lssl -lsocket -lnsl -lresolv -lintl -lm, $(LIBS ) ) $(LDAP_LIBS_FE ) $(PTHREAD_LIBS )
65
+ SHLIB_LINK += -lpgport_shlib $(filter -lcrypt -ldes -lcom_err -lcrypto -lk5crypto -lkrb5 -lgssapi_krb5 -lgss -lgssapi -lssl -lsocket -lnsl -lresolv -lintl -lm, $(LIBS ) ) $(LDAP_LIBS_FE ) $(PTHREAD_LIBS )
82
66
else
83
- SHLIB_LINK += $(filter -lcrypt -ldes -lcom_err -lcrypto -lk5crypto -lkrb5 -lgssapi32 -lssl -lsocket -lnsl -lresolv -lintl -lm $(PTHREAD_LIBS ) , $(LIBS ) ) $(LDAP_LIBS_FE )
67
+ SHLIB_LINK += -lpgport_shlib $(filter -lcrypt -ldes -lcom_err -lcrypto -lk5crypto -lkrb5 -lgssapi32 -lssl -lsocket -lnsl -lresolv -lintl -lm $(PTHREAD_LIBS ) , $(LIBS ) ) $(LDAP_LIBS_FE )
84
68
endif
85
69
ifeq ($(PORTNAME ) , win32)
86
70
SHLIB_LINK += -lshell32 -lws2_32 -lsecur32 $(filter -leay32 -lssleay32 -lcomerr32 -lkrb5_32, $(LIBS ) )
@@ -90,22 +74,19 @@ SHLIB_EXPORTS = exports.txt
90
74
91
75
all : all-lib
92
76
77
+ all-lib : | submake-libpgport
78
+
93
79
# Shared library stuff
94
80
include $(top_srcdir ) /src/Makefile.shlib
95
81
backend_src = $(top_srcdir ) /src/backend
96
82
97
83
98
- # We use several libpgport and backend modules verbatim, but since we need
84
+ # We use a few backend modules verbatim, but since we need
99
85
# to compile with appropriate options to build a shared lib, we can't
100
- # necessarily use the same object files built for libpgport and the backend.
86
+ # use the same object files built for the backend.
101
87
# Instead, symlink the source files in here and build our own object files.
102
- # For some libpgport modules, this only happens if configure decides
103
- # the module is needed (see filter hack in OBJS, above).
104
88
# When you add a file here, remember to add it in the "clean" target below.
105
89
106
- chklocale.c crypt.c erand48.c getaddrinfo.c getpeereid.c inet_aton.c inet_net_ntop.c noblock.c open.c system.c pgsleep.c pg_strong_random.c pgstrcasecmp.c pqsignal.c snprintf.c strerror.c strlcpy.c strnlen.c thread.c win32error.c win32setlocale.c : % : $(top_srcdir ) /src/port/%
107
- rm -f $@ && $(LN_S ) $< .
108
-
109
90
ip.c md5.c base64.c link-canary.c scram-common.c sha2.c sha2_openssl.c saslprep.c unicode_norm.c : % : $(top_srcdir ) /src/common/%
110
91
rm -f $@ && $(LN_S ) $< .
111
92
@@ -123,6 +104,7 @@ libpq.rc libpq-dist.rc: libpq.rc.in
123
104
# installations and is only updated by distprep.)
124
105
libpq.rc : $(top_builddir ) /src/Makefile.global
125
106
107
+ # Make dependencies on pg_config_paths.h visible, too.
126
108
fe-connect.o : fe-connect.c $(top_builddir ) /src/port/pg_config_paths.h
127
109
fe-misc.o : fe-misc.c $(top_builddir ) /src/port/pg_config_paths.h
128
110
@@ -154,8 +136,7 @@ clean distclean: clean-lib
154
136
rm -f $(OBJS ) pthread.h libpq.rc
155
137
# Might be left over from a Win32 client-only build
156
138
rm -f pg_config_paths.h
157
- # Remove files we (may have) symlinked in from src/port and other places
158
- rm -f chklocale.c crypt.c erand48.c getaddrinfo.c getpeereid.c inet_aton.c inet_net_ntop.c noblock.c open.c system.c pgsleep.c pg_strong_random.c pgstrcasecmp.c pqsignal.c snprintf.c strerror.c strlcpy.c strnlen.c thread.c win32error.c win32setlocale.c
139
+ # Remove files we (may have) symlinked in from src/common and other places
159
140
rm -f ip.c md5.c base64.c link-canary.c scram-common.c sha2.c sha2_openssl.c saslprep.c unicode_norm.c
160
141
rm -f encnames.c wchar.c
161
142
0 commit comments