aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/Makefile.shlib41
-rw-r--r--src/backend/Makefile16
-rw-r--r--src/makefiles/Makefile.win324
3 files changed, 25 insertions, 36 deletions
diff --git a/src/Makefile.shlib b/src/Makefile.shlib
index a95e4d65e58..1db906034d6 100644
--- a/src/Makefile.shlib
+++ b/src/Makefile.shlib
@@ -34,12 +34,6 @@
# SO_MINOR_VERSION Minor version number to use for shared library
# (If you want a patchlevel, include it in SO_MINOR_VERSION, e.g., "6.2".)
#
-# Optional flags when building DLL's (only applicable to win32 and cygwin
-# platforms).
-# DLLTOOL_DEFFLAGS Additional flags when creating the dll .def file
-# DLLTOOL_LIBFLAGS Additional flags when creating the lib<module>.a file
-# DLLWRAP_FLAGS Additional flags to dllwrap
-#
# The module Makefile must also include
# $(top_builddir)/src/Makefile.global before including this file.
# (Makefile.global sets PORTNAME and other needed symbols.)
@@ -358,11 +352,10 @@ endif # PORTNAME == aix
else # PORTNAME == cygwin || PORTNAME == win32
-# Cygwin or Win32 case
-
-# If SHLIB_EXPORTS is set, the rules below will build a .def file from
-# that. Else we build a temporary one here.
ifeq ($(PORTNAME), cygwin)
+
+# Cygwin case
+
$(shlib): $(OBJS) | $(SHLIB_PREREQS)
$(CC) $(CFLAGS) -shared -o $@ $(OBJS) $(LDFLAGS) $(LDFLAGS_SL) $(SHLIB_LINK) $(LIBS) $(LDAP_LIBS_BE)
@@ -370,23 +363,29 @@ $(stlib): $(OBJS) | $(SHLIB_PREREQS)
$(LINK.static) $@ $^
$(RANLIB) $@
-
else
-ifeq (,$(SHLIB_EXPORTS))
-DLL_DEFFILE = lib$(NAME)dll.def
-exports_file = $(DLL_DEFFILE)
-$(exports_file): $(OBJS)
- $(DLLTOOL) --export-all $(DLLTOOL_DEFFLAGS) --output-def $@ $^
+# Win32 case
+
+# There is no correct way to write a rule that generates two files.
+# Rules with two targets don't have that meaning, they are merely
+# shorthand for two otherwise separate rules. To be safe for parallel
+# make, we must chain the dependencies like this. The semicolon is
+# important, otherwise make will choose some built-in rule.
+
+$(stlib): $(shlib) ;
+
+# If SHLIB_EXPORTS is set, the rules below will build a .def file from that.
+# Else we just use --export-all-symbols.
+ifeq (,$(SHLIB_EXPORTS))
+$(shlib): $(OBJS) | $(SHLIB_PREREQS)
+ $(CC) $(CFLAGS) -shared -o $@ $(OBJS) $(LDFLAGS) $(LDFLAGS_SL) $(SHLIB_LINK) $(LIBS) -Wl,--export-all-symbols -Wl,--out-implib=$(stlib)
else
DLL_DEFFILE = lib$(NAME)dll.def
-endif
$(shlib): $(OBJS) $(DLL_DEFFILE) | $(SHLIB_PREREQS)
- $(DLLWRAP) -o $@ --dllname $(shlib) $(DLLWRAP_FLAGS) --def $(DLL_DEFFILE) $(OBJS) $(LDFLAGS) $(LDFLAGS_SL) $(SHLIB_LINK)
-
-$(stlib): $(shlib) $(DLL_DEFFILE) | $(SHLIB_PREREQS)
- $(DLLTOOL) --dllname $(shlib) $(DLLTOOL_LIBFLAGS) --def $(DLL_DEFFILE) --output-lib $@
+ $(CC) $(CFLAGS) -shared -o $@ $(OBJS) $(LDFLAGS) $(LDFLAGS_SL) $(SHLIB_LINK) $(LIBS) $(DLL_DEFFILE) -Wl,--out-implib=$(stlib)
+endif
endif # PORTNAME == cgywin
endif # PORTNAME == cygwin || PORTNAME == win32
diff --git a/src/backend/Makefile b/src/backend/Makefile
index 8afb1893fd1..870a02292fc 100644
--- a/src/backend/Makefile
+++ b/src/backend/Makefile
@@ -78,18 +78,10 @@ endif # cygwin
ifeq ($(PORTNAME), win32)
LIBS += -lsecur32
-postgres: $(OBJS) postgres.def libpostgres.a $(WIN32RES)
- $(DLLTOOL) --dllname $@$(X) --output-exp $@.exp --def postgres.def
- $(CC) $(CFLAGS) $(LDFLAGS) $(LDFLAGS_EX) -o $@$(X) -Wl,--base-file,$@.base $@.exp $(call expand_subsys,$(OBJS)) $(WIN32RES) $(LIBS)
- $(DLLTOOL) --dllname $@$(X) --base-file $@.base --output-exp $@.exp --def postgres.def
- $(CC) $(CFLAGS) $(LDFLAGS) $(LDFLAGS_EX) -Wl,--stack=$(WIN32_STACK_RLIMIT) -o $@$(X) $@.exp $(call expand_subsys,$(OBJS)) $(WIN32RES) $(LIBS)
- rm -f $@.exp $@.base
+postgres: $(OBJS) $(WIN32RES)
+ $(CC) $(CFLAGS) $(LDFLAGS) $(LDFLAGS_EX) -Wl,--stack=$(WIN32_STACK_RLIMIT) -Wl,--export-all-symbols -Wl,--out-implib=libpostgres.a $(call expand_subsys,$(OBJS)) $(WIN32RES) $(LIBS) -o $@$(X)
-postgres.def: $(OBJS)
- $(DLLTOOL) --export-all --output-def $@ $(call expand_subsys,$^)
-
-libpostgres.a: postgres.def
- $(DLLTOOL) --dllname postgres.exe --def postgres.def --output-lib $@
+libpostgres.a: postgres ;
endif # win32
@@ -296,7 +288,7 @@ ifeq ($(PORTNAME), cygwin)
rm -f postgres.dll libpostgres.a
endif
ifeq ($(PORTNAME), win32)
- rm -f postgres.dll postgres.def libpostgres.a $(WIN32RES)
+ rm -f postgres.dll libpostgres.a $(WIN32RES)
endif
distclean: clean
diff --git a/src/makefiles/Makefile.win32 b/src/makefiles/Makefile.win32
index 1aae9e95df1..b18621b2f8b 100644
--- a/src/makefiles/Makefile.win32
+++ b/src/makefiles/Makefile.win32
@@ -72,6 +72,4 @@ win32ver.o: win32ver.rc
# Rule for building a shared library from a single .o file
%.dll: %.o
- $(DLLTOOL) --export-all --output-def $*.def $<
- $(DLLWRAP) -o $@ --def $*.def $< $(LDFLAGS) $(LDFLAGS_SL) $(BE_DLLLIBS)
- rm -f $*.def
+ $(CC) $(CFLAGS) -shared -o $@ $< -Wl,--export-all-symbols $(LDFLAGS) $(LDFLAGS_SL) $(BE_DLLLIBS)