1# Build a shared libgcc library for PECOFF with a DEF file 2# with the GNU linker. 3# 4# mkmap-flat.awk is used with the pe_dll option to produce a DEF instead 5# of an ELF map file. 6# 7# Warning: If SHLIB_SOVERSION or SHLIB_SONAME are updated, LIBGCC_SONAME 8# in mingw32.h and SHLIB_MKMAP_OPTS below must be updated also. 9 10SHLIB_EXT = .dll 11SHLIB_IMPLIB = @shlib_base_name@.a 12SHLIB_SOVERSION = 1 13SHLIB_SONAME = @shlib_base_name@_$(EH_MODEL)-$(SHLIB_SOVERSION)$(SHLIB_EXT) 14SHLIB_MAP = @shlib_map_file@ 15SHLIB_OBJS = @shlib_objs@ 16SHLIB_DIR = @multilib_dir@/shlib 17SHLIB_SLIBDIR_QUAL = @shlib_slibdir_qual@ 18# SHLIB_DLLDIR is defined by including one of either t-dlldir or t-dlldir-x 19# (native/cross build respectively) in the tmake_file list in 20# libgcc/config.host. 21ifndef SHLIB_DLLDIR 22$(error SHLIB_DLLDIR must be defined) 23endif 24ifndef SHLIB_PTHREAD_CFLAG 25SHLIB_PTHREAD_CFLAG = 26endif 27ifndef SHLIB_PTHREAD_LDFLAG 28SHLIB_PTHREAD_LDFLAG = 29endif 30 31SHLIB_LINK = $(LN_S) -f $(SHLIB_MAP) $(SHLIB_MAP).def && \ 32 if [ ! -d $(SHLIB_DIR) ]; then \ 33 mkdir $(SHLIB_DIR); \ 34 else true; fi && \ 35 $(CC) $(LIBGCC2_CFLAGS) $(SHLIB_PTHREAD_CFLAG) \ 36 -shared -nodefaultlibs \ 37 $(SHLIB_MAP).def \ 38 -Wl,--out-implib,$(SHLIB_DIR)/$(SHLIB_IMPLIB).tmp \ 39 -o $(SHLIB_DIR)/$(SHLIB_SONAME).tmp @multilib_flags@ \ 40 $(SHLIB_OBJS) ${SHLIB_PTHREAD_LDFLAG} $(SHLIB_LC) && \ 41 if [ -f $(SHLIB_DIR)/$(SHLIB_SONAME) ]; then \ 42 mv -f $(SHLIB_DIR)/$(SHLIB_SONAME) \ 43 $(SHLIB_DIR)/$(SHLIB_SONAME).backup; \ 44 else true; fi && \ 45 mv $(SHLIB_DIR)/$(SHLIB_SONAME).tmp $(SHLIB_DIR)/$(SHLIB_SONAME) && \ 46 mv $(SHLIB_DIR)/$(SHLIB_IMPLIB).tmp $(SHLIB_DIR)/$(SHLIB_IMPLIB) 47SHLIB_INSTALL = \ 48 $(mkinstalldirs) $(DESTDIR)$(SHLIB_DLLDIR) \ 49 $(DESTDIR)$(slibdir)$(SHLIB_SLIBDIR_QUAL); \ 50 $(INSTALL) $(SHLIB_DIR)/$(SHLIB_SONAME) \ 51 $(DESTDIR)$(SHLIB_DLLDIR)/$(SHLIB_SONAME); \ 52 $(INSTALL_DATA) $(SHLIB_DIR)/$(SHLIB_IMPLIB) \ 53 $(DESTDIR)$(slibdir)$(SHLIB_SLIBDIR_QUAL)/$(SHLIB_IMPLIB) 54SHLIB_MKMAP = $(srcdir)/mkmap-flat.awk 55# We'd like to use SHLIB_SONAME here too, but shlib_base_name 56# does not get substituted before mkmap-flat.awk is run. 57SHLIB_MKMAP_OPTS = -v pe_dll=libgcc_s_$(EH_MODEL)-$(SHLIB_SOVERSION)$(SHLIB_EXT) 58SHLIB_MAPFILES = libgcc-std.ver $(srcdir)/config/i386/libgcc-cygming.ver 59