| # Build a shared libgcc library with the darwin linker. |
| |
| SHLIB_SOVERSION = 1.1 |
| SHLIB_SO_MINVERSION = 1 |
| SHLIB_VERSTRING = -compatibility_version $(SHLIB_SO_MINVERSION) -current_version $(SHLIB_SOVERSION) |
| SHLIB_EXT = .dylib |
| SHLIB_LC = -lSystem |
| |
| # Shorthand expressions for the LINK below. |
| SHLIB_INSTALL_NAME = @shlib_base_name@.$(SHLIB_SOVERSION)$(SHLIB_EXT) |
| SHLIB_MAP = @shlib_map_file@ |
| SHLIB_DIR = @multilib_dir@ |
| SHLIB_SONAME = @shlib_base_name@$(SHLIB_EXT) |
| |
| # Darwin only searches in shlib_slibdir for shared libraries, not in |
| # subdirectories. The link builds one architecture slice in its designated |
| # subdir. The code under MULTIBUILDTOP combines these into a single FAT |
| # library, that is what we eventually install. |
| |
| SHLIB_LINK = $(CC) $(LIBGCC2_CFLAGS) $(LDFLAGS) -dynamiclib -nodefaultlibs \ |
| -install_name @shlib_slibdir@/$(SHLIB_INSTALL_NAME) \ |
| -single_module -o $(SHLIB_DIR)/$(SHLIB_SONAME) \ |
| -Wl,-exported_symbols_list,$(SHLIB_MAP) \ |
| $(SHLIB_VERSTRING) \ |
| @multilib_flags@ @shlib_objs@ $(SHLIB_LC) |
| |
| SHLIB_MKMAP = $(srcdir)/mkmap-flat.awk |
| SHLIB_MKMAP_OPTS = -v leading_underscore=1 |
| |
| LGCC_FILES = libgcc_s.$(SHLIB_SOVERSION)$(SHLIB_EXT) |
| |
| INSTALL_FILES=$(LGCC_FILES) |
| |
| # we do our own thing |
| SHLIB_INSTALL = |
| |
| # For the toplevel multilib, build a fat archive including all the multilibs. |
| ifeq ($(MULTIBUILDTOP),) |
| |
| ifeq ($(enable_shared),yes) |
| all: $(INSTALL_FILES) |
| install-leaf: install-darwin-libgcc-stubs |
| endif |
| |
| libgcc_s.$(SHLIB_SOVERSION)$(SHLIB_EXT): all-multi libgcc_s$(SHLIB_EXT) |
| MLIBS=`$(CC) --print-multi-lib | sed -e 's/;.*$$//'` ; \ |
| for mlib in $$MLIBS ; do \ |
| cp ../$${mlib}/libgcc/$${mlib}/libgcc_s$(SHLIB_EXT) \ |
| ./libgcc_s.$(SHLIB_SOVERSION)$(SHLIB_EXT)_T_$${mlib} || exit 1 ; \ |
| done |
| $(LIPO) -output libgcc_s.$(SHLIB_SOVERSION)$(SHLIB_EXT) \ |
| -create libgcc_s.$(SHLIB_SOVERSION)$(SHLIB_EXT)_T* |
| rm libgcc_s.$(SHLIB_SOVERSION)$(SHLIB_EXT)_T* |
| |
| # Install the shared library. |
| |
| install-darwin-libgcc-stubs : |
| $(mkinstalldirs) $(DESTDIR)$(slibdir) |
| for d in $(INSTALL_FILES) ; do \ |
| $(INSTALL_DATA) $$d $(DESTDIR)$(slibdir)/$$d || exit 1 ; \ |
| done |
| |
| else |
| |
| # Do not install shared libraries for any other multilibs. Unless we are |
| # putting them in the gcc directory during a build, for compatibility with |
| # the pre-top-level layout. In that case we provide symlinks to the FAT lib |
| # from the sub-directories. |
| |
| ifeq ($(enable_shared),yes) |
| all: install-darwin-libgcc-links |
| endif |
| |
| install-darwin-libgcc-links: |
| $(mkinstalldirs) $(gcc_objdir)$(MULTISUBDIR) |
| for file in $(INSTALL_FILES); do \ |
| rm -f $(gcc_objdir)$(MULTISUBDIR)/$$file; \ |
| $(LN_S) ../$$file $(gcc_objdir)$(MULTISUBDIR)/; \ |
| done |
| |
| endif |