summaryrefslogtreecommitdiff
path: root/makefiles/Makefile.top
diff options
context:
space:
mode:
authorCaleb Xu <calebcenter@live.com>2023-06-30 23:50:54 -0400
committerJohn-Mark Bell <jmb@netsurf-browser.org>2023-09-16 22:33:46 +0100
commit4cd825b00bd8298d3616d3b1b08fd1fbeea8d8dc (patch)
tree47a55f9b8b1e621d4f9c07c9b6e70a59b116d06f /makefiles/Makefile.top
parentb4ba781fe22f356d7c53b1674dff91323af61458 (diff)
downloadbuildsystem-4cd825b00bd8298d3616d3b1b08fd1fbeea8d8dc.tar.gz
buildsystem-4cd825b00bd8298d3616d3b1b08fd1fbeea8d8dc.tar.bz2
makefiles: support building shared libs on Darwin
On Darwin (macOS), the flags needed to create a shared library are different. Moreover, the extension is .dylib and the version portion of the soname is inserted between the library name and the libext, e.g. lifoo.1.2.3.dylib. Signed-off-by: Caleb Xu <calebcenter@live.com>
Diffstat (limited to 'makefiles/Makefile.top')
-rw-r--r--makefiles/Makefile.top14
1 files changed, 11 insertions, 3 deletions
diff --git a/makefiles/Makefile.top b/makefiles/Makefile.top
index caac166..0b0fe22 100644
--- a/makefiles/Makefile.top
+++ b/makefiles/Makefile.top
@@ -189,9 +189,17 @@ endif
# Determine the output filename
ifeq ($(findstring lib,$(COMPONENT_TYPE)),lib)
ifeq ($(findstring lib-shared,$(COMPONENT_TYPE)),lib-shared)
- SHAREDLIBNAME := lib$(COMPONENT)$(LIBEXT)
- SONAME := $(SHAREDLIBNAME).$(major-version)
- OUTPUT := $(BUILDDIR)/$(SHAREDLIBNAME).$(COMPONENT_VERSION)
+ ifeq ($(findstring darwin,$(HOST)),darwin)
+ # In macOS, shared lib filenames are of the form libfoo.dylib,
+ # libfoo.1.dylib, or libfoo.1.2.3.dylib
+ SONAME := lib$(COMPONENT).$(major-version)$(LIBEXT)
+ SHAREDLIBNAME := lib$(COMPONENT)$(LIBEXT)
+ OUTPUT := $(BUILDDIR)/lib$(COMPONENT).$(COMPONENT_VERSION)$(LIBEXT)
+ else
+ SHAREDLIBNAME := lib$(COMPONENT)$(LIBEXT)
+ SONAME := $(SHAREDLIBNAME).$(major-version)
+ OUTPUT := $(BUILDDIR)/$(SHAREDLIBNAME).$(COMPONENT_VERSION)
+ endif
else
OUTPUT := $(BUILDDIR)/lib$(COMPONENT)$(LIBEXT)
endif