| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
|
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
|
|
|
|
| COMPILER = $(CC) $(CFLAGS) |
| LINK.static = $(AR) $(AROPT) |
|
|
| LDFLAGS_INTERNAL += $(SHLIB_LINK_INTERNAL) |
|
|
|
|
|
|
| ifdef SO_MAJOR_VERSION |
| |
| shlib = lib$(NAME)$(DLSUFFIX).$(SO_MAJOR_VERSION).$(SO_MINOR_VERSION) |
| shlib_major = lib$(NAME)$(DLSUFFIX).$(SO_MAJOR_VERSION) |
| shlib_bare = lib$(NAME)$(DLSUFFIX) |
| |
| |
| soname = $(shlib_major) |
| pkgconfigdir = $(libdir)/pkgconfig |
| else |
| |
| shlib = $(NAME)$(DLSUFFIX) |
| endif |
| stlib = lib$(NAME).a |
|
|
| ifndef soname |
| |
| SHLIB_LINK += $(BE_DLLLIBS) |
| endif |
|
|
| |
| |
| |
| |
|
|
| |
|
|
| override CFLAGS += $(CFLAGS_SL) |
| override CXXFLAGS += $(CFLAGS_SL) |
| ifdef SO_MAJOR_VERSION |
| |
| override CPPFLAGS += -DSO_MAJOR_VERSION=$(SO_MAJOR_VERSION) |
| endif |
|
|
| ifeq ($(PORTNAME), darwin) |
| ifdef soname |
| |
| ifneq ($(SO_MAJOR_VERSION), 0) |
| version_link = -compatibility_version $(SO_MAJOR_VERSION) -current_version $(SO_MAJOR_VERSION).$(SO_MINOR_VERSION) |
| endif |
| LINK.shared = $(COMPILER) -dynamiclib -install_name '$(libdir)/lib$(NAME).$(SO_MAJOR_VERSION)$(DLSUFFIX)' $(version_link) $(exported_symbols_list) |
| shlib = lib$(NAME).$(SO_MAJOR_VERSION)$(DLSUFFIX) |
| shlib_major = lib$(NAME).$(SO_MAJOR_VERSION)$(DLSUFFIX) |
| else |
| |
| LINK.shared = $(COMPILER) -bundle |
| endif |
| BUILD.exports = $(AWK) '/^[^\#]/ {printf "_%s\n",$$1}' $< >$@ |
| exports_file = $(SHLIB_EXPORTS:%.txt=%.list) |
| ifneq (,$(exports_file)) |
| exported_symbols_list = -exported_symbols_list $(exports_file) |
| endif |
| endif |
|
|
| ifeq ($(PORTNAME), openbsd) |
| LINK.shared = $(COMPILER) -shared |
| ifdef soname |
| LINK.shared += -Wl,-x,-soname,$(soname) |
| endif |
| BUILD.exports = ( echo '{ global:'; $(AWK) '/^[^\#]/ {printf "%s;\n",$$1}' $<; echo ' local: *; };' ) >$@ |
| exports_file = $(SHLIB_EXPORTS:%.txt=%.list) |
| ifneq (,$(exports_file)) |
| LINK.shared += -Wl,--version-script=$(exports_file) |
| endif |
| SHLIB_LINK += -lc |
| endif |
|
|
| ifeq ($(PORTNAME), freebsd) |
| ifdef SO_MAJOR_VERSION |
| shlib = lib$(NAME)$(DLSUFFIX).$(SO_MAJOR_VERSION) |
| endif |
| LINK.shared = $(COMPILER) -shared |
| ifdef soname |
| LINK.shared += -Wl,-x,-soname,$(soname) |
| endif |
| BUILD.exports = ( echo '{ global:'; $(AWK) '/^[^\#]/ {printf "%s;\n",$$1}' $<; echo ' local: *; };' ) >$@ |
| exports_file = $(SHLIB_EXPORTS:%.txt=%.list) |
| ifneq (,$(exports_file)) |
| LINK.shared += -Wl,--version-script=$(exports_file) |
| endif |
| endif |
|
|
| ifeq ($(PORTNAME), netbsd) |
| LINK.shared = $(COMPILER) -shared |
| ifdef soname |
| LINK.shared += -Wl,-x,-soname,$(soname) |
| endif |
| BUILD.exports = ( echo '{ global:'; $(AWK) '/^[^\#]/ {printf "%s;\n",$$1}' $<; echo ' local: *; };' ) >$@ |
| exports_file = $(SHLIB_EXPORTS:%.txt=%.list) |
| ifneq (,$(exports_file)) |
| LINK.shared += -Wl,--version-script=$(exports_file) |
| endif |
| endif |
|
|
| ifeq ($(PORTNAME), linux) |
| LINK.shared = $(COMPILER) -shared |
| ifdef soname |
| ifneq (,$(findstring linux-android,$(host_os))) |
| |
| shlib = $(shlib_bare) |
| soname = $(shlib_bare) |
| endif |
| LINK.shared += -Wl,-soname,$(soname) |
| endif |
| BUILD.exports = ( echo '{ global:'; $(AWK) '/^[^\#]/ {printf "%s;\n",$$1}' $<; echo ' local: *; };' ) >$@ |
| exports_file = $(SHLIB_EXPORTS:%.txt=%.list) |
| ifneq (,$(exports_file)) |
| LINK.shared += -Wl,--version-script=$(exports_file) |
| endif |
| endif |
|
|
| ifeq ($(PORTNAME), solaris) |
| LINK.shared = $(COMPILER) -shared |
| ifdef soname |
| LINK.shared += -Wl,-soname,$(soname) |
| endif |
| BUILD.exports = ( echo '{ global:'; $(AWK) '/^[^\#]/ {printf "%s;\n",$$1}' $<; echo ' local: *; };' ) >$@ |
| exports_file = $(SHLIB_EXPORTS:%.txt=%.list) |
| ifneq (,$(exports_file)) |
| LINK.shared += -Wl,-M$(exports_file) |
| endif |
| endif |
|
|
| ifeq ($(PORTNAME), cygwin) |
| LINK.shared = $(CC) -shared |
| ifdef SO_MAJOR_VERSION |
| shlib = cyg$(NAME)$(DLSUFFIX) |
| endif |
| haslibarule = yes |
| endif |
|
|
| ifeq ($(PORTNAME), win32) |
| ifdef SO_MAJOR_VERSION |
| shlib = lib$(NAME)$(DLSUFFIX) |
| endif |
| haslibarule = yes |
| endif |
|
|
|
|
| |
| |
| |
| |
| |
| |
| ifeq ($(SHLIB_EXPORTS),) |
| |
| override LDFLAGS_SL += $(CFLAGS_SL_MODULE) |
| override CFLAGS += $(CFLAGS_SL_MODULE) |
| override CXXFLAGS += $(CXXFLAGS_SL_MODULE) |
| endif |
|
|
|
|
| |
| |
| |
|
|
| .PHONY: all-lib all-static-lib all-shared-lib |
|
|
| all-lib: all-shared-lib |
| ifdef soname |
| |
| all-lib: all-static-lib |
| all-lib: lib$(NAME).pc |
| endif |
|
|
| all-static-lib: $(stlib) |
|
|
| all-shared-lib: $(shlib) |
|
|
| |
| |
| |
| |
| |
| ifndef haslibarule |
| $(stlib): $(OBJS) | $(SHLIB_PREREQS) |
| rm -f $@ |
| $(LINK.static) $@ $^ |
| touch $@ |
| endif #haslibarule |
|
|
| ifeq (,$(filter cygwin win32,$(PORTNAME))) |
|
|
| |
| $(shlib): $(OBJS) | $(SHLIB_PREREQS) |
| $(LINK.shared) -o $@ $(OBJS) $(LDFLAGS) $(LDFLAGS_SL) $(SHLIB_LINK) |
| ifdef shlib_major |
| |
| ifneq ($(shlib), $(shlib_major)) |
| rm -f $(shlib_major) |
| $(LN_S) $(shlib) $(shlib_major) |
| endif |
| |
| ifneq ($(shlib), $(shlib_bare)) |
| rm -f $(shlib_bare) |
| $(LN_S) $(shlib) $(shlib_bare) |
| endif # shlib_bare |
| endif # shlib_major |
|
|
| |
| |
| |
| |
| ifneq (,$(SHLIB_EXPORTS)) |
| ifdef BUILD.exports |
| $(shlib): $(exports_file) |
|
|
| $(exports_file): $(SHLIB_EXPORTS) |
| $(BUILD.exports) |
| endif |
| endif |
|
|
| else # PORTNAME == cygwin || PORTNAME == win32 |
|
|
| ifeq ($(PORTNAME), cygwin) |
|
|
| |
|
|
| $(shlib): $(OBJS) | $(SHLIB_PREREQS) |
| $(CC) $(CFLAGS) -shared -o $@ -Wl,--out-implib=$(stlib) $(OBJS) $(LDFLAGS) $(LDFLAGS_SL) $(SHLIB_LINK) $(LIBS) $(LDAP_LIBS_BE) |
|
|
| |
| $(stlib): $(shlib) |
| touch $@ |
|
|
| else |
|
|
| |
|
|
| |
| $(stlib): $(shlib) |
| touch $@ |
|
|
| |
| |
| |
| |
| |
| |
| |
| |
| ifeq (,$(SHLIB_EXPORTS)) |
| $(shlib): $(OBJS) | $(SHLIB_PREREQS) |
| $(CC) $(CFLAGS) -shared -static-libgcc -o $@ $(OBJS) $(LDFLAGS) $(LDFLAGS_SL) $(SHLIB_LINK) $(LIBS) -Wl,--export-all-symbols -Wl,--out-implib=$(stlib) |
| else |
| DLL_DEFFILE = lib$(NAME)dll.def |
|
|
| $(shlib): $(OBJS) $(DLL_DEFFILE) | $(SHLIB_PREREQS) |
| $(CC) $(CFLAGS) -shared -static-libgcc -o $@ $(OBJS) $(DLL_DEFFILE) $(LDFLAGS) $(LDFLAGS_SL) $(SHLIB_LINK) $(LIBS) -Wl,--out-implib=$(stlib) |
|
|
| UC_NAME = $(shell echo $(NAME) | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ') |
|
|
| $(DLL_DEFFILE): $(SHLIB_EXPORTS) |
| echo 'LIBRARY LIB$(UC_NAME).dll' >$@ |
| echo 'EXPORTS' >>$@ |
| sed -e '/^#/d' -e 's/^\(.*[ ]\)\([0-9][0-9]*\)/ \1@ \2/' $< >>$@ |
| endif |
|
|
| endif # PORTNAME == cygwin |
| endif # PORTNAME == cygwin || PORTNAME == win32 |
|
|
|
|
| %.pc: $(MAKEFILE_LIST) |
| echo 'prefix=$(prefix)' >$@ |
| echo 'exec_prefix=$(patsubst $(prefix),$${prefix},$(exec_prefix))' >>$@ |
| echo 'libdir=$(patsubst $(exec_prefix)/%,$${exec_prefix}/%,$(libdir))' >>$@ |
| echo 'includedir=$(patsubst $(prefix)/%,$${prefix}/%,$(includedir))' >>$@ |
| echo >>$@ |
| echo 'Name: lib$(NAME)' >>$@ |
| echo 'Description: PostgreSQL lib$(NAME) library' >>$@ |
| echo 'URL: $(PACKAGE_URL)' >>$@ |
| echo 'Version: $(VERSION)' >>$@ |
| echo 'Requires: ' >>$@ |
| echo 'Requires.private: $(PKG_CONFIG_REQUIRES_PRIVATE)' >>$@ |
| echo 'Cflags: -I$${includedir}' >>$@ |
| echo 'Libs: -L$${libdir} -l$(NAME)' >>$@ |
| |
| |
| |
| |
| |
| echo 'Libs.private: $(sort $(filter-out -L.% -L$(top_srcdir)/%,$(filter -L%,$(LDFLAGS) $(SHLIB_LINK)))) $(filter-out $(PKG_CONFIG_REQUIRES_PRIVATE:lib%=-l%),$(filter -l%,$(SHLIB_LINK_INTERNAL:%_shlib=%) $(SHLIB_LINK)))' >>$@ |
|
|
|
|
| |
| |
| |
|
|
| .PHONY: install-lib install-lib-static install-lib-shared installdirs-lib |
| install-lib: install-lib-shared |
| ifdef soname |
| install-lib: install-lib-static |
| install-lib: install-lib-pc |
| endif |
|
|
| install-lib-pc: lib$(NAME).pc installdirs-lib |
| $(INSTALL_DATA) $< '$(DESTDIR)$(pkgconfigdir)/lib$(NAME).pc' |
|
|
| install-lib-static: $(stlib) installdirs-lib |
| $(INSTALL_STLIB) $< '$(DESTDIR)$(libdir)/$(stlib)' |
|
|
| install-lib-shared: $(shlib) installdirs-lib |
| ifdef soname |
| $(INSTALL_SHLIB) $< '$(DESTDIR)$(libdir)/$(shlib)' |
| ifneq ($(PORTNAME), cygwin) |
| ifneq ($(PORTNAME), win32) |
| ifneq ($(shlib), $(shlib_major)) |
| cd '$(DESTDIR)$(libdir)' && \ |
| rm -f $(shlib_major) && \ |
| $(LN_S) $(shlib) $(shlib_major) |
| endif |
| ifneq ($(shlib), $(shlib_bare)) |
| cd '$(DESTDIR)$(libdir)' && \ |
| rm -f $(shlib_bare) && \ |
| $(LN_S) $(shlib) $(shlib_bare) |
| endif |
| endif # not win32 |
| endif # not cygwin |
| ifneq (,$(findstring $(PORTNAME),win32 cygwin)) |
| $(INSTALL_SHLIB) $< '$(DESTDIR)$(bindir)/$(shlib)' |
| endif |
| else # no soname |
| $(INSTALL_SHLIB) $< '$(DESTDIR)$(pkglibdir)/$(shlib)' |
| endif |
|
|
|
|
| installdirs-lib: |
| ifdef soname |
| $(MKDIR_P) '$(DESTDIR)$(libdir)' '$(DESTDIR)$(pkgconfigdir)' $(if $(findstring $(PORTNAME),win32 cygwin),'$(DESTDIR)$(bindir)') |
| else |
| $(MKDIR_P) '$(DESTDIR)$(pkglibdir)' |
| endif |
|
|
|
|
| |
| |
| |
|
|
| .PHONY: uninstall-lib |
| uninstall-lib: |
| ifdef soname |
| rm -f '$(DESTDIR)$(libdir)/$(stlib)' |
| rm -f '$(DESTDIR)$(libdir)/$(shlib_bare)' \ |
| '$(DESTDIR)$(libdir)/$(shlib_major)' \ |
| '$(DESTDIR)$(libdir)/$(shlib)' $(if $(findstring $(PORTNAME),win32 cygwin),'$(DESTDIR)$(bindir)/$(shlib)') \ |
| '$(DESTDIR)$(pkgconfigdir)/lib$(NAME).pc' |
| else # no soname |
| rm -f '$(DESTDIR)$(pkglibdir)/$(shlib)' |
| endif # no soname |
|
|
|
|
| |
| |
| |
|
|
| .PHONY: clean-lib |
| clean-lib: |
| rm -f $(shlib) $(shlib_bare) $(shlib_major) $(stlib) $(exports_file) lib$(NAME).pc |
| ifneq (,$(DLL_DEFFILE)) |
| rm -f $(DLL_DEFFILE) |
| endif |
|
|