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)
|
OFILES := $(OFILES:%=$(OBJDIR)/%.o)
|
||||||
|
|
||||||
OUT = $(OUTDIR)/$(NAME)$(SUFFIX)
|
OUT = $(OUTDIR)/$(NAME)$(SUFFIX)
|
||||||
|
OUTNOSONAME = $(OUTDIR)/$(NAME)$(LIBSUFFIX)
|
||||||
|
|
||||||
# TODO allow using LD
|
# TODO allow using LD
|
||||||
# LD is defined by default so we need a way to override the default define without blocking a user define
|
# 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)
|
$(OUT): $(OFILES) | $(OUTDIR)
|
||||||
@$(reallinker) -o $(OUT) $(OFILES) $(LDFLAGS)
|
@$(reallinker) -o $(OUT) $(OFILES) $(LDFLAGS)
|
||||||
|
ifeq ($(USESSONAME),1)
|
||||||
|
@ln -s $(NAME)$(SUFFIX) $(OUTNOSONAME)
|
||||||
|
endif
|
||||||
@echo ====== Linked $(OUT)
|
@echo ====== Linked $(OUT)
|
||||||
|
|
||||||
.SECONDEXPANSION:
|
.SECONDEXPANSION:
|
||||||
|
|
|
@ -37,4 +37,7 @@ else
|
||||||
LDFLAGS += $(OUTDIR)/libui.lib
|
LDFLAGS += $(OUTDIR)/libui.lib
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
# executables are not shared libraries
|
||||||
|
USESSONAME = 0
|
||||||
|
|
||||||
include build/GNUbase$(TOOLCHAIN).mk
|
include build/GNUbase$(TOOLCHAIN).mk
|
||||||
|
|
|
@ -5,7 +5,8 @@ $(error Do not run these makefiles directly.)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# for GCC
|
# for GCC
|
||||||
SOVERSION = 0
|
SOVERSION0 = 0
|
||||||
|
SOVERSIONA = A
|
||||||
|
|
||||||
include $(OS)/GNUosspecific.mk
|
include $(OS)/GNUosspecific.mk
|
||||||
include common/GNUfiles.mk
|
include common/GNUfiles.mk
|
||||||
|
@ -17,6 +18,9 @@ HFILES += \
|
||||||
|
|
||||||
NAME = libui
|
NAME = libui
|
||||||
SUFFIX = $(LIBSUFFIX)
|
SUFFIX = $(LIBSUFFIX)
|
||||||
|
ifeq ($(USESSONAME),1)
|
||||||
|
SUFFIX = $(SONAMEEXT)
|
||||||
|
endif
|
||||||
|
|
||||||
ifeq ($(TOOLCHAIN),gcc)
|
ifeq ($(TOOLCHAIN),gcc)
|
||||||
# make every symbol hidden by default except _UI_EXTERN ones
|
# make every symbol hidden by default except _UI_EXTERN ones
|
||||||
|
@ -38,6 +42,10 @@ else
|
||||||
/D "_UI_EXTERN=__declspec(dllexport) extern"
|
/D "_UI_EXTERN=__declspec(dllexport) extern"
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
ifeq ($(USESSONAME),1)
|
||||||
|
LDFLAGS += $(SONAMEFLAG)$(NAME)$(SUFFIX)
|
||||||
|
endif
|
||||||
|
|
||||||
include build/GNUbase$(TOOLCHAIN).mk
|
include build/GNUbase$(TOOLCHAIN).mk
|
||||||
|
|
||||||
# install rule is OS specific
|
# install rule is OS specific
|
||||||
|
|
|
@ -28,4 +28,7 @@ else
|
||||||
LDFLAGS += $(OUTDIR)/libui.lib
|
LDFLAGS += $(OUTDIR)/libui.lib
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
# executables are not shared libraries
|
||||||
|
USESSONAME = 0
|
||||||
|
|
||||||
include build/GNUbase$(TOOLCHAIN).mk
|
include build/GNUbase$(TOOLCHAIN).mk
|
||||||
|
|
|
@ -58,9 +58,3 @@ LDFLAGS += \
|
||||||
# on warning about undefined symbols:
|
# on warning about undefined symbols:
|
||||||
# the gcc flags don't work with Apple's linker
|
# 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!
|
# 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
|
LIBSUFFIX = .dylib
|
||||||
OSHSUFFIX = .h
|
OSHSUFFIX = .h
|
||||||
TOOLCHAIN = gcc
|
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
|
OSHSUFFIX = .hpp
|
||||||
TOOLCHAIN = gcc
|
TOOLCHAIN = gcc
|
||||||
|
|
||||||
|
# TODO
|
||||||
|
USESSONAME = 0
|
||||||
|
|
||||||
# Force GCC 4; GCC 2 is not supported.
|
# Force GCC 4; GCC 2 is not supported.
|
||||||
gccver = $(shell $(CC) --version | sed 's/-.*//g')
|
gccver = $(shell $(CC) --version | sed 's/-.*//g')
|
||||||
ifeq ($(gccver),2.95.3)
|
ifeq ($(gccver),2.95.3)
|
||||||
|
|
|
@ -50,8 +50,3 @@ LDFLAGS += \
|
||||||
# this is not gcc-global because OS X doesn't support these flags
|
# this is not gcc-global because OS X doesn't support these flags
|
||||||
LDFLAGS += \
|
LDFLAGS += \
|
||||||
-Wl,--no-undefined -Wl,--no-allow-shlib-undefined
|
-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
|
LIBSUFFIX = .so
|
||||||
OSHSUFFIX = .h
|
OSHSUFFIX = .h
|
||||||
TOOLCHAIN = gcc
|
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
|
LIBSUFFIX = .dll
|
||||||
OSHSUFFIX = .h
|
OSHSUFFIX = .h
|
||||||
TOOLCHAIN = msvc
|
TOOLCHAIN = msvc
|
||||||
|
|
||||||
|
USESSONAME = 0
|
||||||
|
|
Loading…
Reference in New Issue