1998-10-19 02:00:51 +02:00
|
|
|
#-------------------------------------------------------------------------
|
|
|
|
#
|
|
|
|
# Makefile.shlib
|
|
|
|
# Common rules for building shared libraries
|
|
|
|
#
|
|
|
|
# Copyright (c) 1998, Regents of the University of California
|
|
|
|
#
|
|
|
|
# IDENTIFICATION
|
2010-09-20 22:08:53 +02:00
|
|
|
# src/Makefile.shlib
|
1998-10-19 02:00:51 +02:00
|
|
|
#
|
|
|
|
#-------------------------------------------------------------------------
|
|
|
|
|
2000-06-28 20:30:16 +02:00
|
|
|
# This file should be included by any Postgres module Makefile that
|
|
|
|
# wants to build a shared library (if possible for the current
|
|
|
|
# platform). A static library is also built from the same object
|
|
|
|
# files. Only one library can be built per makefile.
|
1998-10-19 02:00:51 +02:00
|
|
|
#
|
2000-06-28 20:30:16 +02:00
|
|
|
# Before including this file, the module Makefile must define these
|
|
|
|
# variables:
|
1998-10-19 02:00:51 +02:00
|
|
|
#
|
2000-06-28 20:30:16 +02:00
|
|
|
# NAME Name of library to build (no suffix nor "lib" prefix)
|
|
|
|
# OBJS List of object files to include in library
|
Prevent accidental linking of system-supplied copies of libpq.so etc.
We were being careless in some places about the order of -L switches in
link command lines, such that -L switches referring to external directories
could come before those referring to directories within the build tree.
This made it possible to accidentally link a system-supplied library, for
example /usr/lib/libpq.so, in place of the one built in the build tree.
Hilarity ensued, the more so the older the system-supplied library is.
To fix, break LDFLAGS into two parts, a sub-variable LDFLAGS_INTERNAL
and the main LDFLAGS variable, both of which are "recursively expanded"
so that they can be incrementally adjusted by different makefiles.
Establish a policy that -L switches for directories in the build tree
must always be added to LDFLAGS_INTERNAL, while -L switches for external
directories must always be added to LDFLAGS. This is sufficient to
ensure a safe search order. For simplicity, we typically also put -l
switches for the respective libraries into those same variables.
(Traditional make usage would have us put -l switches into LIBS, but
cleaning that up is a project for another day, as there's no clear
need for it.)
This turns out to also require separating SHLIB_LINK into two variables,
SHLIB_LINK and SHLIB_LINK_INTERNAL, with a similar rule about which
switches go into which variable. And likewise for PG_LIBS.
Although this change might appear to affect external users of pgxs.mk,
I think it doesn't; they shouldn't have any need to touch the _INTERNAL
variables.
In passing, tweak src/common/Makefile so that the value of CPPFLAGS
recorded in pg_config lacks "-DFRONTEND" and the recorded value of
LDFLAGS lacks "-L../../../src/common". Both of those things are
mistakes, apparently introduced during prior code rearrangements,
as old versions of pg_config don't print them. In general we don't
want anything that's specific to the src/common subdirectory to
appear in those outputs.
This is certainly a bug fix, but in view of the lack of field
complaints, I'm unsure whether it's worth the risk of back-patching.
In any case it seems wise to see what the buildfarm makes of it first.
Discussion: https://postgr.es/m/25214.1522604295@sss.pgh.pa.us
2018-04-03 22:26:05 +02:00
|
|
|
# SHLIB_LINK Stuff to append to library's link command
|
|
|
|
# (typically, -L and -l switches for external libraries)
|
|
|
|
# SHLIB_LINK_INTERNAL -L and -l switches for Postgres-supplied libraries
|
2010-11-12 21:15:16 +01:00
|
|
|
# SHLIB_PREREQS Order-only prerequisites for library build target
|
2008-02-26 07:41:24 +01:00
|
|
|
# SHLIB_EXPORTS (optional) Name of file containing list of symbols to
|
2009-08-27 19:55:53 +02:00
|
|
|
# export, in the format "function_name number"
|
2008-04-07 16:15:58 +02:00
|
|
|
#
|
Prevent accidental linking of system-supplied copies of libpq.so etc.
We were being careless in some places about the order of -L switches in
link command lines, such that -L switches referring to external directories
could come before those referring to directories within the build tree.
This made it possible to accidentally link a system-supplied library, for
example /usr/lib/libpq.so, in place of the one built in the build tree.
Hilarity ensued, the more so the older the system-supplied library is.
To fix, break LDFLAGS into two parts, a sub-variable LDFLAGS_INTERNAL
and the main LDFLAGS variable, both of which are "recursively expanded"
so that they can be incrementally adjusted by different makefiles.
Establish a policy that -L switches for directories in the build tree
must always be added to LDFLAGS_INTERNAL, while -L switches for external
directories must always be added to LDFLAGS. This is sufficient to
ensure a safe search order. For simplicity, we typically also put -l
switches for the respective libraries into those same variables.
(Traditional make usage would have us put -l switches into LIBS, but
cleaning that up is a project for another day, as there's no clear
need for it.)
This turns out to also require separating SHLIB_LINK into two variables,
SHLIB_LINK and SHLIB_LINK_INTERNAL, with a similar rule about which
switches go into which variable. And likewise for PG_LIBS.
Although this change might appear to affect external users of pgxs.mk,
I think it doesn't; they shouldn't have any need to touch the _INTERNAL
variables.
In passing, tweak src/common/Makefile so that the value of CPPFLAGS
recorded in pg_config lacks "-DFRONTEND" and the recorded value of
LDFLAGS lacks "-L../../../src/common". Both of those things are
mistakes, apparently introduced during prior code rearrangements,
as old versions of pg_config don't print them. In general we don't
want anything that's specific to the src/common subdirectory to
appear in those outputs.
This is certainly a bug fix, but in view of the lack of field
complaints, I'm unsure whether it's worth the risk of back-patching.
In any case it seems wise to see what the buildfarm makes of it first.
Discussion: https://postgr.es/m/25214.1522604295@sss.pgh.pa.us
2018-04-03 22:26:05 +02:00
|
|
|
# Don't use SHLIB_LINK for references to files in the build tree, or the
|
|
|
|
# wrong things will happen --- use SHLIB_LINK_INTERNAL for those!
|
|
|
|
#
|
2008-04-07 16:15:58 +02:00
|
|
|
# When building a shared library, the following version information
|
|
|
|
# must also be set. It should be omitted when building a dynamically
|
|
|
|
# loadable module.
|
|
|
|
#
|
|
|
|
# SO_MAJOR_VERSION Major version number to use for shared library
|
|
|
|
# SO_MINOR_VERSION Minor version number to use for shared library
|
2000-06-28 20:30:16 +02:00
|
|
|
# (If you want a patchlevel, include it in SO_MINOR_VERSION, e.g., "6.2".)
|
1998-10-19 02:00:51 +02:00
|
|
|
#
|
2000-06-28 20:30:16 +02:00
|
|
|
# The module Makefile must also include
|
|
|
|
# $(top_builddir)/src/Makefile.global before including this file.
|
|
|
|
# (Makefile.global sets PORTNAME and other needed symbols.)
|
1998-10-19 02:00:51 +02:00
|
|
|
#
|
2000-06-28 20:30:16 +02:00
|
|
|
# This makefile provides the following (phony) targets:
|
1998-10-19 02:00:51 +02:00
|
|
|
#
|
2000-06-28 20:30:16 +02:00
|
|
|
# all-lib build the static and shared (if applicable) libraries
|
|
|
|
# install-lib install the libraries into $(libdir)
|
2008-04-07 16:15:58 +02:00
|
|
|
# installdirs-lib create installation directory $(libdir)
|
2000-06-28 20:30:16 +02:00
|
|
|
# uninstall-lib remove the libraries from $(libdir)
|
|
|
|
# clean-lib delete the static and shared libraries from the build dir
|
1998-10-19 02:00:51 +02:00
|
|
|
#
|
2016-10-01 19:45:16 +02:00
|
|
|
# Typically you would add `all-lib' to the `all' target so that `make all'
|
|
|
|
# builds the libraries. In the most simple case it would look like this:
|
2000-06-28 20:30:16 +02:00
|
|
|
#
|
|
|
|
# all: all-lib
|
|
|
|
#
|
|
|
|
# Similarly, the install rule might look like
|
|
|
|
#
|
|
|
|
# install: install-lib
|
|
|
|
#
|
|
|
|
# plus any additional things you want to install. Et cetera.
|
|
|
|
#
|
|
|
|
# Got that? Look at src/interfaces/libpq/Makefile for an example.
|
2001-02-10 19:46:34 +01:00
|
|
|
#
|
|
|
|
|
1998-10-19 02:00:51 +02:00
|
|
|
|
2000-10-31 20:55:20 +01:00
|
|
|
COMPILER = $(CC) $(CFLAGS)
|
2000-10-23 23:44:12 +02:00
|
|
|
LINK.static = $(AR) $(AROPT)
|
|
|
|
|
Prevent accidental linking of system-supplied copies of libpq.so etc.
We were being careless in some places about the order of -L switches in
link command lines, such that -L switches referring to external directories
could come before those referring to directories within the build tree.
This made it possible to accidentally link a system-supplied library, for
example /usr/lib/libpq.so, in place of the one built in the build tree.
Hilarity ensued, the more so the older the system-supplied library is.
To fix, break LDFLAGS into two parts, a sub-variable LDFLAGS_INTERNAL
and the main LDFLAGS variable, both of which are "recursively expanded"
so that they can be incrementally adjusted by different makefiles.
Establish a policy that -L switches for directories in the build tree
must always be added to LDFLAGS_INTERNAL, while -L switches for external
directories must always be added to LDFLAGS. This is sufficient to
ensure a safe search order. For simplicity, we typically also put -l
switches for the respective libraries into those same variables.
(Traditional make usage would have us put -l switches into LIBS, but
cleaning that up is a project for another day, as there's no clear
need for it.)
This turns out to also require separating SHLIB_LINK into two variables,
SHLIB_LINK and SHLIB_LINK_INTERNAL, with a similar rule about which
switches go into which variable. And likewise for PG_LIBS.
Although this change might appear to affect external users of pgxs.mk,
I think it doesn't; they shouldn't have any need to touch the _INTERNAL
variables.
In passing, tweak src/common/Makefile so that the value of CPPFLAGS
recorded in pg_config lacks "-DFRONTEND" and the recorded value of
LDFLAGS lacks "-L../../../src/common". Both of those things are
mistakes, apparently introduced during prior code rearrangements,
as old versions of pg_config don't print them. In general we don't
want anything that's specific to the src/common subdirectory to
appear in those outputs.
This is certainly a bug fix, but in view of the lack of field
complaints, I'm unsure whether it's worth the risk of back-patching.
In any case it seems wise to see what the buildfarm makes of it first.
Discussion: https://postgr.es/m/25214.1522604295@sss.pgh.pa.us
2018-04-03 22:26:05 +02:00
|
|
|
LDFLAGS_INTERNAL += $(SHLIB_LINK_INTERNAL)
|
|
|
|
|
2000-10-23 23:44:12 +02:00
|
|
|
|
|
|
|
|
2008-04-07 16:15:58 +02:00
|
|
|
ifdef SO_MAJOR_VERSION
|
|
|
|
# Default library naming convention used by the majority of platforms
|
2004-07-13 02:06:46 +02:00
|
|
|
shlib = lib$(NAME)$(DLSUFFIX).$(SO_MAJOR_VERSION).$(SO_MINOR_VERSION)
|
|
|
|
shlib_major = lib$(NAME)$(DLSUFFIX).$(SO_MAJOR_VERSION)
|
|
|
|
shlib_bare = lib$(NAME)$(DLSUFFIX)
|
2008-04-07 16:15:58 +02:00
|
|
|
# Testing the soname variable is a reliable way to determine whether a
|
|
|
|
# linkable library is being built.
|
|
|
|
soname = $(shlib_major)
|
2013-03-31 22:58:40 +02:00
|
|
|
pkgconfigdir = $(libdir)/pkgconfig
|
2008-04-07 16:15:58 +02:00
|
|
|
else
|
|
|
|
# Naming convention for dynamically loadable modules
|
|
|
|
shlib = $(NAME)$(DLSUFFIX)
|
|
|
|
endif
|
2008-04-08 01:08:15 +02:00
|
|
|
stlib = lib$(NAME).a
|
2008-04-07 16:15:58 +02:00
|
|
|
|
|
|
|
ifndef soname
|
|
|
|
# additional flags for backend modules
|
2010-07-05 20:54:38 +02:00
|
|
|
SHLIB_LINK += $(BE_DLLLIBS)
|
2008-04-07 16:15:58 +02:00
|
|
|
endif
|
2004-07-13 02:06:46 +02:00
|
|
|
|
2000-10-23 23:44:12 +02:00
|
|
|
# For each platform we support shared libraries on, set shlib to the
|
2004-07-13 02:06:46 +02:00
|
|
|
# name of the library (if default above is not right), set
|
|
|
|
# LINK.shared to the command to link the library,
|
2000-10-23 23:44:12 +02:00
|
|
|
# and adjust SHLIB_LINK if necessary.
|
1998-10-19 02:00:51 +02:00
|
|
|
|
1999-07-17 00:56:01 +02:00
|
|
|
# Try to keep the sections in some kind of order, folks...
|
1999-07-08 02:15:03 +02:00
|
|
|
|
2002-09-05 00:54:18 +02:00
|
|
|
override CFLAGS += $(CFLAGS_SL)
|
2018-03-20 23:41:15 +01:00
|
|
|
override CXXFLAGS += $(CFLAGS_SL)
|
2008-12-11 08:34:09 +01:00
|
|
|
ifdef SO_MAJOR_VERSION
|
|
|
|
# libraries ought to use this to refer to versioned gettext domain names
|
|
|
|
override CPPFLAGS += -DSO_MAJOR_VERSION=$(SO_MAJOR_VERSION)
|
|
|
|
endif
|
2000-10-23 23:44:12 +02:00
|
|
|
|
1999-07-17 00:56:01 +02:00
|
|
|
ifeq ($(PORTNAME), aix)
|
2022-09-10 04:11:49 +02:00
|
|
|
LINK.shared = $(COMPILER)
|
2008-04-07 16:15:58 +02:00
|
|
|
ifdef SO_MAJOR_VERSION
|
|
|
|
shlib = lib$(NAME)$(DLSUFFIX).$(SO_MAJOR_VERSION)
|
|
|
|
endif
|
2006-09-19 17:36:08 +02:00
|
|
|
haslibarule = yes
|
2015-07-16 03:00:26 +02:00
|
|
|
# $(exports_file) is also usable as an import file
|
2008-02-26 11:45:24 +01:00
|
|
|
exports_file = lib$(NAME).exp
|
2022-09-10 04:11:49 +02:00
|
|
|
BUILD.exports = ( echo '\#! $(shlib)'; $(AWK) '/^[^\#]/ {printf "%s\n",$$1}' $< ) > $@
|
|
|
|
ifneq (,$(SHLIB_EXPORTS))
|
|
|
|
LINK.shared += -Wl,-bE:$(exports_file)
|
|
|
|
endif
|
1998-10-31 04:58:55 +01:00
|
|
|
endif
|
|
|
|
|
2000-10-31 20:55:20 +01:00
|
|
|
ifeq ($(PORTNAME), darwin)
|
2008-04-07 16:15:58 +02:00
|
|
|
ifdef soname
|
2004-07-13 02:06:46 +02:00
|
|
|
# linkable library
|
2008-04-07 16:15:58 +02:00
|
|
|
ifneq ($(SO_MAJOR_VERSION), 0)
|
|
|
|
version_link = -compatibility_version $(SO_MAJOR_VERSION) -current_version $(SO_MAJOR_VERSION).$(SO_MINOR_VERSION)
|
|
|
|
endif
|
2011-06-16 03:45:23 +02:00
|
|
|
LINK.shared = $(COMPILER) -dynamiclib -install_name '$(libdir)/lib$(NAME).$(SO_MAJOR_VERSION)$(DLSUFFIX)' $(version_link) $(exported_symbols_list) -multiply_defined suppress
|
2022-08-24 08:23:49 +02:00
|
|
|
shlib = lib$(NAME).$(SO_MAJOR_VERSION)$(DLSUFFIX)
|
2008-04-07 16:15:58 +02:00
|
|
|
shlib_major = lib$(NAME).$(SO_MAJOR_VERSION)$(DLSUFFIX)
|
2004-07-13 02:06:46 +02:00
|
|
|
else
|
2008-04-07 16:15:58 +02:00
|
|
|
# loadable module
|
2016-10-06 05:03:55 +02:00
|
|
|
LINK.shared = $(COMPILER) -bundle -multiply_defined suppress
|
2004-07-13 02:06:46 +02:00
|
|
|
endif
|
2008-02-26 11:30:06 +01:00
|
|
|
BUILD.exports = $(AWK) '/^[^\#]/ {printf "_%s\n",$$1}' $< >$@
|
2008-02-26 11:45:24 +01:00
|
|
|
exports_file = $(SHLIB_EXPORTS:%.txt=%.list)
|
|
|
|
ifneq (,$(exports_file))
|
|
|
|
exported_symbols_list = -exported_symbols_list $(exports_file)
|
2008-02-26 07:41:24 +01:00
|
|
|
endif
|
2000-10-31 20:55:20 +01:00
|
|
|
endif
|
|
|
|
|
2000-10-10 23:22:29 +02:00
|
|
|
ifeq ($(PORTNAME), openbsd)
|
2019-07-02 00:46:24 +02:00
|
|
|
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)
|
1998-10-19 02:00:51 +02:00
|
|
|
endif
|
2019-07-02 00:46:24 +02:00
|
|
|
SHLIB_LINK += -lc
|
1998-10-19 02:00:51 +02:00
|
|
|
endif
|
|
|
|
|
1999-07-17 00:56:01 +02:00
|
|
|
ifeq ($(PORTNAME), freebsd)
|
2019-07-02 00:46:24 +02:00
|
|
|
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)
|
1999-07-17 00:56:01 +02:00
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
2000-03-08 02:58:46 +01:00
|
|
|
ifeq ($(PORTNAME), netbsd)
|
2019-07-02 00:46:24 +02:00
|
|
|
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)
|
2000-03-08 02:58:46 +01:00
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
1998-10-19 02:00:51 +02:00
|
|
|
ifeq ($(PORTNAME), linux)
|
2008-04-07 16:15:58 +02:00
|
|
|
LINK.shared = $(COMPILER) -shared
|
|
|
|
ifdef soname
|
|
|
|
LINK.shared += -Wl,-soname,$(soname)
|
|
|
|
endif
|
2008-02-26 07:41:24 +01:00
|
|
|
BUILD.exports = ( echo '{ global:'; $(AWK) '/^[^\#]/ {printf "%s;\n",$$1}' $<; echo ' local: *; };' ) >$@
|
2008-02-26 11:45:24 +01:00
|
|
|
exports_file = $(SHLIB_EXPORTS:%.txt=%.list)
|
|
|
|
ifneq (,$(exports_file))
|
|
|
|
LINK.shared += -Wl,--version-script=$(exports_file)
|
2008-02-26 07:41:24 +01:00
|
|
|
endif
|
1998-10-19 02:00:51 +02:00
|
|
|
endif
|
|
|
|
|
2000-10-10 23:22:29 +02:00
|
|
|
ifeq ($(PORTNAME), solaris)
|
2022-08-25 05:37:54 +02:00
|
|
|
LINK.shared = $(COMPILER) -shared
|
2008-04-07 16:15:58 +02:00
|
|
|
ifdef soname
|
2022-08-07 18:36:01 +02:00
|
|
|
LINK.shared += -Wl,-soname,$(soname)
|
2000-11-08 21:18:49 +01:00
|
|
|
endif
|
2022-08-25 05:37:54 +02:00
|
|
|
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
|
1998-10-19 02:00:51 +02:00
|
|
|
endif
|
|
|
|
|
2003-03-21 18:18:34 +01:00
|
|
|
ifeq ($(PORTNAME), cygwin)
|
2014-02-01 22:08:33 +01:00
|
|
|
LINK.shared = $(CC) -shared
|
2008-04-08 11:50:29 +02:00
|
|
|
ifdef SO_MAJOR_VERSION
|
|
|
|
shlib = cyg$(NAME)$(DLSUFFIX)
|
|
|
|
endif
|
2004-11-16 22:51:13 +01:00
|
|
|
haslibarule = yes
|
1999-01-17 07:20:06 +01:00
|
|
|
endif
|
1998-10-19 02:00:51 +02:00
|
|
|
|
2003-12-01 23:23:06 +01:00
|
|
|
ifeq ($(PORTNAME), win32)
|
2008-04-08 11:50:29 +02:00
|
|
|
ifdef SO_MAJOR_VERSION
|
|
|
|
shlib = lib$(NAME)$(DLSUFFIX)
|
|
|
|
endif
|
2004-11-16 22:51:13 +01:00
|
|
|
haslibarule = yes
|
2003-12-01 23:23:06 +01:00
|
|
|
endif
|
|
|
|
|
2000-06-28 20:30:16 +02:00
|
|
|
|
Default to hidden visibility for extension libraries where possible
Until now postgres built extension libraries with global visibility, i.e.
exporting all symbols. On the one platform where that behavior is not
natively available, namely windows, we emulate it by analyzing the input files
to the shared library and exporting all the symbols therein.
Not exporting all symbols is actually desirable, as it can improve loading
speed, reduces the likelihood of symbol conflicts and can improve intra
extension library function call performance. It also makes the non-windows
builds more similar to windows builds.
Additionally, with meson implementing the export-all-symbols behavior for
windows, turns out to be more verbose than desirable.
This patch adds support for hiding symbols by default and, to counteract that,
explicit symbol visibility annotation for compilers that support
__attribute__((visibility("default"))) and -fvisibility=hidden. That is
expected to be most, if not all, compilers except msvc (for which we already
support explicit symbol export annotations).
Now that extension library symbols are explicitly exported, we don't need to
export all symbols on windows anymore, hence remove that behavior from
src/tools/msvc. The supporting code can't be removed, as we still need to
export all symbols from the main postgres binary.
Author: Andres Freund <andres@anarazel.de>
Author: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://postgr.es/m/20211101020311.av6hphdl6xbjbuif@alap3.anarazel.de
2022-07-18 02:49:51 +02:00
|
|
|
# If the shared library doesn't have an export file, mark all symbols not
|
|
|
|
# explicitly exported using PGDLLEXPORT as hidden. We can't pass these flags
|
|
|
|
# when building a library with explicit exports, as the symbols would be
|
|
|
|
# hidden before the linker script / exported symbol list takes effect.
|
|
|
|
#
|
|
|
|
# This is duplicated in pgxs.mk for MODULES style libraries.
|
|
|
|
ifeq ($(SHLIB_EXPORTS),)
|
|
|
|
# LDFLAGS_SL addition not strictly needed, CFLAGS used everywhere, but ...
|
|
|
|
override LDFLAGS_SL += $(CFLAGS_SL_MODULE)
|
|
|
|
override CFLAGS += $(CFLAGS_SL_MODULE)
|
|
|
|
override CXXFLAGS += $(CXXFLAGS_SL_MODULE)
|
|
|
|
endif
|
|
|
|
|
2000-06-28 20:30:16 +02:00
|
|
|
|
|
|
|
##
|
|
|
|
## BUILD
|
|
|
|
##
|
|
|
|
|
2002-09-04 17:45:50 +02:00
|
|
|
.PHONY: all-lib all-static-lib all-shared-lib
|
|
|
|
|
2008-04-07 16:15:58 +02:00
|
|
|
all-lib: all-shared-lib
|
|
|
|
ifdef soname
|
|
|
|
# no static library when building a dynamically loadable module
|
|
|
|
all-lib: all-static-lib
|
2013-03-31 22:58:40 +02:00
|
|
|
all-lib: lib$(NAME).pc
|
2008-04-07 16:15:58 +02:00
|
|
|
endif
|
2002-09-04 17:45:50 +02:00
|
|
|
|
2008-04-07 16:15:58 +02:00
|
|
|
all-static-lib: $(stlib)
|
2002-09-04 17:45:50 +02:00
|
|
|
|
2004-11-20 22:13:06 +01:00
|
|
|
all-shared-lib: $(shlib)
|
1998-10-19 02:00:51 +02:00
|
|
|
|
Ensure static libraries have correct mod time even if ranlib messes it up.
In at least Apple's version of ranlib, the output file is updated to have
a mod time equal to the max of the timestamps of its components, and that
data only has seconds precision. On a filesystem with sub-second file
timestamp precision --- say, APFS --- this can result in the finished
static library appearing older than its input files, which causes useless
rebuilds and possible outright failures in parallel makes.
We've only seen this reported in the field from people using Apple's
ranlib with a non-Apple make, because Apple's make doesn't know about
sub-second timestamps either so it doesn't decide rebuilds are needed.
But Apple's ranlib presumably shares code with at least some BSDen,
so it's not that unlikely that the same problem could arise elsewhere.
To fix, just "touch" the output file after ranlib finishes.
We seem to need this in only one place. There are other calls of
ranlib in our makefiles, but they are working on intermediate files
whose timestamps are not actually important, or else on an installed
static library for which sub-second timestamp precision is unlikely
to matter either. (Also, so far as I can tell, Apple's ranlib doesn't
mess up the file timestamp in the latter usage anyhow.)
In passing, change "ranlib" to "$(RANLIB)" in one place that was
bypassing the make macro for no good reason.
Per bug #15525 from Jack Kelly (via Alyssa Ross).
Back-patch to all supported branches.
Discussion: https://postgr.es/m/15525-a30da084f17a1faa@postgresql.org
2018-11-29 21:53:44 +01:00
|
|
|
# In this rule, "touch $@" works around a problem on some platforms wherein
|
autoconf: Rely on ar supporting index creation
This way we don't need RANLIB anymore, making it a bit simpler for the meson
build to generate Makefile.global for PGXS compatibility.
FreeBSD, NetBSD, OpenBSD, the only platforms where we didn't use AROPT=crs,
all have supported the 's' option for a long time.
On macOS we ran ranlib after installing a static library. This was added a
long time ago, in 58ad65ec2def. I cannot reproduce an issue in more recent
macOS versions. This is removed now.
Based on discussion with Tom, I left the 'touch' at the end of static
libraries generation, added in 826eff57c4c, in place. While it looks like
current versions of Apple's ar/ranlib don't need it, it was needed not too
long ago.
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://postgr.es/m/20221005200710.luvw5evhwf6clig6@awork3.anarazel.de
2022-10-07 20:53:39 +02:00
|
|
|
# ar updates the library file's mod time with a value calculated to
|
Ensure static libraries have correct mod time even if ranlib messes it up.
In at least Apple's version of ranlib, the output file is updated to have
a mod time equal to the max of the timestamps of its components, and that
data only has seconds precision. On a filesystem with sub-second file
timestamp precision --- say, APFS --- this can result in the finished
static library appearing older than its input files, which causes useless
rebuilds and possible outright failures in parallel makes.
We've only seen this reported in the field from people using Apple's
ranlib with a non-Apple make, because Apple's make doesn't know about
sub-second timestamps either so it doesn't decide rebuilds are needed.
But Apple's ranlib presumably shares code with at least some BSDen,
so it's not that unlikely that the same problem could arise elsewhere.
To fix, just "touch" the output file after ranlib finishes.
We seem to need this in only one place. There are other calls of
ranlib in our makefiles, but they are working on intermediate files
whose timestamps are not actually important, or else on an installed
static library for which sub-second timestamp precision is unlikely
to matter either. (Also, so far as I can tell, Apple's ranlib doesn't
mess up the file timestamp in the latter usage anyhow.)
In passing, change "ranlib" to "$(RANLIB)" in one place that was
bypassing the make macro for no good reason.
Per bug #15525 from Jack Kelly (via Alyssa Ross).
Back-patch to all supported branches.
Discussion: https://postgr.es/m/15525-a30da084f17a1faa@postgresql.org
2018-11-29 21:53:44 +01:00
|
|
|
# seconds precision. If the filesystem has sub-second timestamps, this can
|
|
|
|
# cause the library file to appear older than its input files, triggering
|
|
|
|
# parallel-make problems.
|
2004-11-16 22:51:13 +01:00
|
|
|
ifndef haslibarule
|
2010-11-12 21:15:16 +01:00
|
|
|
$(stlib): $(OBJS) | $(SHLIB_PREREQS)
|
2015-03-01 19:05:23 +01:00
|
|
|
rm -f $@
|
2000-10-23 23:44:12 +02:00
|
|
|
$(LINK.static) $@ $^
|
Ensure static libraries have correct mod time even if ranlib messes it up.
In at least Apple's version of ranlib, the output file is updated to have
a mod time equal to the max of the timestamps of its components, and that
data only has seconds precision. On a filesystem with sub-second file
timestamp precision --- say, APFS --- this can result in the finished
static library appearing older than its input files, which causes useless
rebuilds and possible outright failures in parallel makes.
We've only seen this reported in the field from people using Apple's
ranlib with a non-Apple make, because Apple's make doesn't know about
sub-second timestamps either so it doesn't decide rebuilds are needed.
But Apple's ranlib presumably shares code with at least some BSDen,
so it's not that unlikely that the same problem could arise elsewhere.
To fix, just "touch" the output file after ranlib finishes.
We seem to need this in only one place. There are other calls of
ranlib in our makefiles, but they are working on intermediate files
whose timestamps are not actually important, or else on an installed
static library for which sub-second timestamp precision is unlikely
to matter either. (Also, so far as I can tell, Apple's ranlib doesn't
mess up the file timestamp in the latter usage anyhow.)
In passing, change "ranlib" to "$(RANLIB)" in one place that was
bypassing the make macro for no good reason.
Per bug #15525 from Jack Kelly (via Alyssa Ross).
Back-patch to all supported branches.
Discussion: https://postgr.es/m/15525-a30da084f17a1faa@postgresql.org
2018-11-29 21:53:44 +01:00
|
|
|
touch $@
|
2004-11-16 22:51:13 +01:00
|
|
|
endif #haslibarule
|
1999-07-17 00:56:01 +02:00
|
|
|
|
2022-09-10 04:11:49 +02:00
|
|
|
# AIX wraps shared libraries inside a static library, can be used both
|
|
|
|
# for static and shared linking
|
|
|
|
ifeq ($(PORTNAME), aix)
|
|
|
|
$(stlib): $(shlib)
|
|
|
|
rm -f $(stlib)
|
|
|
|
$(AR) $(AROPT) $(stlib) $(shlib)
|
|
|
|
endif # aix
|
2000-10-23 23:44:12 +02:00
|
|
|
|
2008-02-26 11:45:24 +01:00
|
|
|
ifeq (,$(filter cygwin win32,$(PORTNAME)))
|
1999-07-01 01:54:18 +02:00
|
|
|
|
1999-07-17 00:56:01 +02:00
|
|
|
# Normal case
|
2010-11-12 21:15:16 +01:00
|
|
|
$(shlib): $(OBJS) | $(SHLIB_PREREQS)
|
2010-07-06 05:55:33 +02:00
|
|
|
$(LINK.shared) -o $@ $(OBJS) $(LDFLAGS) $(LDFLAGS_SL) $(SHLIB_LINK)
|
2008-04-07 16:15:58 +02:00
|
|
|
ifdef shlib_major
|
2000-06-28 20:30:16 +02:00
|
|
|
# If we're using major and minor versions, then make a symlink to major-version-only.
|
2004-07-13 02:06:46 +02:00
|
|
|
ifneq ($(shlib), $(shlib_major))
|
|
|
|
rm -f $(shlib_major)
|
|
|
|
$(LN_S) $(shlib) $(shlib_major)
|
2000-06-28 20:30:16 +02:00
|
|
|
endif
|
|
|
|
# Make sure we have a link to a name without any version numbers
|
2004-07-13 02:06:46 +02:00
|
|
|
ifneq ($(shlib), $(shlib_bare))
|
2022-09-10 04:11:49 +02:00
|
|
|
# except on AIX, where that's not a thing
|
|
|
|
ifneq ($(PORTNAME), aix)
|
2004-07-13 02:06:46 +02:00
|
|
|
rm -f $(shlib_bare)
|
|
|
|
$(LN_S) $(shlib) $(shlib_bare)
|
2022-09-10 04:11:49 +02:00
|
|
|
endif # aix
|
|
|
|
endif # shlib_bare
|
2008-04-07 16:15:58 +02:00
|
|
|
endif # shlib_major
|
1999-07-01 01:54:18 +02:00
|
|
|
|
2008-02-26 07:41:24 +01:00
|
|
|
# Where possible, restrict the symbols exported by the library to just the
|
Refer to OS X as "macOS", except for the port name which is still "darwin".
We weren't terribly consistent about whether to call Apple's OS "OS X"
or "Mac OS X", and the former is probably confusing to people who aren't
Apple users. Now that Apple has rebranded it "macOS", follow their lead
to establish a consistent naming pattern. Also, avoid the use of the
ancient project name "Darwin", except as the port code name which does not
seem desirable to change. (In short, this patch touches documentation and
comments, but no actual code.)
I didn't touch contrib/start-scripts/osx/, either. I suspect those are
obsolete and due for a rewrite, anyway.
I dithered about whether to apply this edit to old release notes, but
those were responsible for quite a lot of the inconsistencies, so I ended
up changing them too. Anyway, Apple's being ahistorical about this,
so why shouldn't we be?
2016-09-25 21:40:57 +02:00
|
|
|
# official list, so as to avoid unintentional ABI changes. On recent macOS
|
2008-02-26 07:41:24 +01:00
|
|
|
# this also quiets multiply-defined-symbol warnings in programs that use
|
|
|
|
# libpgport along with libpq.
|
|
|
|
ifneq (,$(SHLIB_EXPORTS))
|
|
|
|
ifdef BUILD.exports
|
2022-09-10 04:11:49 +02:00
|
|
|
$(shlib): $(exports_file)
|
2008-02-26 07:41:24 +01:00
|
|
|
|
2022-09-10 04:11:49 +02:00
|
|
|
$(exports_file): $(SHLIB_EXPORTS)
|
2008-02-26 07:41:24 +01:00
|
|
|
$(BUILD.exports)
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
2008-02-26 11:45:24 +01:00
|
|
|
else # PORTNAME == cygwin || PORTNAME == win32
|
1999-07-17 00:56:01 +02:00
|
|
|
|
2014-02-01 22:08:33 +01:00
|
|
|
ifeq ($(PORTNAME), cygwin)
|
2014-02-11 18:56:20 +01:00
|
|
|
|
|
|
|
# Cygwin case
|
|
|
|
|
2014-02-01 22:08:33 +01:00
|
|
|
$(shlib): $(OBJS) | $(SHLIB_PREREQS)
|
2018-10-02 22:46:57 +02:00
|
|
|
$(CC) $(CFLAGS) -shared -o $@ -Wl,--out-implib=$(stlib) $(OBJS) $(LDFLAGS) $(LDFLAGS_SL) $(SHLIB_LINK) $(LIBS) $(LDAP_LIBS_BE)
|
2014-02-01 22:08:33 +01:00
|
|
|
|
2018-10-02 22:46:57 +02:00
|
|
|
# see notes in src/backend/parser/Makefile about use of this type of rule
|
|
|
|
$(stlib): $(shlib)
|
|
|
|
touch $@
|
2014-02-01 22:08:33 +01:00
|
|
|
|
|
|
|
else
|
2000-10-07 16:39:21 +02:00
|
|
|
|
2014-02-11 18:56:20 +01:00
|
|
|
# Win32 case
|
|
|
|
|
Fix make rules that generate multiple output files.
For years, our makefiles have correctly observed that "there is no correct
way to write a rule that generates two files". However, what we did is to
provide empty rules that "generate" the secondary output files from the
primary one, and that's not right either. Depending on the details of
the creating process, the primary file might end up timestamped later than
one or more secondary files, causing subsequent make runs to consider the
secondary file(s) out of date. That's harmless in a plain build, since
make will just re-execute the empty rule and nothing happens. But it's
fatal in a VPATH build, since make will expect the secondary file to be
rebuilt in the build directory. This would manifest as "file not found"
failures during VPATH builds from tarballs, if we were ever unlucky enough
to ship a tarball with apparently out-of-date secondary files. (It's not
clear whether that has ever actually happened, but it definitely could.)
To ensure that secondary output files have timestamps >= their primary's,
change our makefile convention to be that we provide a "touch $@" action
not an empty rule. Also, make sure that this rule actually gets invoked
during a distprep run, else the hazard remains.
It's been like this a long time, so back-patch to all supported branches.
In HEAD, I skipped the changes in src/backend/catalog/Makefile, because
those rules are due to get replaced soon in the bootstrap data format
patch, and there seems no need to create a merge issue for that patch.
If for some reason we fail to land that patch in v11, we'll need to
back-fill the changes in that one makefile from v10.
Discussion: https://postgr.es/m/18556.1521668179@sss.pgh.pa.us
2018-03-23 18:45:37 +01:00
|
|
|
# See notes in src/backend/parser/Makefile about the following two rules
|
|
|
|
$(stlib): $(shlib)
|
|
|
|
touch $@
|
2014-02-11 18:56:20 +01:00
|
|
|
|
2014-10-22 04:55:47 +02:00
|
|
|
# XXX A backend that loads a module linked with libgcc_s_dw2-1.dll will exit
|
|
|
|
# uncleanly, hence -static-libgcc. (Last verified with MinGW-w64 compilers
|
|
|
|
# from i686-4.9.1-release-win32-dwarf-rt_v3-rev1.) Shared libgcc has better
|
|
|
|
# support for C++/Java exceptions; while core PostgreSQL does not use them, it
|
|
|
|
# would be nice to support shared libgcc for the benefit of extensions.
|
|
|
|
#
|
2014-02-11 18:56:20 +01:00
|
|
|
# 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)
|
2014-10-22 04:55:47 +02:00
|
|
|
$(CC) $(CFLAGS) -shared -static-libgcc -o $@ $(OBJS) $(LDFLAGS) $(LDFLAGS_SL) $(SHLIB_LINK) $(LIBS) -Wl,--export-all-symbols -Wl,--out-implib=$(stlib)
|
2009-01-05 10:27:20 +01:00
|
|
|
else
|
2009-08-28 22:26:19 +02:00
|
|
|
DLL_DEFFILE = lib$(NAME)dll.def
|
2008-02-26 07:41:24 +01:00
|
|
|
|
2010-11-12 21:15:16 +01:00
|
|
|
$(shlib): $(OBJS) $(DLL_DEFFILE) | $(SHLIB_PREREQS)
|
2014-10-22 04:55:47 +02:00
|
|
|
$(CC) $(CFLAGS) -shared -static-libgcc -o $@ $(OBJS) $(DLL_DEFFILE) $(LDFLAGS) $(LDFLAGS_SL) $(SHLIB_LINK) $(LIBS) -Wl,--out-implib=$(stlib)
|
2019-10-20 10:19:13 +02:00
|
|
|
|
|
|
|
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/' $< >>$@
|
2014-02-11 18:56:20 +01:00
|
|
|
endif
|
2000-10-07 16:39:21 +02:00
|
|
|
|
2017-02-06 10:33:58 +01:00
|
|
|
endif # PORTNAME == cygwin
|
2008-02-26 11:45:24 +01:00
|
|
|
endif # PORTNAME == cygwin || PORTNAME == win32
|
2000-10-23 23:44:12 +02:00
|
|
|
|
1998-10-19 02:00:51 +02:00
|
|
|
|
2013-03-31 22:58:40 +02:00
|
|
|
%.pc: $(MAKEFILE_LIST)
|
2021-09-03 11:59:12 +02:00
|
|
|
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)' >>$@
|
2013-03-31 22:58:40 +02:00
|
|
|
echo 'Description: PostgreSQL lib$(NAME) library' >>$@
|
2022-07-06 10:32:40 +02:00
|
|
|
echo 'URL: $(PACKAGE_URL)' >>$@
|
2013-03-31 22:58:40 +02:00
|
|
|
echo 'Version: $(VERSION)' >>$@
|
|
|
|
echo 'Requires: ' >>$@
|
|
|
|
echo 'Requires.private: $(PKG_CONFIG_REQUIRES_PRIVATE)' >>$@
|
2021-09-03 11:59:12 +02:00
|
|
|
echo 'Cflags: -I$${includedir}' >>$@
|
|
|
|
echo 'Libs: -L$${libdir} -l$(NAME)' >>$@
|
2013-03-31 22:58:40 +02:00
|
|
|
# Record -L flags that the user might have passed in to the PostgreSQL
|
|
|
|
# build to locate third-party libraries (e.g., ldap, ssl). Filter out
|
|
|
|
# those that point inside the build or source tree. Use sort to
|
|
|
|
# remove duplicates. Also record the -l flags necessary for static
|
|
|
|
# linking, but not those already covered by Requires.private.
|
2021-09-06 09:12:34 +02:00
|
|
|
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)))' >>$@
|
2013-03-31 22:58:40 +02:00
|
|
|
|
|
|
|
|
2000-06-28 20:30:16 +02:00
|
|
|
##
|
|
|
|
## INSTALL
|
|
|
|
##
|
1998-10-19 02:00:51 +02:00
|
|
|
|
2008-04-07 16:15:58 +02:00
|
|
|
.PHONY: install-lib install-lib-static install-lib-shared installdirs-lib
|
|
|
|
install-lib: install-lib-shared
|
|
|
|
ifdef soname
|
|
|
|
install-lib: install-lib-static
|
2013-03-31 22:58:40 +02:00
|
|
|
install-lib: install-lib-pc
|
2008-04-07 16:15:58 +02:00
|
|
|
endif
|
1998-10-19 02:00:51 +02:00
|
|
|
|
2013-03-31 22:58:40 +02:00
|
|
|
install-lib-pc: lib$(NAME).pc installdirs-lib
|
|
|
|
$(INSTALL_DATA) $< '$(DESTDIR)$(pkgconfigdir)/lib$(NAME).pc'
|
|
|
|
|
2008-04-07 16:15:58 +02:00
|
|
|
install-lib-static: $(stlib) installdirs-lib
|
|
|
|
$(INSTALL_STLIB) $< '$(DESTDIR)$(libdir)/$(stlib)'
|
1998-10-19 02:00:51 +02:00
|
|
|
|
2008-04-07 16:15:58 +02:00
|
|
|
install-lib-shared: $(shlib) installdirs-lib
|
|
|
|
ifdef soname
|
2007-01-07 09:49:31 +01:00
|
|
|
# we don't install $(shlib) on AIX
|
2008-11-24 12:59:37 +01:00
|
|
|
# (see http://archives.postgresql.org/message-id/52EF20B2E3209443BC37736D00C3C1380A6E79FE@EXADV1.host.magwien.gv.at)
|
2007-01-07 09:49:31 +01:00
|
|
|
ifneq ($(PORTNAME), aix)
|
2005-12-09 22:19:36 +01:00
|
|
|
$(INSTALL_SHLIB) $< '$(DESTDIR)$(libdir)/$(shlib)'
|
2003-03-21 18:18:34 +01:00
|
|
|
ifneq ($(PORTNAME), cygwin)
|
2003-12-01 23:23:06 +01:00
|
|
|
ifneq ($(PORTNAME), win32)
|
2004-07-13 02:06:46 +02:00
|
|
|
ifneq ($(shlib), $(shlib_major))
|
2005-12-09 22:19:36 +01:00
|
|
|
cd '$(DESTDIR)$(libdir)' && \
|
2004-07-13 02:06:46 +02:00
|
|
|
rm -f $(shlib_major) && \
|
|
|
|
$(LN_S) $(shlib) $(shlib_major)
|
1999-01-17 07:20:06 +01:00
|
|
|
endif
|
2004-07-13 02:06:46 +02:00
|
|
|
ifneq ($(shlib), $(shlib_bare))
|
2005-12-09 22:19:36 +01:00
|
|
|
cd '$(DESTDIR)$(libdir)' && \
|
2004-07-13 02:06:46 +02:00
|
|
|
rm -f $(shlib_bare) && \
|
|
|
|
$(LN_S) $(shlib) $(shlib_bare)
|
2000-06-28 20:30:16 +02:00
|
|
|
endif
|
2003-12-01 23:23:06 +01:00
|
|
|
endif # not win32
|
2003-03-21 18:18:34 +01:00
|
|
|
endif # not cygwin
|
2006-09-19 17:36:08 +02:00
|
|
|
endif # not aix
|
2015-01-19 04:36:40 +01:00
|
|
|
ifneq (,$(findstring $(PORTNAME),win32 cygwin))
|
|
|
|
$(INSTALL_SHLIB) $< '$(DESTDIR)$(bindir)/$(shlib)'
|
|
|
|
endif
|
2008-04-07 16:15:58 +02:00
|
|
|
else # no soname
|
|
|
|
$(INSTALL_SHLIB) $< '$(DESTDIR)$(pkglibdir)/$(shlib)'
|
|
|
|
endif
|
2000-06-28 20:30:16 +02:00
|
|
|
|
|
|
|
|
2008-04-07 16:15:58 +02:00
|
|
|
installdirs-lib:
|
|
|
|
ifdef soname
|
2015-01-19 04:36:40 +01:00
|
|
|
$(MKDIR_P) '$(DESTDIR)$(libdir)' '$(DESTDIR)$(pkgconfigdir)' $(if $(findstring $(PORTNAME),win32 cygwin),'$(DESTDIR)$(bindir)')
|
2008-04-07 16:15:58 +02:00
|
|
|
else
|
2009-08-27 00:24:44 +02:00
|
|
|
$(MKDIR_P) '$(DESTDIR)$(pkglibdir)'
|
2008-04-07 16:15:58 +02:00
|
|
|
endif
|
|
|
|
|
|
|
|
|
2000-06-28 20:30:16 +02:00
|
|
|
##
|
|
|
|
## UNINSTALL
|
|
|
|
##
|
|
|
|
|
|
|
|
.PHONY: uninstall-lib
|
|
|
|
uninstall-lib:
|
2008-04-07 16:15:58 +02:00
|
|
|
ifdef soname
|
|
|
|
rm -f '$(DESTDIR)$(libdir)/$(stlib)'
|
2005-12-09 22:19:36 +01:00
|
|
|
rm -f '$(DESTDIR)$(libdir)/$(shlib_bare)' \
|
|
|
|
'$(DESTDIR)$(libdir)/$(shlib_major)' \
|
2015-01-19 04:36:40 +01:00
|
|
|
'$(DESTDIR)$(libdir)/$(shlib)' $(if $(findstring $(PORTNAME),win32 cygwin),'$(DESTDIR)$(bindir)/$(shlib)') \
|
2013-03-31 22:58:40 +02:00
|
|
|
'$(DESTDIR)$(pkgconfigdir)/lib$(NAME).pc'
|
2008-04-07 16:15:58 +02:00
|
|
|
else # no soname
|
|
|
|
rm -f '$(DESTDIR)$(pkglibdir)/$(shlib)'
|
|
|
|
endif # no soname
|
1999-07-01 01:54:18 +02:00
|
|
|
|
|
|
|
|
2000-06-28 20:30:16 +02:00
|
|
|
##
|
|
|
|
## CLEAN
|
|
|
|
##
|
1999-07-01 01:54:18 +02:00
|
|
|
|
2000-06-28 20:30:16 +02:00
|
|
|
.PHONY: clean-lib
|
|
|
|
clean-lib:
|
2013-03-31 22:58:40 +02:00
|
|
|
rm -f $(shlib) $(shlib_bare) $(shlib_major) $(stlib) $(exports_file) lib$(NAME).pc
|
2019-10-20 10:19:13 +02:00
|
|
|
ifneq (,$(DLL_DEFFILE))
|
|
|
|
rm -f $(DLL_DEFFILE)
|
2008-02-26 07:41:24 +01:00
|
|
|
endif
|