mirror of
https://github.com/postgres/postgres.git
synced 2025-04-25 21:42:33 +03:00
Reorganize some of the exports list generation code. It seems that this
has been reinvented about four different times throughout history (aix, cygwin, win32, darwin/linux) and a lot of the concepts are actually shared, which the code now shows better.
This commit is contained in:
parent
734a56ca2e
commit
bdaf90b70f
@ -6,7 +6,7 @@
|
|||||||
# Copyright (c) 1998, Regents of the University of California
|
# Copyright (c) 1998, Regents of the University of California
|
||||||
#
|
#
|
||||||
# IDENTIFICATION
|
# IDENTIFICATION
|
||||||
# $PostgreSQL: pgsql/src/Makefile.shlib,v 1.111 2008/02/26 10:30:06 petere Exp $
|
# $PostgreSQL: pgsql/src/Makefile.shlib,v 1.112 2008/02/26 10:45:24 petere Exp $
|
||||||
#
|
#
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
|
|
||||||
@ -99,6 +99,7 @@ soname = lib$(NAME)$(DLSUFFIX).$(SO_MAJOR_VERSION)
|
|||||||
ifeq ($(PORTNAME), aix)
|
ifeq ($(PORTNAME), aix)
|
||||||
shlib = lib$(NAME)$(DLSUFFIX).$(SO_MAJOR_VERSION)
|
shlib = lib$(NAME)$(DLSUFFIX).$(SO_MAJOR_VERSION)
|
||||||
haslibarule = yes
|
haslibarule = yes
|
||||||
|
exports_file = lib$(NAME).exp
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq ($(PORTNAME), darwin)
|
ifeq ($(PORTNAME), darwin)
|
||||||
@ -117,8 +118,9 @@ ifeq ($(PORTNAME), darwin)
|
|||||||
shlib = lib$(NAME).$(SO_MAJOR_VERSION).$(SO_MINOR_VERSION)$(DLSUFFIX)
|
shlib = lib$(NAME).$(SO_MAJOR_VERSION).$(SO_MINOR_VERSION)$(DLSUFFIX)
|
||||||
shlib_major = lib$(NAME).$(SO_MAJOR_VERSION)$(DLSUFFIX)
|
shlib_major = lib$(NAME).$(SO_MAJOR_VERSION)$(DLSUFFIX)
|
||||||
BUILD.exports = $(AWK) '/^[^\#]/ {printf "_%s\n",$$1}' $< >$@
|
BUILD.exports = $(AWK) '/^[^\#]/ {printf "_%s\n",$$1}' $< >$@
|
||||||
ifneq (,$(SHLIB_EXPORTS))
|
exports_file = $(SHLIB_EXPORTS:%.txt=%.list)
|
||||||
exported_symbols_list = -exported_symbols_list $(SHLIB_EXPORTS:%.txt=%.list)
|
ifneq (,$(exports_file))
|
||||||
|
exported_symbols_list = -exported_symbols_list $(exports_file)
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
@ -193,8 +195,9 @@ endif
|
|||||||
ifeq ($(PORTNAME), linux)
|
ifeq ($(PORTNAME), linux)
|
||||||
LINK.shared = $(COMPILER) -shared -Wl,-soname,$(soname)
|
LINK.shared = $(COMPILER) -shared -Wl,-soname,$(soname)
|
||||||
BUILD.exports = ( echo '{ global:'; $(AWK) '/^[^\#]/ {printf "%s;\n",$$1}' $<; echo ' local: *; };' ) >$@
|
BUILD.exports = ( echo '{ global:'; $(AWK) '/^[^\#]/ {printf "%s;\n",$$1}' $<; echo ' local: *; };' ) >$@
|
||||||
ifneq (,$(SHLIB_EXPORTS))
|
exports_file = $(SHLIB_EXPORTS:%.txt=%.list)
|
||||||
LINK.shared += -Wl,--version-script=$(SHLIB_EXPORTS:%.txt=%.list)
|
ifneq (,$(exports_file))
|
||||||
|
LINK.shared += -Wl,--version-script=$(exports_file)
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
@ -284,8 +287,7 @@ endif #haslibarule
|
|||||||
|
|
||||||
ifeq ($(enable_shared), yes)
|
ifeq ($(enable_shared), yes)
|
||||||
|
|
||||||
ifneq ($(PORTNAME), win32)
|
ifeq (,$(filter cygwin win32,$(PORTNAME)))
|
||||||
ifneq ($(PORTNAME), cygwin)
|
|
||||||
ifneq ($(PORTNAME), aix)
|
ifneq ($(PORTNAME), aix)
|
||||||
|
|
||||||
# Normal case
|
# Normal case
|
||||||
@ -321,46 +323,35 @@ else # PORTNAME == aix
|
|||||||
$(shlib) lib$(NAME).a: $(OBJS)
|
$(shlib) lib$(NAME).a: $(OBJS)
|
||||||
$(LINK.static) lib$(NAME).a $^
|
$(LINK.static) lib$(NAME).a $^
|
||||||
$(RANLIB) lib$(NAME).a
|
$(RANLIB) lib$(NAME).a
|
||||||
$(MKLDEXPORT) lib$(NAME).a > lib$(NAME)$(EXPSUFF)
|
$(MKLDEXPORT) lib$(NAME).a >$(exports_file)
|
||||||
$(COMPILER) $(LDFLAGS_NO_L) $(LDFLAGS_SL) -o $(shlib) lib$(NAME).a -Wl,-bE:lib$(NAME)$(EXPSUFF) $(SHLIB_LINK)
|
$(COMPILER) $(LDFLAGS_NO_L) $(LDFLAGS_SL) -o $(shlib) lib$(NAME).a -Wl,-bE:$(exports_file) $(SHLIB_LINK)
|
||||||
rm -f lib$(NAME).a
|
rm -f lib$(NAME).a
|
||||||
$(AR) $(AROPT) lib$(NAME).a $(shlib)
|
$(AR) $(AROPT) lib$(NAME).a $(shlib)
|
||||||
|
|
||||||
endif # PORTNAME == aix
|
endif # PORTNAME == aix
|
||||||
|
|
||||||
else # PORTNAME == cygwin
|
else # PORTNAME == cygwin || PORTNAME == win32
|
||||||
|
|
||||||
# Cygwin case
|
# Cygwin or Win32 case
|
||||||
$(shlib) lib$(NAME).a: $(OBJS)
|
|
||||||
ifndef DLL_DEFFILE
|
|
||||||
$(DLLTOOL) --export-all $(DLLTOOL_DEFFLAGS) --output-def $(NAME).def $(OBJS)
|
|
||||||
$(DLLWRAP) $(LDFLAGS_SL) -o $(shlib) --dllname $(shlib) $(DLLWRAP_FLAGS) --def $(NAME).def $(OBJS) $(SHLIB_LINK)
|
|
||||||
$(DLLTOOL) --dllname $(shlib) $(DLLTOOL_LIBFLAGS) --def $(NAME).def --output-lib lib$(NAME).a
|
|
||||||
else
|
|
||||||
$(DLLWRAP) $(LDFLAGS_SL) -o $(shlib) --dllname $(shlib) $(DLLWRAP_FLAGS) --def $(DLL_DEFFILE) $(OBJS) $(SHLIB_LINK)
|
|
||||||
$(DLLTOOL) --dllname $(shlib) $(DLLTOOL_LIBFLAGS) --def $(DLL_DEFFILE) --output-lib lib$(NAME).a
|
|
||||||
endif
|
|
||||||
|
|
||||||
endif # PORTNAME == cygwin
|
|
||||||
|
|
||||||
else # PORTNAME == win32
|
|
||||||
|
|
||||||
ifneq (,$(SHLIB_EXPORTS))
|
|
||||||
DLL_DEFFILE = lib$(NAME)dll.def
|
DLL_DEFFILE = lib$(NAME)dll.def
|
||||||
|
|
||||||
|
# If SHLIB_EXPORTS is set, the rules below will build a .def file from
|
||||||
|
# that. Else we build a temporary one here.
|
||||||
|
ifeq (,$(SHLIB_EXPORTS))
|
||||||
|
exports_file = $(DLL_DEFFILE)
|
||||||
|
|
||||||
|
$(exports_file): $(OBJS)
|
||||||
|
$(DLLTOOL) --export-all $(DLLTOOL_DEFFLAGS) --output-def $@ $^
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# win32 case
|
$(shlib): $(OBJS) $(DLL_DEFFILE)
|
||||||
$(shlib) lib$(NAME).a: $(OBJS)
|
$(DLLWRAP) $(LDFLAGS_SL) -o $@ --dllname $(shlib) $(DLLWRAP_FLAGS) --def $(DLL_DEFFILE) $(OBJS) $(SHLIB_LINK)
|
||||||
ifndef DLL_DEFFILE
|
|
||||||
$(DLLTOOL) --export-all $(DLLTOOL_DEFFLAGS) --output-def $(NAME).def $(OBJS)
|
|
||||||
$(DLLWRAP) $(LDFLAGS_SL) -o $(shlib) --dllname $(shlib) $(DLLWRAP_FLAGS) --def $(NAME).def $(OBJS) $(SHLIB_LINK)
|
|
||||||
$(DLLTOOL) --dllname $(shlib) $(DLLTOOL_LIBFLAGS) --def $(NAME).def --output-lib lib$(NAME).a
|
|
||||||
else
|
|
||||||
$(DLLWRAP) $(LDFLAGS_SL) -o $(shlib) --dllname $(shlib) $(DLLWRAP_FLAGS) --def $(DLL_DEFFILE) $(OBJS) $(SHLIB_LINK)
|
|
||||||
$(DLLTOOL) --dllname $(shlib) $(DLLTOOL_LIBFLAGS) --def $(DLL_DEFFILE) --output-lib lib$(NAME).a
|
|
||||||
endif
|
|
||||||
|
|
||||||
endif # PORTNAME == win32
|
lib$(NAME).a: $(shlib) $(DLL_DEFFILE)
|
||||||
|
$(DLLTOOL) --dllname $(shlib) $(DLLTOOL_LIBFLAGS) --def $(DLL_DEFFILE) --output-lib $@
|
||||||
|
|
||||||
|
endif # PORTNAME == cygwin || PORTNAME == win32
|
||||||
|
|
||||||
endif # enable_shared
|
endif # enable_shared
|
||||||
|
|
||||||
@ -464,17 +455,7 @@ endif # enable_shared
|
|||||||
clean-lib:
|
clean-lib:
|
||||||
rm -f lib$(NAME).a
|
rm -f lib$(NAME).a
|
||||||
ifeq ($(enable_shared), yes)
|
ifeq ($(enable_shared), yes)
|
||||||
rm -f $(shlib_bare) $(shlib_major) $(shlib) $(SHLIB_EXPORTS:%.txt=%.list)
|
rm -f $(shlib_bare) $(shlib_major) $(shlib) $(exports_file)
|
||||||
ifdef EXPSUFF
|
|
||||||
rm -f lib$(NAME)$(EXPSUFF)
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
ifeq ($(PORTNAME), cygwin)
|
|
||||||
rm -f $(NAME).dll $(NAME).def
|
|
||||||
endif
|
|
||||||
|
|
||||||
ifeq ($(PORTNAME), win32)
|
|
||||||
rm -f $(NAME).dll $(NAME).def
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifneq (,$(SHLIB_EXPORTS))
|
ifneq (,$(SHLIB_EXPORTS))
|
||||||
|
@ -24,10 +24,7 @@ else
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
|
|
||||||
EXPSUFF= .exp
|
POSTGRES_IMP= postgres.imp
|
||||||
IMPSUFF= .imp
|
|
||||||
|
|
||||||
POSTGRES_IMP= postgres$(IMPSUFF)
|
|
||||||
|
|
||||||
ifdef PGXS
|
ifdef PGXS
|
||||||
BE_DLLLIBS= -Wl,-bI:$(bindir)/postgres/$(POSTGRES_IMP)
|
BE_DLLLIBS= -Wl,-bI:$(bindir)/postgres/$(POSTGRES_IMP)
|
||||||
@ -37,10 +34,10 @@ endif
|
|||||||
|
|
||||||
MKLDEXPORT=$(top_srcdir)/src/backend/port/aix/mkldexport.sh
|
MKLDEXPORT=$(top_srcdir)/src/backend/port/aix/mkldexport.sh
|
||||||
|
|
||||||
%$(EXPSUFF): %.o
|
%.exp: %.o
|
||||||
$(MKLDEXPORT) $*.o > $*$(EXPSUFF)
|
$(MKLDEXPORT) $^ >$@
|
||||||
|
|
||||||
%$(DLSUFFIX): %.o %$(EXPSUFF)
|
%$(DLSUFFIX): %.o %.exp
|
||||||
$(CC) $(LDFLAGS) $(LDFLAGS_SL) -o $@ $*.o -Wl,-bE:$*$(EXPSUFF) $(SHLIB_LINK)
|
$(CC) $(LDFLAGS) $(LDFLAGS_SL) -o $@ $*.o -Wl,-bE:$*.exp $(SHLIB_LINK)
|
||||||
|
|
||||||
sqlmansect = 7
|
sqlmansect = 7
|
||||||
|
Loading…
x
Reference in New Issue
Block a user