Set up saner handling of sonames at build time.
This commit is contained in:
parent
a620e3921e
commit
6a15e23897
|
@ -40,6 +40,7 @@ OFILES = \
|
|||
OFILES := $(OFILES:%=$(OBJDIR)/%.o)
|
||||
|
||||
OUT = $(OUTDIR)/$(NAME)$(SUFFIX)
|
||||
OUTNOSONAME = $(OUTDIR)/$(NAME)$(LIBSUFFIX)
|
||||
|
||||
# TODO allow using LD
|
||||
# LD is defined by default so we need a way to override the default define without blocking a user define
|
||||
|
@ -51,6 +52,9 @@ endif
|
|||
|
||||
$(OUT): $(OFILES) | $(OUTDIR)
|
||||
@$(reallinker) -o $(OUT) $(OFILES) $(LDFLAGS)
|
||||
ifeq ($(USESSONAME),1)
|
||||
@ln -s $(NAME)$(SUFFIX) $(OUTNOSONAME)
|
||||
endif
|
||||
@echo ====== Linked $(OUT)
|
||||
|
||||
.SECONDEXPANSION:
|
||||
|
|
|
@ -37,4 +37,7 @@ else
|
|||
LDFLAGS += $(OUTDIR)/libui.lib
|
||||
endif
|
||||
|
||||
# executables are not shared libraries
|
||||
USESSONAME = 0
|
||||
|
||||
include build/GNUbase$(TOOLCHAIN).mk
|
||||
|
|
|
@ -5,7 +5,8 @@ $(error Do not run these makefiles directly.)
|
|||
endif
|
||||
|
||||
# for GCC
|
||||
SOVERSION = 0
|
||||
SOVERSION0 = 0
|
||||
SOVERSIONA = A
|
||||
|
||||
include $(OS)/GNUosspecific.mk
|
||||
include common/GNUfiles.mk
|
||||
|
@ -17,6 +18,9 @@ HFILES += \
|
|||
|
||||
NAME = libui
|
||||
SUFFIX = $(LIBSUFFIX)
|
||||
ifeq ($(USESSONAME),1)
|
||||
SUFFIX = $(SONAMEEXT)
|
||||
endif
|
||||
|
||||
ifeq ($(TOOLCHAIN),gcc)
|
||||
# make every symbol hidden by default except _UI_EXTERN ones
|
||||
|
@ -38,6 +42,10 @@ else
|
|||
/D "_UI_EXTERN=__declspec(dllexport) extern"
|
||||
endif
|
||||
|
||||
ifeq ($(USESSONAME),1)
|
||||
LDFLAGS += $(SONAMEFLAG)$(NAME)$(SUFFIX)
|
||||
endif
|
||||
|
||||
include build/GNUbase$(TOOLCHAIN).mk
|
||||
|
||||
# install rule is OS specific
|
||||
|
|
|
@ -28,4 +28,7 @@ else
|
|||
LDFLAGS += $(OUTDIR)/libui.lib
|
||||
endif
|
||||
|
||||
# executables are not shared libraries
|
||||
USESSONAME = 0
|
||||
|
||||
include build/GNUbase$(TOOLCHAIN).mk
|
||||
|
|
|
@ -58,9 +58,3 @@ LDFLAGS += \
|
|||
# on warning about undefined symbols:
|
||||
# the gcc flags don't work with Apple's linker
|
||||
# fortunately, we don't need any; Apple's linker warns about undefined symbols in -shared builds!
|
||||
|
||||
# flags for setting soname
|
||||
# note the explicit need for @rpath
|
||||
# TODO -current_version, -compatibility_version
|
||||
LDFLAGS += \
|
||||
-Wl,-install_name,@rpath/$(NAME).$(SOVERSION)$(SUFFIX)
|
||||
|
|
|
@ -4,3 +4,10 @@ EXESUFFIX =
|
|||
LIBSUFFIX = .dylib
|
||||
OSHSUFFIX = .h
|
||||
TOOLCHAIN = gcc
|
||||
|
||||
USESSONAME = 1
|
||||
SOVERSION = $(SOVERSIONA)
|
||||
SONAMEEXT = .$(SOVERSION)$(LIBSUFFIX)
|
||||
# note the explicit need for @rpath
|
||||
# TODO -current_version, -compatibility_version
|
||||
SONAMEFLAG = -Wl,-install_name,@rpath/
|
||||
|
|
|
@ -5,6 +5,9 @@ LIBSUFFIX = .so
|
|||
OSHSUFFIX = .hpp
|
||||
TOOLCHAIN = gcc
|
||||
|
||||
# TODO
|
||||
USESSONAME = 0
|
||||
|
||||
# Force GCC 4; GCC 2 is not supported.
|
||||
gccver = $(shell $(CC) --version | sed 's/-.*//g')
|
||||
ifeq ($(gccver),2.95.3)
|
||||
|
|
|
@ -50,8 +50,3 @@ LDFLAGS += \
|
|||
# this is not gcc-global because OS X doesn't support these flags
|
||||
LDFLAGS += \
|
||||
-Wl,--no-undefined -Wl,--no-allow-shlib-undefined
|
||||
|
||||
# flags for setting soname
|
||||
# this is not gcc-global because OS X uses a different filename format
|
||||
LDFLAGS += \
|
||||
-Wl,-soname,$(NAME)$(SUFFIX).$(SOVERSION)
|
||||
|
|
|
@ -4,3 +4,10 @@ EXESUFFIX =
|
|||
LIBSUFFIX = .so
|
||||
OSHSUFFIX = .h
|
||||
TOOLCHAIN = gcc
|
||||
|
||||
# TODO clean up all the NAMEs and SUFFIXs and NOSOSUFFIXs or whatever it was
|
||||
USESSONAME = 1
|
||||
SOVERSION = $(SOVERSION0)
|
||||
SONAMEEXT = $(LIBSUFFIX).$(SOVERSION)
|
||||
# this is not gcc-global because OS X uses a different filename format
|
||||
SONAMEFLAG = -Wl,-soname,
|
|
@ -4,3 +4,5 @@ EXESUFFIX = .exe
|
|||
LIBSUFFIX = .dll
|
||||
OSHSUFFIX = .h
|
||||
TOOLCHAIN = msvc
|
||||
|
||||
USESSONAME = 0
|
||||
|
|
Loading…
Reference in New Issue