| 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 |
|
| 10 |
SHLIB_EXT = .dll |
| 11 |
SHLIB_IMPLIB = @[email protected] |
| 12 |
SHLIB_SOVERSION = 1 |
| 13 |
SHLIB_SONAME = @shlib_base_name@_$(EH_MODEL)-$(SHLIB_SOVERSION)$(SHLIB_EXT) |
| 14 |
SHLIB_MAP = @shlib_map_file@ |
| 15 |
SHLIB_OBJS = @shlib_objs@ |
| 16 |
SHLIB_DIR = @multilib_dir@/shlib |
| 17 |
SHLIB_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. |
| 21 |
ifndef SHLIB_DLLDIR |
| 22 |
$(error SHLIB_DLLDIR must be defined) |
| 23 |
endif |
| 24 |
ifndef SHLIB_PTHREAD_CFLAG |
| 25 |
SHLIB_PTHREAD_CFLAG = |
| 26 |
endif |
| 27 |
ifndef SHLIB_PTHREAD_LDFLAG |
| 28 |
SHLIB_PTHREAD_LDFLAG = |
| 29 |
endif |
| 30 |
ifndef SHLIB_MCFGTHREAD_LIBS |
| 31 |
SHLIB_MCFGTHREAD_LIBS = |
| 32 |
endif |
| 33 |
|
| 34 |
SHLIB_LINK = $(LN_S) -f $(SHLIB_MAP) $(SHLIB_MAP).def && \ |
| 35 |
if [ ! -d $(SHLIB_DIR) ]; then \ |
| 36 |
mkdir $(SHLIB_DIR); \ |
| 37 |
else true; fi && \ |
| 38 |
$(CC) $(LIBGCC2_CFLAGS) $(SHLIB_PTHREAD_CFLAG) \ |
| 39 |
-shared -nodefaultlibs \ |
| 40 |
$(SHLIB_MAP).def \ |
| 41 |
-Wl,--out-implib,$(SHLIB_DIR)/$(SHLIB_IMPLIB).tmp \ |
| 42 |
-o $(SHLIB_DIR)/$(SHLIB_SONAME).tmp @multilib_flags@ \ |
| 43 |
$(SHLIB_OBJS) ${SHLIB_PTHREAD_LDFLAG} $(SHLIB_LC) \ |
| 44 |
$(SHLIB_MCFGTHREAD_LIBS) && \ |
| 45 |
if [ -f $(SHLIB_DIR)/$(SHLIB_SONAME) ]; then \ |
| 46 |
mv -f $(SHLIB_DIR)/$(SHLIB_SONAME) \ |
| 47 |
$(SHLIB_DIR)/$(SHLIB_SONAME).backup; \ |
| 48 |
else true; fi && \ |
| 49 |
mv $(SHLIB_DIR)/$(SHLIB_SONAME).tmp $(SHLIB_DIR)/$(SHLIB_SONAME) && \ |
| 50 |
mv $(SHLIB_DIR)/$(SHLIB_IMPLIB).tmp $(SHLIB_DIR)/$(SHLIB_IMPLIB) |
| 51 |
SHLIB_INSTALL = \ |
| 52 |
$(mkinstalldirs) $(DESTDIR)$(SHLIB_DLLDIR) \ |
| 53 |
$(DESTDIR)$(slibdir)$(SHLIB_SLIBDIR_QUAL); \ |
| 54 |
$(INSTALL) $(SHLIB_DIR)/$(SHLIB_SONAME) \ |
| 55 |
$(DESTDIR)$(SHLIB_DLLDIR)/$(SHLIB_SONAME); \ |
| 56 |
$(INSTALL_DATA) $(SHLIB_DIR)/$(SHLIB_IMPLIB) \ |
| 57 |
$(DESTDIR)$(slibdir)$(SHLIB_SLIBDIR_QUAL)/$(SHLIB_IMPLIB) |
| 58 |
SHLIB_MKMAP = $(srcdir)/mkmap-flat.awk |
| 59 |
# We'd like to use SHLIB_SONAME here too, but shlib_base_name |
| 60 |
# does not get substituted before mkmap-flat.awk is run. |
| 61 |
SHLIB_MKMAP_OPTS = -v pe_dll=libgcc_s_$(EH_MODEL)-$(SHLIB_SOVERSION)$(SHLIB_EXT) |
| 62 |
SHLIB_MAPFILES = libgcc-std.ver $(srcdir)/config/i386/libgcc-cygming.ver |