1e4b17023SJohn Marino# Makefile.in 2e4b17023SJohn Marino 3e4b17023SJohn Marino# Copyright (C) 2005, 2006, 2009, 2010, 2011 Free Software Foundation 4e4b17023SJohn Marino# 5e4b17023SJohn Marino# This file is part of GCC. 6e4b17023SJohn Marino# 7e4b17023SJohn Marino# GCC is free software; you can redistribute it and/or modify it under the 8e4b17023SJohn Marino# terms of the GNU Library General Public License as published by the Free 9e4b17023SJohn Marino# Software Foundation; either version 3 of the License, or (at your option) 10e4b17023SJohn Marino# any later version. 11e4b17023SJohn Marino# 12e4b17023SJohn Marino# GCC is distributed in the hope that it will be useful, but WITHOUT ANY 13e4b17023SJohn Marino# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 14e4b17023SJohn Marino# FOR A PARTICULAR PURPOSE. See the GNU General Public License for 15e4b17023SJohn Marino# more details. 16e4b17023SJohn Marino# 17e4b17023SJohn Marino# You should have received a copy of the GNU General Public License along 18e4b17023SJohn Marino# with GCC; see the file COPYING3. If not see 19e4b17023SJohn Marino# <http://www.gnu.org/licenses/>. 20e4b17023SJohn Marino# 21e4b17023SJohn Marino 22e4b17023SJohn Marinolibgcc_topdir = @libgcc_topdir@ 23e4b17023SJohn Marinohost_subdir = @host_subdir@ 24e4b17023SJohn Marino 25e4b17023SJohn Marinogcc_objdir = $(MULTIBUILDTOP)../../$(host_subdir)/gcc 26e4b17023SJohn Marino 27e4b17023SJohn Marinosrcdir = @srcdir@ 28e4b17023SJohn Marino 29e4b17023SJohn Marinoprefix = @prefix@ 30e4b17023SJohn Marino 31e4b17023SJohn Marinoexec_prefix = @exec_prefix@ 32e4b17023SJohn Marinolibdir = @libdir@ 33e4b17023SJohn Marinoshlib_slibdir = @slibdir@ 34e4b17023SJohn Marino 35e4b17023SJohn MarinoSHELL = @SHELL@ 36e4b17023SJohn Marino 37e4b17023SJohn Marinocpu_type = @cpu_type@ 38e4b17023SJohn Marinoenable_shared = @enable_shared@ 39e4b17023SJohn Marinodouble_type_size = @double_type_size@ 40e4b17023SJohn Marinolong_double_type_size = @long_double_type_size@ 41e4b17023SJohn Marinodecimal_float = @decimal_float@ 42e4b17023SJohn Marinoenable_decimal_float = @enable_decimal_float@ 43e4b17023SJohn Marinofixed_point = @fixed_point@ 44e4b17023SJohn Marino 45e4b17023SJohn Marinohost_noncanonical = @host_noncanonical@ 46e4b17023SJohn Marinotarget_noncanonical = @target_noncanonical@ 47e4b17023SJohn Marino 48e4b17023SJohn Marino# List of extra object files that should be compiled for this target machine. 49e4b17023SJohn Marino# The rules for compiling them should be in the t-* file for the machine. 50e4b17023SJohn MarinoEXTRA_PARTS = @extra_parts@ 51e4b17023SJohn Marino 52e4b17023SJohn Marinoextra-parts = libgcc-extra-parts 53e4b17023SJohn Marino 54e4b17023SJohn Marino# Multilib support variables. 55e4b17023SJohn MarinoMULTISRCTOP = 56e4b17023SJohn MarinoMULTIBUILDTOP = 57e4b17023SJohn MarinoMULTIDIRS = 58e4b17023SJohn MarinoMULTISUBDIR = 59e4b17023SJohn MarinoMULTIDO = true 60e4b17023SJohn MarinoMULTICLEAN = true 61e4b17023SJohn Marino 62e4b17023SJohn MarinoINSTALL = @INSTALL@ 63e4b17023SJohn MarinoINSTALL_PROGRAM = @INSTALL_PROGRAM@ 64e4b17023SJohn MarinoINSTALL_DATA = @INSTALL_DATA@ 65e4b17023SJohn Marinomkinstalldirs = $(SHELL) $(libgcc_topdir)/mkinstalldirs 66e4b17023SJohn MarinoINSTALL_PARTS = $(EXTRA_PARTS) 67e4b17023SJohn Marino 68e4b17023SJohn Marinoobjext = .o 69e4b17023SJohn Marino 70e4b17023SJohn MarinoAR = @AR@ 71e4b17023SJohn MarinoAR_FLAGS = rc 72e4b17023SJohn Marino 73e4b17023SJohn MarinoCC = @CC@ 74e4b17023SJohn MarinoCFLAGS = @CFLAGS@ 75e4b17023SJohn MarinoRANLIB = @RANLIB@ 76e4b17023SJohn MarinoLN_S = @LN_S@ 77e4b17023SJohn Marino 78e4b17023SJohn MarinoPWD_COMMAND = $${PWDCMD-pwd} 79e4b17023SJohn Marino 80e4b17023SJohn Marino# Flags to pass to a recursive make. 81e4b17023SJohn MarinoFLAGS_TO_PASS = \ 82e4b17023SJohn Marino "AR=$(AR)" \ 83e4b17023SJohn Marino "AR_FLAGS=$(AR_FLAGS)" \ 84e4b17023SJohn Marino "CC=$(CC)" \ 85e4b17023SJohn Marino "CFLAGS=$(CFLAGS)" \ 86e4b17023SJohn Marino "DESTDIR=$(DESTDIR)" \ 87e4b17023SJohn Marino "EXTRA_OFILES=$(EXTRA_OFILES)" \ 88e4b17023SJohn Marino "HDEFINES=$(HDEFINES)" \ 89e4b17023SJohn Marino "INSTALL=$(INSTALL)" \ 90e4b17023SJohn Marino "INSTALL_DATA=$(INSTALL_DATA)" \ 91e4b17023SJohn Marino "INSTALL_PROGRAM=$(INSTALL_PROGRAM)" \ 92e4b17023SJohn Marino "LDFLAGS=$(LDFLAGS)" \ 93e4b17023SJohn Marino "LOADLIBES=$(LOADLIBES)" \ 94e4b17023SJohn Marino "RANLIB=$(RANLIB)" \ 95e4b17023SJohn Marino "SHELL=$(SHELL)" \ 96e4b17023SJohn Marino "prefix=$(prefix)" \ 97e4b17023SJohn Marino "exec_prefix=$(exec_prefix)" \ 98e4b17023SJohn Marino "libdir=$(libdir)" \ 99e4b17023SJohn Marino "libsubdir=$(libsubdir)" \ 100e4b17023SJohn Marino "tooldir=$(tooldir)" 101e4b17023SJohn Marino 102e4b17023SJohn Marino# Dependencies for "all" are set later in the file. 103e4b17023SJohn Marinoall: all-multi 104e4b17023SJohn Marino # Now that we have built all the objects, we need to copy 105e4b17023SJohn Marino # them back to the GCC directory. Too many things (other 106e4b17023SJohn Marino # in-tree libraries, and DejaGNU) know about the layout 107e4b17023SJohn Marino # of the build tree, for now. 108e4b17023SJohn Marino $(MAKE) install-leaf DESTDIR=$(gcc_objdir) \ 109e4b17023SJohn Marino slibdir= libsubdir= MULTIOSDIR=$(MULTIDIR) 110e4b17023SJohn Marino 111e4b17023SJohn Marino.PHONY: all-multi 112e4b17023SJohn Marinoall-multi: 113e4b17023SJohn Marino # If this is the top-level multilib, build all the other 114e4b17023SJohn Marino # multilibs. 115e4b17023SJohn Marino @: $(MAKE) ; exec $(MULTIDO) $(FLAGS_TO_PASS) multi-do DO=all 116e4b17023SJohn Marino 117e4b17023SJohn Marino.PHONY: check installcheck 118e4b17023SJohn Marinocheck: 119e4b17023SJohn Marinoinstallcheck: 120e4b17023SJohn Marino 121e4b17023SJohn Marino.PHONY: all clean 122e4b17023SJohn Marino 123e4b17023SJohn Marinoclean: 124*95d28233SJohn Marino -rm -f config.h libgcc_tm.h libgcc.map 125*95d28233SJohn Marino -rm -f libgcc_tm.stamp stamp-h stmp-ldirs 126e4b17023SJohn Marino -rm -f *$(objext) 127e4b17023SJohn Marino -rm -f *.dep 128e4b17023SJohn Marino -rm -f *.a 129e4b17023SJohn Marino -rm -f libunwind$(SHLIB_EXT) 130e4b17023SJohn Marino -rm -f libgcc_s* 131e4b17023SJohn Marino @$(MULTICLEAN) multi-clean DO=clean 132e4b17023SJohn Marinodistclean: clean 133e4b17023SJohn Marino @$(MULTICLEAN) multi-clean DO=distclean 134e4b17023SJohn Marino -rm -f *~ Makefile config.cache config.status multilib.out 135e4b17023SJohn Marino -rm -f config.log 136e4b17023SJohn Marinomaintainer-clean realclean: distclean 137e4b17023SJohn Marino 138e4b17023SJohn MarinoMakefile: $(srcdir)/Makefile.in config.status 139e4b17023SJohn Marino CONFIG_FILES=Makefile CONFIG_HEADERS= $(SHELL) ./config.status 140e4b17023SJohn Marino 141e4b17023SJohn Marino# Depending on Makefile makes sure that config.status has been re-run 142e4b17023SJohn Marino# if needed. This prevents problems with parallel builds. 143e4b17023SJohn Marinoconfig.h: stamp-h ; @true 144e4b17023SJohn Marinostamp-h: $(srcdir)/config.in config.status Makefile 145e4b17023SJohn Marino CONFIG_FILES= CONFIG_HEADERS=config.h:$(srcdir)/config.in $(SHELL) ./config.status 146e4b17023SJohn Marino 147e4b17023SJohn Marinoconfig.status: $(srcdir)/configure $(srcdir)/config.host 148e4b17023SJohn Marino $(SHELL) ./config.status --recheck 149e4b17023SJohn Marino 150e4b17023SJohn MarinoAUTOCONF = autoconf 151e4b17023SJohn Marinoconfigure_deps = \ 152e4b17023SJohn Marino $(srcdir)/../config/enable.m4 \ 153e4b17023SJohn Marino $(srcdir)/../config/tls.m4 \ 154e4b17023SJohn Marino $(srcdir)/../config/acx.m4 \ 155e4b17023SJohn Marino $(srcdir)/../config/no-executables.m4 \ 156e4b17023SJohn Marino $(srcdir)/../config/override.m4 \ 157e4b17023SJohn Marino $(srcdir)/../config/dfp.m4 \ 158e4b17023SJohn Marino 159e4b17023SJohn Marino$(srcdir)/configure: @MAINT@ $(srcdir)/configure.ac $(configure_deps) 160e4b17023SJohn Marino cd $(srcdir) && $(AUTOCONF) 161e4b17023SJohn Marino 162e4b17023SJohn Marinoinclude $(gcc_objdir)/libgcc.mvars 163e4b17023SJohn Marino 164e4b17023SJohn Marino# Flags to pass to recursive makes. 165e4b17023SJohn Marino 166e4b17023SJohn MarinoAR_FOR_TARGET = $(AR) 167e4b17023SJohn MarinoAR_FLAGS_FOR_TARGET = 168e4b17023SJohn MarinoAR_CREATE_FOR_TARGET = $(AR_FOR_TARGET) $(AR_FLAGS_FOR_TARGET) rc 169e4b17023SJohn MarinoAR_EXTRACT_FOR_TARGET = $(AR_FOR_TARGET) $(AR_FLAGS_FOR_TARGET) x 170e4b17023SJohn MarinoAWK = @AWK@ 171e4b17023SJohn MarinoGCC_FOR_TARGET = $(CC) 172e4b17023SJohn MarinoLIPO = @LIPO@ 173e4b17023SJohn MarinoLIPO_FOR_TARGET = $(LIPO) 174e4b17023SJohn MarinoMACHMODE_H = machmode.h mode-classes.def insn-modes.h 175e4b17023SJohn MarinoNM = @NM@ 176e4b17023SJohn MarinoNM_FOR_TARGET = $(NM) 177e4b17023SJohn MarinoRANLIB_FOR_TARGET = $(RANLIB) 178e4b17023SJohn MarinoSTRIP = @STRIP@ 179e4b17023SJohn MarinoSTRIP_FOR_TARGET = $(STRIP) 180e4b17023SJohn Marino 181e4b17023SJohn Marino# Directory in which the compiler finds libraries etc. 182e4b17023SJohn Marinolibsubdir = $(libdir)/gcc/$(host_noncanonical)/$(version) 183e4b17023SJohn Marino# Used to install the shared libgcc. 184e4b17023SJohn Marinoslibdir = @slibdir@ 185e4b17023SJohn Marino# Maybe used for DLLs on Windows targets. 186e4b17023SJohn Marinotoolexecdir = @toolexecdir@ 187e4b17023SJohn Marinotoolexeclibdir = @toolexeclibdir@ 188e4b17023SJohn Marino 189e4b17023SJohn Marinoexport AR_FOR_TARGET 190e4b17023SJohn Marinoexport AR_CREATE_FOR_TARGET 191e4b17023SJohn Marinoexport AR_FLAGS_FOR_TARGET 192e4b17023SJohn Marinoexport AR_EXTRACT_FOR_TARGET 193e4b17023SJohn Marinoexport AWK 194e4b17023SJohn Marinoexport DESTDIR 195e4b17023SJohn Marinoexport GCC_FOR_TARGET 196e4b17023SJohn Marinoexport INCLUDES 197e4b17023SJohn Marinoexport INSTALL_DATA 198e4b17023SJohn Marinoexport LIB1ASMSRC 199e4b17023SJohn Marinoexport LIBGCC2_CFLAGS 200e4b17023SJohn Marinoexport LIPO_FOR_TARGET 201e4b17023SJohn Marinoexport MACHMODE_H 202e4b17023SJohn Marinoexport NM_FOR_TARGET 203e4b17023SJohn Marinoexport STRIP_FOR_TARGET 204e4b17023SJohn Marinoexport RANLIB_FOR_TARGET 205e4b17023SJohn Marinoexport libsubdir 206e4b17023SJohn Marinoexport slibdir 207e4b17023SJohn Marinoexport toolexecdir 208e4b17023SJohn Marinoexport toolexeclibdir 209e4b17023SJohn Marino 210e4b17023SJohn Marinoversion := $(shell $(CC) -dumpversion) 211e4b17023SJohn Marino 212e4b17023SJohn Marinoifeq ($(decimal_float),yes) 213e4b17023SJohn Marinoifeq ($(enable_decimal_float),bid) 214e4b17023SJohn MarinoDECNUMINC = -I$(srcdir)/config/libbid -DENABLE_DECIMAL_BID_FORMAT 215e4b17023SJohn Marinoelse 216e4b17023SJohn MarinoDECNUMINC = -I$(srcdir)/../libdecnumber/$(enable_decimal_float) \ 217e4b17023SJohn Marino -I$(srcdir)/../libdecnumber 218e4b17023SJohn Marinoendif 219e4b17023SJohn Marinoelse 220e4b17023SJohn MarinoDECNUMINC = 221e4b17023SJohn Marinoendif 222e4b17023SJohn Marino 223e4b17023SJohn Marino# Options to use when compiling libgcc2.a. 224e4b17023SJohn Marino# 225e4b17023SJohn MarinoLIBGCC2_DEBUG_CFLAGS = -g 226e4b17023SJohn MarinoLIBGCC2_CFLAGS = -O2 $(LIBGCC2_INCLUDES) $(GCC_CFLAGS) $(HOST_LIBGCC2_CFLAGS) \ 227e4b17023SJohn Marino $(LIBGCC2_DEBUG_CFLAGS) -DIN_LIBGCC2 \ 228e4b17023SJohn Marino -fbuilding-libgcc -fno-stack-protector \ 229e4b17023SJohn Marino $(INHIBIT_LIBC_CFLAGS) 230e4b17023SJohn Marino 231e4b17023SJohn Marino# Additional options to use when compiling libgcc2.a. 232e4b17023SJohn Marino# Some targets override this to -isystem include 233e4b17023SJohn MarinoLIBGCC2_INCLUDES = 234e4b17023SJohn Marino 235e4b17023SJohn Marino# Additional target-dependent options for compiling libgcc2.a. 236e4b17023SJohn MarinoHOST_LIBGCC2_CFLAGS = 237e4b17023SJohn Marino 238e4b17023SJohn MarinoPICFLAG = @PICFLAG@ 239e4b17023SJohn Marino 240e4b17023SJohn Marino# Defined in libgcc2.c, included only in the static library. 241e4b17023SJohn MarinoLIB2FUNCS_ST = _eprintf __gcc_bcmp 242e4b17023SJohn Marino 243e4b17023SJohn Marino# List of functions not to build from libgcc2.c. 244e4b17023SJohn MarinoLIB2FUNCS_EXCLUDE = 245e4b17023SJohn Marino 246e4b17023SJohn Marino# These might cause a divide overflow trap and so are compiled with 247e4b17023SJohn Marino# unwinder info. 248e4b17023SJohn MarinoLIB2_DIVMOD_FUNCS = _divdi3 _moddi3 _udivdi3 _umoddi3 _udiv_w_sdiv _udivmoddi4 249e4b17023SJohn Marino 250e4b17023SJohn Marino# List of extra C and assembler files to add to static and shared libgcc2. 251e4b17023SJohn Marino# Assembler files should have names ending in `.S'. 252e4b17023SJohn MarinoLIB2ADD = 253e4b17023SJohn Marino 254e4b17023SJohn Marino# List of extra C and assembler files to add to static libgcc2. 255e4b17023SJohn Marino# Assembler files should have names ending in `.S'. 256e4b17023SJohn MarinoLIB2ADD_ST = 257e4b17023SJohn Marino 258e4b17023SJohn Marino# Specify the directories to be searched for header files. 259e4b17023SJohn Marino# Both . and srcdir are used, in that order, 260e4b17023SJohn Marino# so that *config.h will be found in the compilation 261e4b17023SJohn Marino# subdirectory rather than in the source directory. 262e4b17023SJohn Marino# -I$(@D) and -I$(srcdir)/$(@D) cause the subdirectory of the file 263e4b17023SJohn Marino# currently being compiled, in both source trees, to be examined as well. 264e4b17023SJohn MarinoINCLUDES = -I. -I$(@D) -I$(gcc_objdir) \ 265e4b17023SJohn Marino -I$(srcdir) -I$(srcdir)/$(@D) -I$(srcdir)/../gcc \ 266e4b17023SJohn Marino -I$(srcdir)/../include $(DECNUMINC) 267e4b17023SJohn Marino 268e4b17023SJohn Marino# Forcibly remove any profiling-related flags. There is no point 269e4b17023SJohn Marino# in supporting profiled bootstrap in this library. 270e4b17023SJohn Marinooverride CFLAGS := $(filter-out -fprofile-generate -fprofile-use,$(CFLAGS)) 271e4b17023SJohn Marino 272e4b17023SJohn Marino# CFLAGS first is not perfect; normally setting CFLAGS should override any 273e4b17023SJohn Marino# options in LIBGCC2_CFLAGS. But LIBGCC2_CFLAGS may contain -g0, and CFLAGS 274e4b17023SJohn Marino# will usually contain -g, so for the moment CFLAGS goes first. We must 275e4b17023SJohn Marino# include CFLAGS - that's where multilib options live. 276e4b17023SJohn MarinoINTERNAL_CFLAGS = $(CFLAGS) $(LIBGCC2_CFLAGS) $(HOST_LIBGCC2_CFLAGS) \ 277e4b17023SJohn Marino $(INCLUDES) @set_have_cc_tls@ @set_use_emutls@ 278e4b17023SJohn Marino 279e4b17023SJohn Marino# Options to use when compiling crtbegin/end. 280e4b17023SJohn MarinoCRTSTUFF_CFLAGS = -O2 $(GCC_CFLAGS) $(INCLUDES) $(MULTILIB_CFLAGS) -g0 \ 281e4b17023SJohn Marino -finhibit-size-directive -fno-inline -fno-exceptions \ 282e4b17023SJohn Marino -fno-zero-initialized-in-bss -fno-toplevel-reorder -fno-tree-vectorize \ 283e4b17023SJohn Marino -fno-stack-protector \ 284e4b17023SJohn Marino $(INHIBIT_LIBC_CFLAGS) 285e4b17023SJohn Marino 286e4b17023SJohn Marino# Extra flags to use when compiling crt{begin,end}.o. 287e4b17023SJohn MarinoCRTSTUFF_T_CFLAGS = 288e4b17023SJohn Marino 289e4b17023SJohn MarinoMULTIDIR := $(shell $(CC) $(CFLAGS) -print-multi-directory) 290e4b17023SJohn MarinoMULTIOSDIR := $(shell $(CC) $(CFLAGS) -print-multi-os-directory) 291e4b17023SJohn Marino 292e4b17023SJohn MarinoMULTIOSSUBDIR := $(shell if test $(MULTIOSDIR) != .; then echo /$(MULTIOSDIR); fi) 293e4b17023SJohn Marinoinst_libdir = $(libsubdir)$(MULTISUBDIR) 294e4b17023SJohn Marinoinst_slibdir = $(slibdir)$(MULTIOSSUBDIR) 295e4b17023SJohn Marino 296e4b17023SJohn Marinogcc_compile_bare = $(CC) $(INTERNAL_CFLAGS) 297e4b17023SJohn Marinocompile_deps = -MT $@ -MD -MP -MF $(basename $@).dep 298e4b17023SJohn Marinogcc_compile = $(gcc_compile_bare) -o $@ $(compile_deps) 299e4b17023SJohn Marinogcc_s_compile = $(gcc_compile) -DSHARED 300e4b17023SJohn Marino 301e4b17023SJohn Marinoobjects = $(filter %$(objext),$^) 302e4b17023SJohn Marino 303e4b17023SJohn Marino# Collect any host-specific information from Makefile fragments. 304e4b17023SJohn Marino 305e4b17023SJohn MarinoLIBGCC_VER_GNU_PREFIX = __ 306e4b17023SJohn MarinoLIBGCC_VER_FIXEDPOINT_GNU_PREFIX = __ 307e4b17023SJohn MarinoLIBGCC_VER_SYMBOLS_PREFIX = 308e4b17023SJohn Marino 309e4b17023SJohn MarinoFPBIT_FUNCS = _pack_sf _unpack_sf _addsub_sf _mul_sf _div_sf \ 310e4b17023SJohn Marino _fpcmp_parts_sf _compare_sf _eq_sf _ne_sf _gt_sf _ge_sf \ 311e4b17023SJohn Marino _lt_sf _le_sf _unord_sf _si_to_sf _sf_to_si _negate_sf _make_sf \ 312e4b17023SJohn Marino _sf_to_df _sf_to_tf _thenan_sf _sf_to_usi _usi_to_sf 313e4b17023SJohn Marino 314e4b17023SJohn MarinoDPBIT_FUNCS = _pack_df _unpack_df _addsub_df _mul_df _div_df \ 315e4b17023SJohn Marino _fpcmp_parts_df _compare_df _eq_df _ne_df _gt_df _ge_df \ 316e4b17023SJohn Marino _lt_df _le_df _unord_df _si_to_df _df_to_si _negate_df _make_df \ 317e4b17023SJohn Marino _df_to_sf _df_to_tf _thenan_df _df_to_usi _usi_to_df 318e4b17023SJohn Marino 319e4b17023SJohn MarinoTPBIT_FUNCS = _pack_tf _unpack_tf _addsub_tf _mul_tf _div_tf \ 320e4b17023SJohn Marino _fpcmp_parts_tf _compare_tf _eq_tf _ne_tf _gt_tf _ge_tf \ 321e4b17023SJohn Marino _lt_tf _le_tf _unord_tf _si_to_tf _tf_to_si _negate_tf _make_tf \ 322e4b17023SJohn Marino _tf_to_df _tf_to_sf _thenan_tf _tf_to_usi _usi_to_tf 323e4b17023SJohn Marino 324e4b17023SJohn Marino# Additional sources to handle exceptions; overridden by targets as needed. 325e4b17023SJohn MarinoLIB2ADDEH = $(srcdir)/unwind-dw2.c $(srcdir)/unwind-dw2-fde.c \ 326e4b17023SJohn Marino $(srcdir)/unwind-sjlj.c $(srcdir)/unwind-c.c 327e4b17023SJohn MarinoLIB2ADDEHSTATIC = $(LIB2ADDEH) 328e4b17023SJohn MarinoLIB2ADDEHSHARED = $(LIB2ADDEH) 329e4b17023SJohn Marino 330e4b17023SJohn Marino# nm flags to list global symbols in libgcc object files. 331e4b17023SJohn MarinoSHLIB_NM_FLAGS = -pg 332e4b17023SJohn Marino 333e4b17023SJohn Marino# Don't build libunwind by default. 334e4b17023SJohn MarinoLIBUNWIND = 335e4b17023SJohn MarinoSHLIBUNWIND_LINK = 336e4b17023SJohn MarinoSHLIBUNWIND_INSTALL = 337e4b17023SJohn Marino 338e4b17023SJohn Marinotmake_file = @tmake_file@ 339e4b17023SJohn Marinoinclude $(srcdir)/empty.mk $(tmake_file) 340e4b17023SJohn Marino 341e4b17023SJohn Marino# Collect target defines and headers from config.host. 342e4b17023SJohn Marinolibgcc_tm_defines = @tm_defines@ 343e4b17023SJohn Marinolibgcc_tm_file = @tm_file@ 344e4b17023SJohn Marinolibgcc_tm.h: libgcc_tm.stamp; @true 345e4b17023SJohn Marinolibgcc_tm.stamp: 346e4b17023SJohn Marino DEFINES='$(libgcc_tm_defines)' HEADERS='$(libgcc_tm_file)' \ 347e4b17023SJohn Marino $(srcdir)/mkheader.sh > tmp-libgcc_tm.h 348e4b17023SJohn Marino $(SHELL) $(srcdir)/../move-if-change tmp-libgcc_tm.h libgcc_tm.h 349e4b17023SJohn Marino echo timestamp > $@ 350e4b17023SJohn Marino 351e4b17023SJohn Marino# Only handle shared libraries if both: 352e4b17023SJohn Marino# - the user requested them 353e4b17023SJohn Marino# - we know how to build them 354e4b17023SJohn Marinoifeq ($(SHLIB_LINK),) 355e4b17023SJohn Marino enable_shared := no 356e4b17023SJohn Marinoendif 357e4b17023SJohn Marino 358e4b17023SJohn Marinoifeq ($(enable_shared),yes) 359e4b17023SJohn Marino iterator = $(srcdir)/empty.mk $(patsubst %,$(srcdir)/shared-object.mk,$(iter-items)) 360e4b17023SJohn Marino 361e4b17023SJohn Marino install-shared = install-shared 362e4b17023SJohn Marino 363e4b17023SJohn Marino ifneq ($(LIBUNWIND),) 364e4b17023SJohn Marino install-libunwind = install-libunwind 365e4b17023SJohn Marino endif 366e4b17023SJohn Marino 367e4b17023SJohn Marino# For -fvisibility=hidden. We need both a -fvisibility=hidden on 368e4b17023SJohn Marino# the command line, and a #define to prevent libgcc2.h etc from 369e4b17023SJohn Marino# overriding that with #pragmas. 370e4b17023SJohn Marinovis_hide = @vis_hide@ 371e4b17023SJohn Marino 372e4b17023SJohn Marinoifneq (,$(vis_hide)) 373e4b17023SJohn Marino 374e4b17023SJohn Marino# If we have -fvisibility=hidden, then we need to generate hide 375e4b17023SJohn Marino# lists for object files implemented in assembly. 376e4b17023SJohn MarinoASM_HIDDEN_OP = @asm_hidden_op@ 377e4b17023SJohn Marino 378e4b17023SJohn Marinodefine gen-hide-list 379e4b17023SJohn Marino$(NM) -pg $< | \ 380e4b17023SJohn Marino $(AWK) 'NF == 3 && $$2 !~ /^[UN]$$/ && $$3 !~ /.*_compat/ \ 381e4b17023SJohn Marino && $$3 !~ /.*@.*/ \ 382e4b17023SJohn Marino { print "\t$(ASM_HIDDEN_OP)", $$3 }' > $@T 383e4b17023SJohn Marinomv -f $@T $@ 384e4b17023SJohn Marinoendef 385e4b17023SJohn Marinoelse 386e4b17023SJohn Marinogen-hide-list = echo > $@ 387e4b17023SJohn Marinoendif 388e4b17023SJohn Marino 389e4b17023SJohn Marinoelse 390e4b17023SJohn Marino# Not enable_shared. 391e4b17023SJohn Marinoiterator = $(srcdir)/empty.mk $(patsubst %,$(srcdir)/static-object.mk,$(iter-items)) 392e4b17023SJohn Marinovis_hide = 393e4b17023SJohn Marinogen-hide-list = echo > \$@ 394e4b17023SJohn Marinoendif 395e4b17023SJohn Marino 396e4b17023SJohn MarinoLIB2ADD += enable-execute-stack.c 397e4b17023SJohn Marino 398e4b17023SJohn Marino# While emutls.c has nothing to do with EH, it is in LIB2ADDEH* 399e4b17023SJohn Marino# instead of LIB2ADD because that's the way to be sure on some targets 400e4b17023SJohn Marino# (e.g. *-*-darwin*) only one copy of it is linked. 401e4b17023SJohn MarinoLIB2ADDEH += $(srcdir)/emutls.c 402e4b17023SJohn MarinoLIB2ADDEHSTATIC += $(srcdir)/emutls.c 403e4b17023SJohn MarinoLIB2ADDEHSHARED += $(srcdir)/emutls.c 404e4b17023SJohn Marino 405e4b17023SJohn Marino# Library members defined in libgcc2.c. 406e4b17023SJohn Marinolib2funcs = _muldi3 _negdi2 _lshrdi3 _ashldi3 _ashrdi3 _cmpdi2 _ucmpdi2 \ 407e4b17023SJohn Marino _clear_cache _trampoline __main _absvsi2 \ 408e4b17023SJohn Marino _absvdi2 _addvsi3 _addvdi3 _subvsi3 _subvdi3 _mulvsi3 _mulvdi3 \ 409e4b17023SJohn Marino _negvsi2 _negvdi2 _ctors _ffssi2 _ffsdi2 _clz _clzsi2 _clzdi2 \ 410e4b17023SJohn Marino _ctzsi2 _ctzdi2 _popcount_tab _popcountsi2 _popcountdi2 \ 411e4b17023SJohn Marino _paritysi2 _paritydi2 _powisf2 _powidf2 _powixf2 _powitf2 \ 412e4b17023SJohn Marino _mulsc3 _muldc3 _mulxc3 _multc3 _divsc3 _divdc3 _divxc3 \ 413e4b17023SJohn Marino _divtc3 _bswapsi2 _bswapdi2 _clrsbsi2 _clrsbdi2 414e4b17023SJohn Marino 415e4b17023SJohn Marino# The floating-point conversion routines that involve a single-word integer. 416e4b17023SJohn Marino# XX stands for the integer mode. 417e4b17023SJohn Marinoswfloatfuncs = $(patsubst %,_fixuns%XX,sf df xf) 418e4b17023SJohn Marino 419e4b17023SJohn Marino# Likewise double-word routines. 420e4b17023SJohn Marinodwfloatfuncs = $(patsubst %,_fix%XX,sf df xf tf) \ 421e4b17023SJohn Marino $(patsubst %,_fixuns%XX,sf df xf tf) \ 422e4b17023SJohn Marino $(patsubst %,_floatXX%,sf df xf tf) \ 423e4b17023SJohn Marino $(patsubst %,_floatunXX%,sf df xf tf) 424e4b17023SJohn Marino 425e4b17023SJohn Marinoifeq ($(LIB2_SIDITI_CONV_FUNCS),) 426e4b17023SJohn Marino lib2funcs += $(subst XX,si,$(swfloatfuncs)) 427e4b17023SJohn Marino lib2funcs += $(subst XX,di,$(dwfloatfuncs)) 428e4b17023SJohn Marinoendif 429e4b17023SJohn Marino 430e4b17023SJohn Marino# These might cause a divide overflow trap and so are compiled with 431e4b17023SJohn Marino# unwinder info. 432e4b17023SJohn MarinoLIB2_DIVMOD_FUNCS = _divdi3 _moddi3 _udivdi3 _umoddi3 _udiv_w_sdiv _udivmoddi4 433e4b17023SJohn Marino 434e4b17023SJohn Marino# Remove any objects from lib2funcs and LIB2_DIVMOD_FUNCS that are 435e4b17023SJohn Marino# defined as optimized assembly code in LIB1ASMFUNCS or as C code 436e4b17023SJohn Marino# in LIB2FUNCS_EXCLUDE. 437e4b17023SJohn Marinolib2funcs := $(filter-out $(LIB2FUNCS_EXCLUDE) $(LIB1ASMFUNCS),$(lib2funcs)) 438e4b17023SJohn MarinoLIB2_DIVMOD_FUNCS := $(filter-out $(LIB2FUNCS_EXCLUDE) $(LIB1ASMFUNCS), \ 439e4b17023SJohn Marino $(LIB2_DIVMOD_FUNCS)) 440e4b17023SJohn Marino 441e4b17023SJohn Marino# Build "libgcc1" (assembly) components. 442e4b17023SJohn Marinoifeq ($(enable_shared),yes) 443e4b17023SJohn Marino 444e4b17023SJohn Marinolib1asmfuncs-o = $(patsubst %,%$(objext),$(LIB1ASMFUNCS)) 445e4b17023SJohn Marino$(lib1asmfuncs-o): %$(objext): $(srcdir)/config/$(LIB1ASMSRC) %.vis 446e4b17023SJohn Marino $(gcc_compile) -DL$* -xassembler-with-cpp -c $< -include $*.vis 447e4b17023SJohn Marino$(patsubst %,%.vis,$(LIB1ASMFUNCS)): %.vis: %_s$(objext) 448e4b17023SJohn Marino $(gen-hide-list) 449e4b17023SJohn Marinolibgcc-objects += $(lib1asmfuncs-o) 450e4b17023SJohn Marino 451e4b17023SJohn Marinolib1asmfuncs-s-o = $(patsubst %,%_s$(objext),$(LIB1ASMFUNCS)) 452e4b17023SJohn Marino$(lib1asmfuncs-s-o): %_s$(objext): $(srcdir)/config/$(LIB1ASMSRC) 453e4b17023SJohn Marino $(gcc_s_compile) -DL$* -xassembler-with-cpp -c $< 454e4b17023SJohn Marinolibgcc-s-objects += $(lib1asmfuncs-s-o) 455e4b17023SJohn Marino 456e4b17023SJohn Marinoelse 457e4b17023SJohn Marino 458e4b17023SJohn Marinolib1asmfuncs-o = $(patsubst %,%$(objext),$(LIB1ASMFUNCS)) 459e4b17023SJohn Marino$(lib1asmfuncs-o): %$(objext): $(srcdir)/config/$(LIB1ASMSRC) 460e4b17023SJohn Marino $(gcc_compile) -DL$* -xassembler-with-cpp -c $< 461e4b17023SJohn Marinolibgcc-objects += $(lib1asmfuncs-o) 462e4b17023SJohn Marino 463e4b17023SJohn Marinoendif 464e4b17023SJohn Marino 465e4b17023SJohn Marino# Build lib2funcs. For the static library also include LIB2FUNCS_ST. 466e4b17023SJohn Marinolib2funcs-o = $(patsubst %,%$(objext),$(lib2funcs) $(LIB2FUNCS_ST)) 467e4b17023SJohn Marino$(lib2funcs-o): %$(objext): $(srcdir)/libgcc2.c 468e4b17023SJohn Marino $(gcc_compile) -DL$* -c $< $(vis_hide) 469e4b17023SJohn Marinolibgcc-objects += $(lib2funcs-o) 470e4b17023SJohn Marino 471e4b17023SJohn Marinoifeq ($(enable_shared),yes) 472e4b17023SJohn Marinolib2funcs-s-o = $(patsubst %,%_s$(objext),$(lib2funcs)) 473e4b17023SJohn Marino$(lib2funcs-s-o): %_s$(objext): $(srcdir)/libgcc2.c 474e4b17023SJohn Marino $(gcc_s_compile) -DL$* -c $< 475e4b17023SJohn Marinolibgcc-s-objects += $(lib2funcs-s-o) 476e4b17023SJohn Marinoendif 477e4b17023SJohn Marino 478e4b17023SJohn Marinoifneq ($(LIB2_SIDITI_CONV_FUNCS),) 479e4b17023SJohn Marino# Build libgcc2.c for each conversion function, with a specific 480e4b17023SJohn Marino# L<func> definition and LIBGCC2_UNITS_PER_WORD setting. The DImode 481e4b17023SJohn Marino# functions are built with a wordsize of 4; the TImode functions are 482e4b17023SJohn Marino# built with the same labels, but a wordsize of 8. 483e4b17023SJohn Marino 484e4b17023SJohn Marinosifuncs := $(filter-out $(LIB2FUNCS_EXCLUDE),$(subst XX,si,$(swfloatfuncs))) 485e4b17023SJohn Marinodifuncs := $(filter-out $(LIB2FUNCS_EXCLUDE),$(subst XX,di,$(dwfloatfuncs))) 486e4b17023SJohn Marinotifuncs := $(filter-out $(LIB2FUNCS_EXCLUDE),$(subst XX,ti,$(dwfloatfuncs))) 487e4b17023SJohn Marino 488e4b17023SJohn Marinoiter-items := $(sifuncs) $(difuncs) $(tifuncs) 489e4b17023SJohn Marinoiter-labels := $(sifuncs) $(difuncs) $(difuncs) 490e4b17023SJohn Marinoiter-sizes := $(patsubst %,4,$(sifuncs) $(difuncs)) $(patsubst %,8,$(tifuncs)) 491e4b17023SJohn Marino 492e4b17023SJohn Marinoinclude $(srcdir)/empty.mk $(patsubst %,$(srcdir)/siditi-object.mk,$(iter-items)) 493e4b17023SJohn Marino 494e4b17023SJohn Marinolibgcc-objects += $(patsubst %,%$(objext),$(sifuncs) $(difuncs) $(tifuncs)) 495e4b17023SJohn Marinoifeq ($(enable_shared),yes) 496e4b17023SJohn Marinolibgcc-s-objects += $(patsubst %,%_s$(objext),$(sifuncs) $(difuncs) $(tifuncs)) 497e4b17023SJohn Marinoendif 498e4b17023SJohn Marinoendif 499e4b17023SJohn Marino 500e4b17023SJohn Marino# Build LIB2_DIVMOD_FUNCS. 501e4b17023SJohn Marinolib2-divmod-o = $(patsubst %,%$(objext),$(LIB2_DIVMOD_FUNCS)) 502e4b17023SJohn Marino$(lib2-divmod-o): %$(objext): $(srcdir)/libgcc2.c 503e4b17023SJohn Marino $(gcc_compile) -DL$* -c $< \ 504e4b17023SJohn Marino -fexceptions -fnon-call-exceptions $(vis_hide) 505e4b17023SJohn Marinolibgcc-objects += $(lib2-divmod-o) 506e4b17023SJohn Marino 507e4b17023SJohn Marinoifeq ($(enable_shared),yes) 508e4b17023SJohn Marinolib2-divmod-s-o = $(patsubst %,%_s$(objext),$(LIB2_DIVMOD_FUNCS)) 509e4b17023SJohn Marino$(lib2-divmod-s-o): %_s$(objext): $(srcdir)/libgcc2.c 510e4b17023SJohn Marino $(gcc_s_compile) -DL$* -c $< \ 511e4b17023SJohn Marino -fexceptions -fnon-call-exceptions 512e4b17023SJohn Marinolibgcc-s-objects += $(lib2-divmod-s-o) 513e4b17023SJohn Marinoendif 514e4b17023SJohn Marino 515e4b17023SJohn Marinoifeq ($(TPBIT),) 516e4b17023SJohn Marino# _sf_to_tf and _df_to_tf require tp-bit.c being compiled in. 517e4b17023SJohn MarinoFPBIT_FUNCS := $(filter-out _sf_to_tf,$(FPBIT_FUNCS)) 518e4b17023SJohn MarinoDPBIT_FUNCS := $(filter-out _df_to_tf,$(DPBIT_FUNCS)) 519e4b17023SJohn Marinoendif 520e4b17023SJohn Marino 521e4b17023SJohn MarinoFPBIT_FUNCS := $(filter-out $(LIB2FUNCS_EXCLUDE),$(FPBIT_FUNCS)) 522e4b17023SJohn MarinoDPBIT_FUNCS := $(filter-out $(LIB2FUNCS_EXCLUDE),$(DPBIT_FUNCS)) 523e4b17023SJohn MarinoTPBIT_FUNCS := $(filter-out $(LIB2FUNCS_EXCLUDE),$(TPBIT_FUNCS)) 524e4b17023SJohn Marino 525e4b17023SJohn Marinofpbit-src := $(srcdir)/fp-bit.c 526e4b17023SJohn Marino 527e4b17023SJohn Marino# Build FPBIT. 528e4b17023SJohn Marinoifneq ($(FPBIT),) 529e4b17023SJohn Marinofpbit-o = $(patsubst %,%$(objext),$(FPBIT_FUNCS)) 530e4b17023SJohn Marino$(fpbit-o): %$(objext): $(fpbit-src) 531e4b17023SJohn Marino $(gcc_compile) -DFINE_GRAINED_LIBRARIES -DL$* -DFLOAT $(FPBIT_CFLAGS) -c $< $(vis_hide) 532e4b17023SJohn Marinolibgcc-objects += $(fpbit-o) 533e4b17023SJohn Marino 534e4b17023SJohn Marinoifeq ($(enable_shared),yes) 535e4b17023SJohn Marinofpbit-s-o = $(patsubst %,%_s$(objext),$(FPBIT_FUNCS)) 536e4b17023SJohn Marino$(fpbit-s-o): %_s$(objext): $(fpbit-src) 537e4b17023SJohn Marino $(gcc_s_compile) -DFINE_GRAINED_LIBRARIES -DL$* -DFLOAT $(FPBIT_CFLAGS) -c $< 538e4b17023SJohn Marinolibgcc-s-objects += $(fpbit-s-o) 539e4b17023SJohn Marinoendif 540e4b17023SJohn Marinoendif 541e4b17023SJohn Marino 542e4b17023SJohn Marino# Build DPBIT. 543e4b17023SJohn Marinoifneq ($(DPBIT),) 544e4b17023SJohn Marinodpbit-o = $(patsubst %,%$(objext),$(DPBIT_FUNCS)) 545e4b17023SJohn Marino$(dpbit-o): %$(objext): $(fpbit-src) 546e4b17023SJohn Marino $(gcc_compile) -DFINE_GRAINED_LIBRARIES -DL$* $(DPBIT_CFLAGS) -c $< $(vis_hide) 547e4b17023SJohn Marinolibgcc-objects += $(dpbit-o) 548e4b17023SJohn Marino 549e4b17023SJohn Marinoifeq ($(enable_shared),yes) 550e4b17023SJohn Marinodpbit-s-o = $(patsubst %,%_s$(objext),$(DPBIT_FUNCS)) 551e4b17023SJohn Marino$(dpbit-s-o): %_s$(objext): $(fpbit-src) 552e4b17023SJohn Marino $(gcc_s_compile) -DFINE_GRAINED_LIBRARIES -DL$* $(DPBIT_CFLAGS) -c $< 553e4b17023SJohn Marinolibgcc-s-objects += $(dpbit-s-o) 554e4b17023SJohn Marinoendif 555e4b17023SJohn Marinoendif 556e4b17023SJohn Marino 557e4b17023SJohn Marino# Build TPBIT. 558e4b17023SJohn Marinoifneq ($(TPBIT),) 559e4b17023SJohn Marinotpbit-o = $(patsubst %,%$(objext),$(TPBIT_FUNCS)) 560e4b17023SJohn Marino$(tpbit-o): %$(objext): $(fpbit-src) 561e4b17023SJohn Marino $(gcc_compile) -DFINE_GRAINED_LIBRARIES -DL$* -DTFLOAT $(TPBIT_CFLAGS) -c $< $(vis_hide) 562e4b17023SJohn Marinolibgcc-objects += $(tpbit-o) 563e4b17023SJohn Marino 564e4b17023SJohn Marinoifeq ($(enable_shared),yes) 565e4b17023SJohn Marinotpbit-s-o = $(patsubst %,%_s$(objext),$(TPBIT_FUNCS)) 566e4b17023SJohn Marino$(tpbit-s-o): %_s$(objext): $(fpbit-src) 567e4b17023SJohn Marino $(gcc_s_compile) -DFINE_GRAINED_LIBRARIES -DL$* -DTFLOAT $(TPBIT_CFLAGS) -c $< 568e4b17023SJohn Marinolibgcc-s-objects += $(tpbit-s-o) 569e4b17023SJohn Marinoendif 570e4b17023SJohn Marinoendif 571e4b17023SJohn Marino 572e4b17023SJohn Marino# Build decimal floating point support. 573e4b17023SJohn Marinoifeq ($(decimal_float),yes) 574e4b17023SJohn Marino 575e4b17023SJohn Marino# If $DFP_ENABLE is set, then we want all data type sizes. 576e4b17023SJohn Marinoifneq ($(DFP_ENABLE),) 577e4b17023SJohn MarinoD32PBIT = 1 578e4b17023SJohn MarinoD64PBIT = 1 579e4b17023SJohn MarinoD128PBIT = 1 580e4b17023SJohn Marinoendif 581e4b17023SJohn Marino 582e4b17023SJohn Marinodfp-filenames = 583e4b17023SJohn Marinoifneq ($(D32PBIT)$(D64PBIT)$(D128PBIT),) 584e4b17023SJohn Marinoifeq ($(enable_decimal_float),bid) 585e4b17023SJohn Marinodfp-filenames += bid_decimal_globals bid_decimal_data \ 586e4b17023SJohn Marino bid_binarydecimal bid_convert_data \ 587e4b17023SJohn Marino _isinfd32 _isinfd64 _isinfd128 bid64_noncomp \ 588e4b17023SJohn Marino bid128_noncomp bid128_fma bid_round bid_from_int \ 589e4b17023SJohn Marino bid64_add bid128_add bid64_div bid128_div \ 590e4b17023SJohn Marino bid64_mul bid128_mul bid64_compare bid128_compare \ 591e4b17023SJohn Marino bid128 bid32_to_bid64 bid32_to_bid128 bid64_to_bid128 \ 592e4b17023SJohn Marino bid64_to_int32 bid64_to_int64 \ 593e4b17023SJohn Marino bid64_to_uint32 bid64_to_uint64 \ 594e4b17023SJohn Marino bid128_to_int32 bid128_to_int64 \ 595e4b17023SJohn Marino bid128_to_uint32 bid128_to_uint64 596e4b17023SJohn Marinoelse 597e4b17023SJohn Marinodfp-filenames += decContext decNumber decExcept decRound decLibrary decDouble decPacked decQuad decSingle 598e4b17023SJohn Marinoendif 599e4b17023SJohn Marinoendif 600e4b17023SJohn Marino 601e4b17023SJohn Marinodfp-objects = $(patsubst %,%$(objext),$(dfp-filenames)) 602e4b17023SJohn Marinoifeq ($(enable_decimal_float),bid) 603e4b17023SJohn Marino$(dfp-objects): %$(objext): $(srcdir)/config/libbid/%.c 604e4b17023SJohn Marinoelse 605e4b17023SJohn Marino$(dfp-objects): %$(objext): $(srcdir)/../libdecnumber/%.c 606e4b17023SJohn Marinoendif 607e4b17023SJohn Marino $(gcc_compile) -c $< 608e4b17023SJohn Marinolibgcc-objects += $(dfp-objects) 609e4b17023SJohn Marino 610e4b17023SJohn Marinodecbits-filenames = 611e4b17023SJohn Marinoifneq ($(enable_decimal_float),bid) 612e4b17023SJohn Marinoifneq ($(D32PBIT),) 613e4b17023SJohn Marinodecbits-filenames += decimal32 614e4b17023SJohn Marinoendif 615e4b17023SJohn Marino 616e4b17023SJohn Marinoifneq ($(D64PBIT),) 617e4b17023SJohn Marinodecbits-filenames += decimal64 618e4b17023SJohn Marinoendif 619e4b17023SJohn Marino 620e4b17023SJohn Marinoifneq ($(D128PBIT),) 621e4b17023SJohn Marinodecbits-filenames += decimal128 622e4b17023SJohn Marinoendif 623e4b17023SJohn Marinoendif 624e4b17023SJohn Marino 625e4b17023SJohn Marinodecbits-objects = $(patsubst %,%$(objext),$(decbits-filenames)) 626e4b17023SJohn Marinoifeq ($(enable_decimal_float),bid) 627e4b17023SJohn Marino$(decbits-objects): %$(objext): $(srcdir)/config/libbid/%.c 628e4b17023SJohn Marinoelse 629e4b17023SJohn Marino$(decbits-objects): %$(objext): $(srcdir)/../libdecnumber/$(enable_decimal_float)/%.c 630e4b17023SJohn Marinoendif 631e4b17023SJohn Marino $(gcc_compile) -c $< 632e4b17023SJohn Marinolibgcc-objects += $(decbits-objects) 633e4b17023SJohn Marino 634e4b17023SJohn Marino# Next build individual support functions. 635e4b17023SJohn MarinoD32PBIT_FUNCS = _addsub_sd _div_sd _mul_sd _plus_sd _minus_sd \ 636e4b17023SJohn Marino _eq_sd _ne_sd _lt_sd _gt_sd _le_sd _ge_sd \ 637e4b17023SJohn Marino _sd_to_si _sd_to_di _sd_to_usi _sd_to_udi \ 638e4b17023SJohn Marino _si_to_sd _di_to_sd _usi_to_sd _udi_to_sd \ 639e4b17023SJohn Marino _sd_to_sf _sd_to_df _sd_to_xf _sd_to_tf \ 640e4b17023SJohn Marino _sf_to_sd _df_to_sd _xf_to_sd _tf_to_sd \ 641e4b17023SJohn Marino _sd_to_dd _sd_to_td _unord_sd _conv_sd 642e4b17023SJohn Marino 643e4b17023SJohn MarinoD64PBIT_FUNCS = _addsub_dd _div_dd _mul_dd _plus_dd _minus_dd \ 644e4b17023SJohn Marino _eq_dd _ne_dd _lt_dd _gt_dd _le_dd _ge_dd \ 645e4b17023SJohn Marino _dd_to_si _dd_to_di _dd_to_usi _dd_to_udi \ 646e4b17023SJohn Marino _si_to_dd _di_to_dd _usi_to_dd _udi_to_dd \ 647e4b17023SJohn Marino _dd_to_sf _dd_to_df _dd_to_xf _dd_to_tf \ 648e4b17023SJohn Marino _sf_to_dd _df_to_dd _xf_to_dd _tf_to_dd \ 649e4b17023SJohn Marino _dd_to_sd _dd_to_td _unord_dd _conv_dd 650e4b17023SJohn Marino 651e4b17023SJohn MarinoD128PBIT_FUNCS = _addsub_td _div_td _mul_td _plus_td _minus_td \ 652e4b17023SJohn Marino _eq_td _ne_td _lt_td _gt_td _le_td _ge_td \ 653e4b17023SJohn Marino _td_to_si _td_to_di _td_to_usi _td_to_udi \ 654e4b17023SJohn Marino _si_to_td _di_to_td _usi_to_td _udi_to_td \ 655e4b17023SJohn Marino _td_to_sf _td_to_df _td_to_xf _td_to_tf \ 656e4b17023SJohn Marino _sf_to_td _df_to_td _xf_to_td _tf_to_td \ 657e4b17023SJohn Marino _td_to_sd _td_to_dd _unord_td _conv_td 658e4b17023SJohn Marino 659e4b17023SJohn Marinoifeq ($(enable_decimal_float),bid) 660e4b17023SJohn Marinoifneq ($(D32PBIT),) 661e4b17023SJohn MarinoD32PBIT_FUNCS:=$(filter-out _plus_sd _minus_sd _conv_sd, $(D32PBIT_FUNCS)) 662e4b17023SJohn Marinoendif 663e4b17023SJohn Marino 664e4b17023SJohn Marinoifneq ($(D64PBIT),) 665e4b17023SJohn MarinoD64PBIT_FUNCS:=$(filter-out _plus_dd _minus_dd _conv_dd, $(D64PBIT_FUNCS)) 666e4b17023SJohn Marinoendif 667e4b17023SJohn Marino 668e4b17023SJohn Marinoifneq ($(D128PBIT),) 669e4b17023SJohn MarinoD128PBIT_FUNCS:=$(filter-out _plus_td _minus_td _conv_td, $(D128PBIT_FUNCS)) 670e4b17023SJohn Marinoendif 671e4b17023SJohn Marinoendif 672e4b17023SJohn Marino 673e4b17023SJohn Marinoifneq ($(D32PBIT),) 674e4b17023SJohn Marinod32pbit-o = $(patsubst %,%$(objext),$(D32PBIT_FUNCS)) 675e4b17023SJohn Marinoifeq ($(enable_decimal_float),bid) 676e4b17023SJohn Marino$(d32pbit-o): %$(objext): $(srcdir)/config/libbid/%.c 677e4b17023SJohn Marinoelse 678e4b17023SJohn Marino$(d32pbit-o): %$(objext): $(srcdir)/dfp-bit.c 679e4b17023SJohn Marinoendif 680e4b17023SJohn Marino $(gcc_compile) -DFINE_GRAINED_LIBRARIES -DL$* -DWIDTH=32 -c $< 681e4b17023SJohn Marinolibgcc-objects += $(d32pbit-o) 682e4b17023SJohn Marinoendif 683e4b17023SJohn Marino 684e4b17023SJohn Marinoifneq ($(D64PBIT),) 685e4b17023SJohn Marinod64pbit-o = $(patsubst %,%$(objext),$(D64PBIT_FUNCS)) 686e4b17023SJohn Marinoifeq ($(enable_decimal_float),bid) 687e4b17023SJohn Marino$(d64pbit-o): %$(objext): $(srcdir)/config/libbid/%.c 688e4b17023SJohn Marinoelse 689e4b17023SJohn Marino$(d64pbit-o): %$(objext): $(srcdir)/dfp-bit.c 690e4b17023SJohn Marinoendif 691e4b17023SJohn Marino $(gcc_compile) -DFINE_GRAINED_LIBRARIES -DL$* -DWIDTH=64 -c $< 692e4b17023SJohn Marinolibgcc-objects += $(d64pbit-o) 693e4b17023SJohn Marinoendif 694e4b17023SJohn Marino 695e4b17023SJohn Marinoifneq ($(D128PBIT),) 696e4b17023SJohn Marinod128pbit-o = $(patsubst %,%$(objext),$(D128PBIT_FUNCS)) 697e4b17023SJohn Marinoifeq ($(enable_decimal_float),bid) 698e4b17023SJohn Marino$(d128pbit-o): %$(objext): $(srcdir)/config/libbid/%.c 699e4b17023SJohn Marinoelse 700e4b17023SJohn Marino$(d128pbit-o): %$(objext): $(srcdir)/dfp-bit.c 701e4b17023SJohn Marinoendif 702e4b17023SJohn Marino $(gcc_compile) -DFINE_GRAINED_LIBRARIES -DL$* -DWIDTH=128 -c $< 703e4b17023SJohn Marinolibgcc-objects += $(d128pbit-o) 704e4b17023SJohn Marinoendif 705e4b17023SJohn Marino 706e4b17023SJohn Marinoendif 707e4b17023SJohn Marino 708e4b17023SJohn Marinoifeq ($(SYNC),yes) 709e4b17023SJohn Marinolibgcc-sync-size-funcs := $(foreach op, add sub or and xor nand, \ 710e4b17023SJohn Marino sync_fetch_and_$(op) \ 711e4b17023SJohn Marino sync_$(op)_and_fetch) \ 712e4b17023SJohn Marino sync_bool_compare_and_swap \ 713e4b17023SJohn Marino sync_val_compare_and_swap \ 714e4b17023SJohn Marino sync_lock_test_and_set 715e4b17023SJohn Marino 716e4b17023SJohn Marinolibgcc-sync-size-funcs := $(foreach prefix, $(libgcc-sync-size-funcs), \ 717e4b17023SJohn Marino $(foreach suffix, 1 2 4 8 16, \ 718e4b17023SJohn Marino $(prefix)_$(suffix))) 719e4b17023SJohn Marino 720e4b17023SJohn Marinolibgcc-sync-size-funcs-o = $(patsubst %,%$(objext),$(libgcc-sync-size-funcs)) 721e4b17023SJohn Marino$(libgcc-sync-size-funcs-o): %$(objext): $(srcdir)/sync.c 722e4b17023SJohn Marino $(gcc_compile) $(SYNC_CFLAGS) \ 723e4b17023SJohn Marino -DFN=`echo "$*" | sed 's/_[^_]*$$//'` \ 724e4b17023SJohn Marino -DSIZE=`echo "$*" | sed 's/.*_//'` \ 725e4b17023SJohn Marino -c $< $(vis_hide) 726e4b17023SJohn Marinolibgcc-objects += $(libgcc-sync-size-funcs-o) 727e4b17023SJohn Marino 728e4b17023SJohn Marinolibgcc-sync-funcs := sync_synchronize 729e4b17023SJohn Marino 730e4b17023SJohn Marinolibgcc-sync-funcs-o = $(patsubst %,%$(objext),$(libgcc-sync-funcs)) 731e4b17023SJohn Marino$(libgcc-sync-funcs-o): %$(objext): $(srcdir)/sync.c 732e4b17023SJohn Marino $(gcc_compile) $(SYNC_CFLAGS) \ 733e4b17023SJohn Marino -DL$* \ 734e4b17023SJohn Marino -c $< $(vis_hide) 735e4b17023SJohn Marinolibgcc-objects += $(libgcc-sync-funcs-o) 736e4b17023SJohn Marino 737e4b17023SJohn Marinoifeq ($(enable_shared),yes) 738e4b17023SJohn Marinolibgcc-sync-size-funcs-s-o = $(patsubst %,%_s$(objext), \ 739e4b17023SJohn Marino $(libgcc-sync-size-funcs)) 740e4b17023SJohn Marino$(libgcc-sync-size-funcs-s-o): %_s$(objext): $(srcdir)/sync.c 741e4b17023SJohn Marino $(gcc_s_compile) $(SYNC_CFLAGS) \ 742e4b17023SJohn Marino -DFN=`echo "$*" | sed 's/_[^_]*$$//'` \ 743e4b17023SJohn Marino -DSIZE=`echo "$*" | sed 's/.*_//'` \ 744e4b17023SJohn Marino -c $< 745e4b17023SJohn Marinolibgcc-s-objects += $(libgcc-sync-size-funcs-s-o) 746e4b17023SJohn Marino 747e4b17023SJohn Marinolibgcc-sync-funcs-s-o = $(patsubst %,%_s$(objext),$(libgcc-sync-funcs)) 748e4b17023SJohn Marino$(libgcc-sync-funcs-s-o): %_s$(objext): $(srcdir)/sync.c 749e4b17023SJohn Marino $(gcc_s_compile) $(SYNC_CFLAGS) \ 750e4b17023SJohn Marino -DL$* \ 751e4b17023SJohn Marino -c $< 752e4b17023SJohn Marinolibgcc-s-objects += $(libgcc-sync-funcs-s-o) 753e4b17023SJohn Marinoendif 754e4b17023SJohn Marinoendif 755e4b17023SJohn Marino 756e4b17023SJohn Marino# Build fixed-point support. 757e4b17023SJohn Marinoifeq ($(fixed_point),yes) 758e4b17023SJohn Marino 759e4b17023SJohn Marino# Generate permutations of function name and mode 760e4b17023SJohn Marinofixed-labels := $(shell $(SHELL) $(srcdir)/gen-fixed.sh arith labels) 761e4b17023SJohn Marinofixed-funcs := $(shell $(SHELL) $(srcdir)/gen-fixed.sh arith funcs) 762e4b17023SJohn Marinofixed-modes := $(shell $(SHELL) $(srcdir)/gen-fixed.sh arith modes) 763e4b17023SJohn Marino 764e4b17023SJohn Marino# Generate the rules for each arithmetic function 765e4b17023SJohn Marinoiter-items := $(fixed-funcs) 766e4b17023SJohn Marinoiter-labels := $(fixed-labels) 767e4b17023SJohn Marinoiter-from := $(fixed-modes) 768e4b17023SJohn Marinoiter-to := $(fixed-modes) 769e4b17023SJohn Marinoinclude $(srcdir)/empty.mk $(patsubst %,$(srcdir)/fixed-obj.mk,$(iter-items)) 770e4b17023SJohn Marino 771e4b17023SJohn Marino# Add arithmetic functions to list of objects to be built 772e4b17023SJohn Marinolibgcc-objects += $(patsubst %,%$(objext),$(fixed-funcs)) 773e4b17023SJohn Marinoifeq ($(enable_shared),yes) 774e4b17023SJohn Marinolibgcc-s-objects += $(patsubst %,%_s$(objext),$(fixed-funcs)) 775e4b17023SJohn Marinoendif 776e4b17023SJohn Marino 777e4b17023SJohn Marino# Convert from or to fractional 778e4b17023SJohn Marinofixed-conv-funcs := $(shell $(SHELL) $(srcdir)/gen-fixed.sh conv funcs) 779e4b17023SJohn Marinofixed-conv-labels := $(shell $(SHELL) $(srcdir)/gen-fixed.sh conv labels) 780e4b17023SJohn Marinofixed-conv-from := $(shell $(SHELL) $(srcdir)/gen-fixed.sh conv from) 781e4b17023SJohn Marinofixed-conv-to := $(shell $(SHELL) $(srcdir)/gen-fixed.sh conv to) 782e4b17023SJohn Marino 783e4b17023SJohn Marino# Generate the make rules for each conversion function 784e4b17023SJohn Marinoiter-items := $(fixed-conv-funcs) 785e4b17023SJohn Marinoiter-labels := $(fixed-conv-labels) 786e4b17023SJohn Marinoiter-from := $(fixed-conv-from) 787e4b17023SJohn Marinoiter-to := $(fixed-conv-to) 788e4b17023SJohn Marinoinclude $(srcdir)/empty.mk $(patsubst %,$(srcdir)/fixed-obj.mk,$(iter-items)) 789e4b17023SJohn Marino 790e4b17023SJohn Marino# Add conversion functions to list of objects to be built 791e4b17023SJohn Marinolibgcc-objects += $(patsubst %,%$(objext),$(fixed-conv-funcs)) 792e4b17023SJohn Marinoifeq ($(enable_shared),yes) 793e4b17023SJohn Marinolibgcc-s-objects += $(patsubst %,%_s$(objext),$(fixed-conv-funcs)) 794e4b17023SJohn Marinoendif 795e4b17023SJohn Marino 796e4b17023SJohn Marinoendif 797e4b17023SJohn Marino 798e4b17023SJohn Marino# Build LIB2ADD and LIB2ADD_ST. 799e4b17023SJohn Marinoifneq ($(filter-out %.c %.S %.asm,$(LIB2ADD) $(LIB2ADD_ST)),) 800e4b17023SJohn Marino$(error Unsupported files in LIB2ADD or LIB2ADD_ST.) 801e4b17023SJohn Marinoendif 802e4b17023SJohn Marino 803e4b17023SJohn Marinolibgcc-objects += $(addsuffix $(objext),$(basename $(notdir $(LIB2ADD)))) 804e4b17023SJohn Marinolibgcc-objects += $(addsuffix $(objext),$(basename $(notdir $(LIB2ADD_ST)))) 805e4b17023SJohn Marino 806e4b17023SJohn Marinoc_flags := 807e4b17023SJohn Marinoiter-items := $(LIB2ADD) $(LIB2ADD_ST) 808e4b17023SJohn Marinoinclude $(iterator) 809e4b17023SJohn Marino 810e4b17023SJohn Marinoifeq ($(enable_shared),yes) 811e4b17023SJohn Marinolibgcc-s-objects += $(addsuffix _s$(objext),$(basename $(notdir $(LIB2ADD)))) 812e4b17023SJohn Marinoendif 813e4b17023SJohn Marino 814e4b17023SJohn Marino# Build LIB2ADDEH, LIB2ADDEHSTATIC, and LIB2ADDEHSHARED. If we don't have 815e4b17023SJohn Marino# libgcc_eh.a, only LIB2ADDEH matters. If we do, only LIB2ADDEHSTATIC and 816e4b17023SJohn Marino# LIB2ADDEHSHARED matter. (Usually all three are identical.) 817e4b17023SJohn Marino 818e4b17023SJohn Marinoc_flags := -fexceptions 819e4b17023SJohn Marino 820e4b17023SJohn Marinoifeq ($(enable_shared),yes) 821e4b17023SJohn Marino 822e4b17023SJohn Marinolibgcc-eh-objects += $(addsuffix $(objext),$(basename $(notdir $(LIB2ADDEHSTATIC)))) 823e4b17023SJohn Marinolibgcc-s-objects += $(addsuffix _s$(objext),$(basename $(notdir $(LIB2ADDEHSHARED)))) 824e4b17023SJohn Marino 825e4b17023SJohn Marinoiter-items := $(sort $(LIB2ADDEHSTATIC) $(LIB2ADDEHSHARED)) 826e4b17023SJohn Marinoinclude $(iterator) 827e4b17023SJohn Marino 828e4b17023SJohn Marinoelse 829e4b17023SJohn Marino# Not shared. LIB2ADDEH are added to libgcc.a. 830e4b17023SJohn Marino 831e4b17023SJohn Marinolibgcc-objects += $(addsuffix $(objext),$(basename $(notdir $(LIB2ADDEH)))) 832e4b17023SJohn Marino 833e4b17023SJohn Marinoiter-items := $(LIB2ADDEH) 834e4b17023SJohn Marinoinclude $(iterator) 835e4b17023SJohn Marino 836e4b17023SJohn Marinoendif 837e4b17023SJohn Marino 838e4b17023SJohn Marino# Build LIBUNWIND. Use -fno-exceptions so that the unwind library does 839e4b17023SJohn Marino# not generate calls to __gcc_personality_v0. 840e4b17023SJohn Marino 841e4b17023SJohn Marinoc_flags := -fno-exceptions 842e4b17023SJohn Marino 843e4b17023SJohn Marinolibunwind-objects += $(addsuffix $(objext),$(basename $(notdir $(LIBUNWIND)))) 844e4b17023SJohn Marino 845e4b17023SJohn Marinoifeq ($(enable_shared),yes) 846e4b17023SJohn Marinolibunwind-s-objects += $(addsuffix _s$(objext),$(basename $(notdir $(LIBUNWIND)))) 847e4b17023SJohn Marinoendif 848e4b17023SJohn Marino 849e4b17023SJohn Marinoiter-items := $(LIBUNWIND) 850e4b17023SJohn Marinoinclude $(iterator) 851e4b17023SJohn Marino 852e4b17023SJohn Marino# Build libgcov components. 853e4b17023SJohn Marino 854e4b17023SJohn Marino# Defined in libgcov.c, included only in gcov library 855e4b17023SJohn MarinoLIBGCOV = _gcov _gcov_merge_add _gcov_merge_single _gcov_merge_delta \ 856e4b17023SJohn Marino _gcov_fork _gcov_execl _gcov_execlp _gcov_execle \ 857e4b17023SJohn Marino _gcov_execv _gcov_execvp _gcov_execve \ 858e4b17023SJohn Marino _gcov_interval_profiler _gcov_pow2_profiler _gcov_one_value_profiler \ 859e4b17023SJohn Marino _gcov_indirect_call_profiler _gcov_average_profiler _gcov_ior_profiler \ 860e4b17023SJohn Marino _gcov_merge_ior 861e4b17023SJohn Marino 862e4b17023SJohn Marinolibgcov-objects = $(patsubst %,%$(objext),$(LIBGCOV)) 863e4b17023SJohn Marino 864e4b17023SJohn Marino$(libgcov-objects): %$(objext): $(srcdir)/libgcov.c 865e4b17023SJohn Marino $(gcc_compile) -DL$* -c $(srcdir)/libgcov.c 866e4b17023SJohn Marino 867e4b17023SJohn Marino 868e4b17023SJohn Marino# Static libraries. 869e4b17023SJohn Marinolibgcc.a: $(libgcc-objects) 870e4b17023SJohn Marinolibgcov.a: $(libgcov-objects) 871e4b17023SJohn Marinolibunwind.a: $(libunwind-objects) 872e4b17023SJohn Marinolibgcc_eh.a: $(libgcc-eh-objects) 873e4b17023SJohn Marino 874e4b17023SJohn Marinolibgcc.a libgcov.a libunwind.a libgcc_eh.a: 875e4b17023SJohn Marino -rm -f $@ 876e4b17023SJohn Marino 877e4b17023SJohn Marino objects="$(objects)"; \ 878e4b17023SJohn Marino if test -z "$$objects"; then \ 879e4b17023SJohn Marino echo 'int __libgcc_eh_dummy;' > eh_dummy.c; \ 880e4b17023SJohn Marino $(gcc_compile_bare) $(vis_hide) -c eh_dummy.c \ 881e4b17023SJohn Marino -o eh_dummy$(objext); \ 882e4b17023SJohn Marino objects=eh_dummy$(objext); \ 883e4b17023SJohn Marino fi; \ 884e4b17023SJohn Marino $(AR_CREATE_FOR_TARGET) $@ $$objects 885e4b17023SJohn Marino 886e4b17023SJohn Marino $(RANLIB) $@ 887e4b17023SJohn Marino 888e4b17023SJohn Marinoall: libgcc.a libgcov.a 889e4b17023SJohn Marino 890e4b17023SJohn Marinoifneq ($(LIBUNWIND),) 891e4b17023SJohn Marinoall: libunwind.a 892e4b17023SJohn Marinolibgcc_s$(SHLIB_EXT): libunwind$(SHLIB_EXT) 893e4b17023SJohn Marinoendif 894e4b17023SJohn Marino 895e4b17023SJohn Marinoifeq ($(enable_shared),yes) 896e4b17023SJohn Marinoall: libgcc_eh.a libgcc_s$(SHLIB_EXT) 897e4b17023SJohn Marinoifneq ($(LIBUNWIND),) 898e4b17023SJohn Marinoall: libunwind$(SHLIB_EXT) 899e4b17023SJohn Marinoendif 900e4b17023SJohn Marinoendif 901e4b17023SJohn Marino 902e4b17023SJohn Marinoifeq ($(enable_shared),yes) 903e4b17023SJohn Marino 904e4b17023SJohn Marino# Map-file generation. 905e4b17023SJohn Marinoifneq ($(SHLIB_MKMAP),) 906e4b17023SJohn Marinolibgcc.map: $(SHLIB_MKMAP) $(SHLIB_MAPFILES) $(libgcc-s-objects) 907e4b17023SJohn Marino { $(NM) $(SHLIB_NM_FLAGS) $(libgcc-s-objects); echo %%; \ 908e4b17023SJohn Marino cat $(SHLIB_MAPFILES) \ 909e4b17023SJohn Marino | sed -e '/^[ ]*#/d' \ 910e4b17023SJohn Marino -e 's/^%\(if\|else\|elif\|endif\|define\)/#\1/' \ 911e4b17023SJohn Marino | $(gcc_compile_bare) -E -xassembler-with-cpp -; \ 912e4b17023SJohn Marino } | $(AWK) -f $(SHLIB_MKMAP) $(SHLIB_MKMAP_OPTS) > tmp-$@ 913e4b17023SJohn Marino mv tmp-$@ $@ 914e4b17023SJohn Marinolibgcc_s$(SHLIB_EXT): libgcc.map 915e4b17023SJohn Marinomapfile = libgcc.map 916e4b17023SJohn Marinoendif 917e4b17023SJohn Marino 918e4b17023SJohn Marinolibgcc-std.ver: $(srcdir)/libgcc-std.ver.in 919e4b17023SJohn Marino sed -e 's/__PFX__/$(LIBGCC_VER_GNU_PREFIX)/g' \ 920e4b17023SJohn Marino -e 's/__FIXPTPFX__/$(LIBGCC_VER_FIXEDPOINT_GNU_PREFIX)/g' < $< > $@ 921e4b17023SJohn Marino 9225ce9237cSJohn Marinolibgcc_s$(SHLIB_EXT): $(libgcc-s-objects) $(extra-parts) libgcc.a 923e4b17023SJohn Marino # @multilib_flags@ is still needed because this may use 924e4b17023SJohn Marino # $(GCC_FOR_TARGET) and $(LIBGCC2_CFLAGS) directly. 925e4b17023SJohn Marino # @multilib_dir@ is not really necessary, but sometimes it has 926e4b17023SJohn Marino # more uses than just a directory name. 927e4b17023SJohn Marino $(mkinstalldirs) $(MULTIDIR) 928e4b17023SJohn Marino $(subst @multilib_flags@,$(CFLAGS) -B./,$(subst \ 929e4b17023SJohn Marino @multilib_dir@,$(MULTIDIR),$(subst \ 9305ce9237cSJohn Marino @shlib_objs@,$(objects) libgcc.a,$(subst \ 931e4b17023SJohn Marino @shlib_base_name@,libgcc_s,$(subst \ 932e4b17023SJohn Marino @shlib_map_file@,$(mapfile),$(subst \ 933e4b17023SJohn Marino @shlib_slibdir_qual@,$(MULTIOSSUBDIR),$(subst \ 934e4b17023SJohn Marino @shlib_slibdir@,$(shlib_slibdir),$(SHLIB_LINK)))))))) 935e4b17023SJohn Marino 936e4b17023SJohn Marinolibunwind$(SHLIB_EXT): $(libunwind-s-objects) $(extra-parts) 937e4b17023SJohn Marino # @multilib_flags@ is still needed because this may use 938e4b17023SJohn Marino # $(GCC_FOR_TARGET) and $(LIBGCC2_CFLAGS) directly. 939e4b17023SJohn Marino # @multilib_dir@ is not really necessary, but sometimes it has 940e4b17023SJohn Marino # more uses than just a directory name. 941e4b17023SJohn Marino $(mkinstalldirs) $(MULTIDIR) 942e4b17023SJohn Marino $(subst @multilib_flags@,$(CFLAGS) -B./,$(subst \ 943e4b17023SJohn Marino @multilib_dir@,$(MULTIDIR),$(subst \ 944e4b17023SJohn Marino @shlib_objs@,$(objects),$(subst \ 945e4b17023SJohn Marino @shlib_base_name@,libunwind,$(subst \ 946e4b17023SJohn Marino @shlib_slibdir_qual@,$(MULTIOSSUBDIR),$(SHLIBUNWIND_LINK)))))) 947e4b17023SJohn Marino 948e4b17023SJohn Marinoendif 949e4b17023SJohn Marino 950e4b17023SJohn Marino# Build the standard GCC startfiles and endfiles. 951e4b17023SJohn MarinoALL_CRT_CFLAGS = $(CFLAGS) $(CRTSTUFF_CFLAGS) $(INCLUDES) 952e4b17023SJohn Marinocrt_compile = $(CC) $(ALL_CRT_CFLAGS) -o $@ $(compile_deps) 953e4b17023SJohn Marino 954e4b17023SJohn Marinoifeq ($(CUSTOM_CRTSTUFF),) 955e4b17023SJohn Marino# Compile two additional files that are linked with every program 956e4b17023SJohn Marino# linked using GCC on systems using COFF or ELF, for the sake of C++ 957e4b17023SJohn Marino# constructors. 958e4b17023SJohn Marinocrtbegin$(objext): $(srcdir)/crtstuff.c 959e4b17023SJohn Marino $(crt_compile) $(CRTSTUFF_T_CFLAGS) -c $< -DCRT_BEGIN 960e4b17023SJohn Marino 961e4b17023SJohn Marinocrtend$(objext): $(srcdir)/crtstuff.c 962e4b17023SJohn Marino $(crt_compile) $(CRTSTUFF_T_CFLAGS) -c $< -DCRT_END 963e4b17023SJohn Marino 964e4b17023SJohn Marino# These are versions of crtbegin and crtend for shared libraries. 965e4b17023SJohn MarinocrtbeginS$(objext): $(srcdir)/crtstuff.c 966e4b17023SJohn Marino $(crt_compile) $(CRTSTUFF_T_CFLAGS_S) -c $< -DCRT_BEGIN -DCRTSTUFFS_O 967e4b17023SJohn Marino 968e4b17023SJohn MarinocrtendS$(objext): $(srcdir)/crtstuff.c 969e4b17023SJohn Marino $(crt_compile) $(CRTSTUFF_T_CFLAGS_S) -c $< -DCRT_END -DCRTSTUFFS_O 970e4b17023SJohn Marino 971e4b17023SJohn Marino# This is a version of crtbegin for -static links. 972e4b17023SJohn MarinocrtbeginT$(objext): $(srcdir)/crtstuff.c 973e4b17023SJohn Marino $(crt_compile) $(CRTSTUFF_T_CFLAGS) -c $< -DCRT_BEGIN -DCRTSTUFFT_O 974e4b17023SJohn Marinoendif 975e4b17023SJohn Marino 976e4b17023SJohn Marinoifeq ($(CUSTOM_CRTIN),) 977e4b17023SJohn Marino# -x assembler-with-cpp is only needed on case-insensitive filesystem. 978e4b17023SJohn Marinocrti$(objext): $(srcdir)/config/$(cpu_type)/crti.S 979e4b17023SJohn Marino $(crt_compile) -c -x assembler-with-cpp $< 980e4b17023SJohn Marino 981e4b17023SJohn Marinocrtn$(objext): $(srcdir)/config/$(cpu_type)/crtn.S 982e4b17023SJohn Marino $(crt_compile) -c -x assembler-with-cpp $< 983e4b17023SJohn Marinoendif 984e4b17023SJohn Marino 985e4b17023SJohn Marino# Build extra startfiles in the libgcc directory. 986e4b17023SJohn Marino.PHONY: libgcc-extra-parts 987e4b17023SJohn Marinolibgcc-extra-parts: $(EXTRA_PARTS) 988e4b17023SJohn Marino 989e4b17023SJohn Marino # Early copyback; see "all" above for the rationale. The 990e4b17023SJohn Marino # early copy is necessary so that the gcc -B options find 991e4b17023SJohn Marino # the right startup files when linking shared libgcc. 992e4b17023SJohn Marino $(mkinstalldirs) $(gcc_objdir)$(MULTISUBDIR) 993e4b17023SJohn Marino parts="$(EXTRA_PARTS)"; \ 994e4b17023SJohn Marino for file in $$parts; do \ 995e4b17023SJohn Marino rm -f $(gcc_objdir)$(MULTISUBDIR)/$$file; \ 996e4b17023SJohn Marino $(INSTALL_DATA) $$file $(gcc_objdir)$(MULTISUBDIR)/; \ 997e4b17023SJohn Marino case $$file in \ 998e4b17023SJohn Marino *.a) \ 999e4b17023SJohn Marino $(RANLIB) $(gcc_objdir)$(MULTISUBDIR)/$$file ;; \ 1000e4b17023SJohn Marino esac; \ 1001e4b17023SJohn Marino done 1002e4b17023SJohn Marino 1003e4b17023SJohn Marinoall: $(extra-parts) 1004e4b17023SJohn Marino 1005e4b17023SJohn Marino$(libgcc-objects) $(libgcc-s-objects) $(libgcc-eh-objects) \ 1006e4b17023SJohn Marino $(libgcov-objects) \ 1007e4b17023SJohn Marino $(libunwind-objects) $(libunwind-s-objects) \ 1008e4b17023SJohn Marino $(EXTRA_PARTS): libgcc_tm.h 1009e4b17023SJohn Marino 1010e4b17023SJohn Marino# Copy unwind.h to the place where gcc will look for it at build-time 1011e4b17023SJohn Marinoinstall-unwind_h-forbuild: 1012e4b17023SJohn Marino dest=$(gcc_objdir)/include/tmp$$$$-unwind.h; \ 1013e4b17023SJohn Marino cp unwind.h $$dest; \ 1014e4b17023SJohn Marino chmod a+r $$dest; \ 1015e4b17023SJohn Marino sh $(srcdir)/../move-if-change $$dest $(gcc_objdir)/include/unwind.h 1016e4b17023SJohn Marino 1017e4b17023SJohn Marino# Copy unwind.h to the place where gcc will look at run-time, once installed 1018e4b17023SJohn Marino# 1019e4b17023SJohn Marino# This is redundant with the internal copy above when using a regular toplevel 1020e4b17023SJohn Marino# "install" target, because gcc's install will copy to the destination as well. 1021e4b17023SJohn Marino# 1022e4b17023SJohn Marino# This is however useful for "install-no-fixincludes" case, when only the gcc 1023e4b17023SJohn Marino# internal headers are copied by gcc's install. 1024e4b17023SJohn Marinoinstall-unwind_h: 1025e4b17023SJohn Marino $(mkinstalldirs) $(DESTDIR)$(libsubdir)/include 1026e4b17023SJohn Marino $(INSTALL_DATA) unwind.h $(DESTDIR)$(libsubdir)/include 1027e4b17023SJohn Marino 1028e4b17023SJohn Marinoall: install-unwind_h-forbuild 1029e4b17023SJohn Marino 1030e4b17023SJohn Marino# Documentation targets (empty). 1031e4b17023SJohn Marino.PHONY: info html dvi pdf install-info install-html install-pdf 1032e4b17023SJohn Marino 1033e4b17023SJohn Marinoinfo: 1034e4b17023SJohn Marinoinstall-info: 1035e4b17023SJohn Marinohtml: 1036e4b17023SJohn Marinoinstall-html: 1037e4b17023SJohn Marinodvi: 1038e4b17023SJohn Marinopdf: 1039e4b17023SJohn Marinoinstall-pdf: 1040e4b17023SJohn Marino 1041e4b17023SJohn Marino# Install rules. These do not depend on "all", so that they can be invoked 1042e4b17023SJohn Marino# recursively from it. 1043e4b17023SJohn Marinoinstall-libunwind: 1044e4b17023SJohn Marino $(mkinstalldirs) $(DESTDIR)$(inst_slibdir) 1045e4b17023SJohn Marino 1046e4b17023SJohn Marino # NOTE: Maybe this should go into $(inst_libdir), but this 1047e4b17023SJohn Marino # is where the old mklibgcc.in put it. 1048e4b17023SJohn Marino $(INSTALL_DATA) libunwind.a $(DESTDIR)$(inst_slibdir)/ 1049e4b17023SJohn Marino chmod 644 $(DESTDIR)$(inst_slibdir)/libunwind.a 1050e4b17023SJohn Marino $(RANLIB) $(DESTDIR)$(inst_slibdir)/libunwind.a 1051e4b17023SJohn Marino 1052e4b17023SJohn Marino $(subst @multilib_dir@,$(MULTIDIR),$(subst \ 1053e4b17023SJohn Marino @shlib_base_name@,libunwind,$(subst \ 1054e4b17023SJohn Marino @shlib_slibdir_qual@,$(MULTIOSSUBDIR),$(SHLIBUNWIND_INSTALL)))) 1055e4b17023SJohn Marino 1056e4b17023SJohn Marinoinstall-shared: 1057e4b17023SJohn Marino $(mkinstalldirs) $(DESTDIR)$(inst_libdir) 1058e4b17023SJohn Marino 1059e4b17023SJohn Marino $(INSTALL_DATA) libgcc_eh.a $(DESTDIR)$(inst_libdir)/ 1060e4b17023SJohn Marino chmod 644 $(DESTDIR)$(inst_libdir)/libgcc_eh.a 1061e4b17023SJohn Marino $(RANLIB) $(DESTDIR)$(inst_libdir)/libgcc_eh.a 1062e4b17023SJohn Marino 1063e4b17023SJohn Marino $(subst @multilib_dir@,$(MULTIDIR),$(subst \ 1064e4b17023SJohn Marino @shlib_base_name@,libgcc_s,$(subst \ 1065e4b17023SJohn Marino @shlib_slibdir_qual@,$(MULTIOSSUBDIR),$(SHLIB_INSTALL)))) 1066e4b17023SJohn Marino 1067e4b17023SJohn Marinoinstall-leaf: $(install-shared) $(install-libunwind) 1068e4b17023SJohn Marino $(mkinstalldirs) $(DESTDIR)$(inst_libdir) 1069e4b17023SJohn Marino 1070e4b17023SJohn Marino $(INSTALL_DATA) libgcc.a $(DESTDIR)$(inst_libdir)/ 1071e4b17023SJohn Marino chmod 644 $(DESTDIR)$(inst_libdir)/libgcc.a 1072e4b17023SJohn Marino $(RANLIB) $(DESTDIR)$(inst_libdir)/libgcc.a 1073e4b17023SJohn Marino $(INSTALL_DATA) libgcov.a $(DESTDIR)$(inst_libdir)/ 1074e4b17023SJohn Marino chmod 644 $(DESTDIR)$(inst_libdir)/libgcov.a 1075e4b17023SJohn Marino $(RANLIB) $(DESTDIR)$(inst_libdir)/libgcov.a 1076e4b17023SJohn Marino 1077e4b17023SJohn Marino parts="$(INSTALL_PARTS)"; \ 1078e4b17023SJohn Marino for file in $$parts; do \ 1079e4b17023SJohn Marino rm -f $(DESTDIR)$(inst_libdir)/$$file; \ 1080e4b17023SJohn Marino $(INSTALL_DATA) $$file $(DESTDIR)$(inst_libdir)/; \ 1081e4b17023SJohn Marino case $$file in \ 1082e4b17023SJohn Marino *.a) \ 1083e4b17023SJohn Marino $(RANLIB) $(gcc_objdir)$(MULTISUBDIR)/$$file ;; \ 1084e4b17023SJohn Marino esac; \ 1085e4b17023SJohn Marino done 1086e4b17023SJohn Marino 1087e4b17023SJohn Marinoinstall: install-leaf install-unwind_h 1088e4b17023SJohn Marino @: $(MAKE) ; $(MULTIDO) $(FLAGS_TO_PASS) multi-do DO=install 1089e4b17023SJohn Marino 1090e4b17023SJohn Marinoinstall-strip: install 1091e4b17023SJohn Marino 1092e4b17023SJohn Marino.PHONY: install install-shared install-libunwind install-strip 1093e4b17023SJohn Marino.PHONY: install-unwind_h install-unwind_h-forbuild 1094e4b17023SJohn Marino 1095e4b17023SJohn Marino# Don't export variables to the environment, in order to not confuse 1096e4b17023SJohn Marino# configure. 1097e4b17023SJohn Marino.NOEXPORT: 1098e4b17023SJohn Marino 1099e4b17023SJohn Marinoinclude $(srcdir)/empty.mk $(wildcard *.dep) 1100