3 # Copyright (C) 2005, 2006 Free Software Foundation
5 # This file is part of GCC.
7 # GCC is free software; you can redistribute it and/or modify it under the
8 # terms of the GNU Library General Public License as published by the Free
9 # Software Foundation; either version 2 of the License, or (at your option)
12 # GCC is distributed in the hope that it will be useful, but WITHOUT ANY
13 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
14 # FOR A PARTICULAR PURPOSE. See the GNU General Public License for
17 # You should have received a copy of the GNU General Public License along
18 # with GCC; see the file COPYING. If not, write to the Free Software
19 # Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301,
23 libgcc_topdir = @libgcc_topdir@
24 host_subdir = @host_subdir@
26 gcc_srcdir = $(libgcc_topdir)/gcc
27 gcc_objdir = $(MULTIBUILDTOP)../../$(host_subdir)/gcc
33 exec_prefix = @exec_prefix@
38 enable_shared = @enable_shared@
39 decimal_float = @decimal_float@
41 host_noncanonical = @host_noncanonical@
43 # List of extra object files that should be compiled for this target machine.
44 # The rules for compiling them should be in the t-* file for the machine.
45 EXTRA_PARTS = @extra_parts@
47 # Multilib support variables.
56 INSTALL_PROGRAM = @INSTALL_PROGRAM@
57 INSTALL_DATA = @INSTALL_DATA@
58 mkinstalldirs = $(SHELL) $(libgcc_topdir)/mkinstalldirs
72 PWD_COMMAND = $${PWDCMD-pwd}
74 # Flags to pass to a recursive make.
77 "AR_FLAGS=$(AR_FLAGS)" \
80 "DESTDIR=$(DESTDIR)" \
81 "EXTRA_OFILES=$(EXTRA_OFILES)" \
82 "HDEFINES=$(HDEFINES)" \
83 "INSTALL=$(INSTALL)" \
84 "INSTALL_DATA=$(INSTALL_DATA)" \
85 "INSTALL_PROGRAM=$(INSTALL_PROGRAM)" \
86 "LDFLAGS=$(LDFLAGS)" \
87 "LOADLIBES=$(LOADLIBES)" \
91 "exec_prefix=$(exec_prefix)" \
93 "libsubdir=$(libsubdir)" \
96 # Dependencies for "all" are set later in the file.
98 # Now that we have built all the objects, we need to copy
99 # them back to the GCC directory. Too many things (other
100 # in-tree libraries, and DejaGNU) know about the layout
101 # of the build tree, for now.
102 $(MAKE) install DESTDIR=$(gcc_objdir) \
103 slibdir= libsubdir= MULTIOSDIR=$(MULTIDIR)
107 # If this is the top-level multilib, build all the other
109 @: $(MAKE) ; exec $(MULTIDO) $(FLAGS_TO_PASS) multi-do DO=all
111 .PHONY: check installcheck
118 -rm -f config.h stamp-h stmp-ldirs libgcc.map
122 -rm -f libunwind$(SHLIB_EXT)
124 @$(MULTICLEAN) multi-clean DO=clean
126 @$(MULTICLEAN) multi-clean DO=distclean
127 -rm -f *~ Makefile config.cache config.status multilib.out
129 maintainer-clean realclean: distclean
131 Makefile: $(srcdir)/Makefile.in config.status
132 CONFIG_FILES=Makefile CONFIG_HEADERS= $(SHELL) ./config.status
134 # Depending on Makefile makes sure that config.status has been re-run
135 # if needed. This prevents problems with parallel builds.
136 config.h: stamp-h ; @true
137 stamp-h: $(srcdir)/config.in config.status Makefile
138 CONFIG_FILES= CONFIG_HEADERS=config.h:$(srcdir)/config.in $(SHELL) ./config.status
140 config.status: $(srcdir)/configure
141 $(SHELL) ./config.status --recheck
143 include $(gcc_objdir)/libgcc.mvars
145 # Flags to pass to recursive makes.
147 AR_FOR_TARGET = $(AR)
148 AR_FLAGS_FOR_TARGET =
149 AR_CREATE_FOR_TARGET = $(AR_FOR_TARGET) $(AR_FLAGS_FOR_TARGET) rc
150 AR_EXTRACT_FOR_TARGET = $(AR_FOR_TARGET) $(AR_FLAGS_FOR_TARGET) x
152 GCC_FOR_TARGET = $(CC)
154 LIPO_FOR_TARGET = $(LIPO)
155 MACHMODE_H = machmode.h mode-classes.def insn-modes.h
157 NM_FOR_TARGET = $(NM)
158 RANLIB_FOR_TARGET = $(RANLIB)
160 STRIP_FOR_TARGET = $(STRIP)
162 # Directory in which the compiler finds libraries etc.
163 libsubdir = $(libdir)/gcc/$(host_noncanonical)/$(version)
164 # Used to install the shared libgcc.
168 export AR_CREATE_FOR_TARGET
169 export AR_FLAGS_FOR_TARGET
170 export AR_EXTRACT_FOR_TARGET
173 export GCC_FOR_TARGET
177 export LIBGCC2_CFLAGS
178 export LIPO_FOR_TARGET
181 export STRIP_FOR_TARGET
182 export RANLIB_FOR_TARGET
186 version := $(shell $(CC) -dumpversion)
188 DECNUMINC = -I$(srcdir)/../libdecnumber -I$(MULTIBUILDTOP)../../libdecnumber
190 # Specify the directories to be searched for header files.
191 # Both . and srcdir are used, in that order,
192 # so that *config.h will be found in the compilation
193 # subdirectory rather than in the source directory.
194 # -I$(@D) and -I$(srcdir)/$(@D) cause the subdirectory of the file
195 # currently being compiled, in both source trees, to be examined as well.
196 INCLUDES = -I. -I$(@D) -I$(gcc_objdir) \
197 -I$(srcdir) -I$(srcdir)/$(@D) -I$(srcdir)/../gcc \
198 -I$(srcdir)/../include $(DECNUMINC)
200 # CFLAGS first is not perfect; normally setting CFLAGS should override any
201 # options in LIBGCC2_CFLAGS. But LIBGCC2_CFLAGS may contain -g0, and CFLAGS
202 # will usually contain -g, so for the moment CFLAGS goes first. We must
203 # include CFLAGS - that's where multilib options live.
204 INTERNAL_CFLAGS = $(CFLAGS) $(LIBGCC2_CFLAGS) $(HOST_LIBGCC2_CFLAGS) $(INCLUDES)
206 MULTIDIR := $(shell $(CC) $(CFLAGS) -print-multi-directory)
207 MULTIOSDIR := $(shell $(CC) $(CFLAGS) -print-multi-os-directory)
209 MULTIOSSUBDIR := $(shell if test $(MULTIOSDIR) != .; then echo /$(MULTIOSDIR); fi)
210 inst_libdir = $(libsubdir)$(MULTISUBDIR)
211 inst_slibdir = $(slibdir)$(MULTIOSSUBDIR)
213 gcc_compile_bare = $(CC) $(INTERNAL_CFLAGS)
214 compile_deps = -MT $@ -MD -MP -MF $(basename $@).dep
215 gcc_compile = $(gcc_compile_bare) -o $@ $(compile_deps)
216 gcc_s_compile = $(gcc_compile) -DSHARED
218 objects = $(filter %$(objext),$^)
220 # Collect any host-specific information from Makefile fragments.
221 tmake_file = @tmake_file@
222 include $(srcdir)/empty.mk $(tmake_file)
224 # Only handle shared libraries if both:
225 # - the user requested them
226 # - we know how to build them
227 ifeq ($(SHLIB_LINK),)
231 ifeq ($(enable_shared),yes)
232 iterator = $(srcdir)/empty.mk $(patsubst %,$(srcdir)/shared-object.mk,$(iter-items))
234 install-shared = install-shared
236 ifneq ($(LIBUNWIND),)
237 install-libunwind = install-libunwind
240 # For -fvisibility=hidden. We need both a -fvisibility=hidden on
241 # the command line, and a #define to prevent libgcc2.h etc from
242 # overriding that with #pragmas.
243 vis_hide = @vis_hide@
247 # If we have -fvisibility=hidden, then we need to generate hide
248 # lists for object files implemented in assembly.
249 ASM_HIDDEN_OP = @asm_hidden_op@
253 $(AWK) 'NF == 3 && $$2 !~ /^[UN]$$/ { print "\t$(ASM_HIDDEN_OP)", $$3 }' > $@T
257 gen-hide-list = echo > $@
262 iterator = $(srcdir)/empty.mk $(patsubst %,$(srcdir)/static-object.mk,$(iter-items))
264 gen-hide-list = echo > \$@
267 ifneq ($(EXTRA_PARTS),)
268 extra-parts = libgcc-extra-parts
269 INSTALL_PARTS = $(EXTRA_PARTS)
271 ifneq ($(GCC_EXTRA_PARTS),)
272 extra-parts = gcc-extra-parts
273 INSTALL_PARTS = $(GCC_EXTRA_PARTS)
277 # Library members defined in libgcc2.c.
278 lib2funcs = _muldi3 _negdi2 _lshrdi3 _ashldi3 _ashrdi3 _cmpdi2 _ucmpdi2 \
279 _clear_cache _enable_execute_stack _trampoline __main _absvsi2 \
280 _absvdi2 _addvsi3 _addvdi3 _subvsi3 _subvdi3 _mulvsi3 _mulvdi3 \
281 _negvsi2 _negvdi2 _ctors _ffssi2 _ffsdi2 _clz _clzsi2 _clzdi2 \
282 _ctzsi2 _ctzdi2 _popcount_tab _popcountsi2 _popcountdi2 \
283 _paritysi2 _paritydi2 _powisf2 _powidf2 _powixf2 _powitf2 \
284 _mulsc3 _muldc3 _mulxc3 _multc3 _divsc3 _divdc3 _divxc3 \
285 _divtc3 _bswapsi2 _bswapdi2
287 # The floating-point conversion routines that involve a single-word integer.
288 # XX stands for the integer mode.
289 swfloatfuncs = $(patsubst %,_fixuns%XX,sf df xf)
291 # Likewise double-word routines.
292 dwfloatfuncs = $(patsubst %,_fix%XX,sf df xf tf) \
293 $(patsubst %,_fixuns%XX,sf df xf tf) \
294 $(patsubst %,_floatXX%,sf df xf tf) \
295 $(patsubst %,_floatunXX%,sf df xf tf)
297 ifeq ($(LIB2_SIDITI_CONV_FUNCS),)
298 lib2funcs += $(subst XX,si,$(swfloatfuncs))
299 lib2funcs += $(subst XX,di,$(dwfloatfuncs))
302 # These might cause a divide overflow trap and so are compiled with
304 LIB2_DIVMOD_FUNCS = _divdi3 _moddi3 _udivdi3 _umoddi3 _udiv_w_sdiv _udivmoddi4
306 # Remove any objects from lib2funcs and LIB2_DIVMOD_FUNCS that are
307 # defined as optimized assembly code in LIB1ASMFUNCS or as C code
308 # in LIB2FUNCS_EXCLUDE.
309 lib2funcs := $(filter-out $(LIB2FUNCS_EXCLUDE) $(LIB1ASMFUNCS),$(lib2funcs))
310 LIB2_DIVMOD_FUNCS := $(filter-out $(LIB2FUNCS_EXCLUDE) $(LIB1ASMFUNCS), \
311 $(LIB2_DIVMOD_FUNCS))
313 # Build "libgcc1" (assembly) components.
314 ifeq ($(enable_shared),yes)
316 lib1asmfuncs-o = $(patsubst %,%$(objext),$(LIB1ASMFUNCS))
317 $(lib1asmfuncs-o): %$(objext): $(gcc_srcdir)/config/$(LIB1ASMSRC) %.vis
318 $(gcc_compile) -DL$* -xassembler-with-cpp \
319 -c $(gcc_srcdir)/config/$(LIB1ASMSRC) -include $*.vis
320 $(patsubst %,%.vis,$(LIB1ASMFUNCS)): %.vis: %_s$(objext)
322 libgcc-objects += $(lib1asmfuncs-o)
324 lib1asmfuncs-s-o = $(patsubst %,%_s$(objext),$(LIB1ASMFUNCS))
325 $(lib1asmfuncs-s-o): %_s$(objext): $(gcc_srcdir)/config/$(LIB1ASMSRC)
326 $(gcc_s_compile) -DL$* -xassembler-with-cpp \
327 -c $(gcc_srcdir)/config/$(LIB1ASMSRC)
328 libgcc-s-objects += $(lib1asmfuncs-s-o)
332 lib1asmfuncs-o = $(patsubst %,%$(objext),$(LIB1ASMFUNCS))
333 $(lib1asmfuncs-o): %$(objext): $(gcc_srcdir)/config/$(LIB1ASMSRC)
334 $(gcc_compile) -DL$* -xassembler-with-cpp \
335 -c $(gcc_srcdir)/config/$(LIB1ASMSRC)
336 libgcc-objects += $(lib1asmfuncs-o)
340 # Build lib2funcs. For the static library also include LIB2FUNCS_ST.
341 lib2funcs-o = $(patsubst %,%$(objext),$(lib2funcs) $(LIB2FUNCS_ST))
342 $(lib2funcs-o): %$(objext): $(gcc_srcdir)/libgcc2.c
343 $(gcc_compile) -DL$* -c $(gcc_srcdir)/libgcc2.c \
345 libgcc-objects += $(lib2funcs-o)
347 ifeq ($(enable_shared),yes)
348 lib2funcs-s-o = $(patsubst %,%_s$(objext),$(lib2funcs))
349 $(lib2funcs-s-o): %_s$(objext): $(gcc_srcdir)/libgcc2.c
350 $(gcc_s_compile) -DL$* -c $(gcc_srcdir)/libgcc2.c
351 libgcc-s-objects += $(lib2funcs-s-o)
354 ifneq ($(LIB2_SIDITI_CONV_FUNCS),)
355 # Build libgcc2.c for each conversion function, with a specific
356 # L<func> definition and LIBGCC2_UNITS_PER_WORD setting. The DImode
357 # functions are built with a wordsize of 4; the TImode functions are
358 # built with the same labels, but a wordsize of 8.
360 sifuncs = $(subst XX,si,$(swfloatfuncs))
361 difuncs = $(subst XX,di,$(dwfloatfuncs))
362 tifuncs = $(subst XX,ti,$(dwfloatfuncs))
364 iter-items := $(sifuncs) $(difuncs) $(tifuncs)
365 iter-labels := $(sifuncs) $(difuncs) $(difuncs)
366 iter-sizes := $(patsubst %,4,$(sifuncs) $(difuncs)) $(patsubst %,8,$(tifuncs))
368 include $(srcdir)/empty.mk $(patsubst %,$(srcdir)/siditi-object.mk,$(iter-items))
370 libgcc-objects += $(patsubst %,%$(objext),$(sifuncs) $(difuncs) $(tifuncs))
371 ifeq ($(enable_shared),yes)
372 libgcc-s-objects += $(patsubst %,%_s$(objext),$(sifuncs) $(difuncs) $(tifuncs))
376 # Build LIB2_DIVMOD_FUNCS.
377 lib2-divmod-o = $(patsubst %,%$(objext),$(LIB2_DIVMOD_FUNCS))
378 $(lib2-divmod-o): %$(objext): $(gcc_srcdir)/libgcc2.c
379 $(gcc_compile) -DL$* -c $(gcc_srcdir)/libgcc2.c \
380 -fexceptions -fnon-call-exceptions $(vis_hide)
381 libgcc-objects += $(lib2-divmod-o)
383 ifeq ($(enable_shared),yes)
384 lib2-divmod-s-o = $(patsubst %,%_s$(objext),$(LIB2_DIVMOD_FUNCS))
385 $(lib2-divmod-s-o): %_s$(objext): $(gcc_srcdir)/libgcc2.c
386 $(gcc_s_compile) -DL$* -c $(gcc_srcdir)/libgcc2.c \
387 -fexceptions -fnon-call-exceptions
388 libgcc-s-objects += $(lib2-divmod-s-o)
391 # $(FPBIT) et al. are pathnames relative to the GCC build
392 # directory; the supporting files are made by the GCC
394 # FIXME: Soon we will be able to move this logic into this directory.
396 ifneq ($(fpbit-in-libgcc),yes)
397 FPBIT:=$(if $(FPBIT),$(gcc_objdir)/$(FPBIT),)
398 DPBIT:=$(if $(DPBIT),$(gcc_objdir)/$(DPBIT),)
399 TPBIT:=$(if $(TPBIT),$(gcc_objdir)/$(TPBIT),)
403 # _sf_to_tf and _df_to_tf require tp-bit.c being compiled in.
404 FPBIT_FUNCS := $(filter-out _sf_to_tf,$(FPBIT_FUNCS))
405 DPBIT_FUNCS := $(filter-out _df_to_tf,$(DPBIT_FUNCS))
410 fpbit-o = $(patsubst %,%$(objext),$(FPBIT_FUNCS))
411 $(fpbit-o): %$(objext): $(FPBIT)
412 $(gcc_compile) -DFINE_GRAINED_LIBRARIES -DL$* -c $(FPBIT) $(vis_hide)
413 libgcc-objects += $(fpbit-o)
415 ifeq ($(enable_shared),yes)
416 fpbit-s-o = $(patsubst %,%_s$(objext),$(FPBIT_FUNCS))
417 $(fpbit-s-o): %_s$(objext): $(FPBIT)
418 $(gcc_s_compile) -DFINE_GRAINED_LIBRARIES -DL$* -c $(FPBIT)
419 libgcc-s-objects += $(fpbit-s-o)
425 dpbit-o = $(patsubst %,%$(objext),$(DPBIT_FUNCS))
426 $(dpbit-o): %$(objext): $(DPBIT)
427 $(gcc_compile) -DFINE_GRAINED_LIBRARIES -DL$* -c $(DPBIT) $(vis_hide)
428 libgcc-objects += $(dpbit-o)
430 ifeq ($(enable_shared),yes)
431 dpbit-s-o = $(patsubst %,%_s$(objext),$(DPBIT_FUNCS))
432 $(dpbit-s-o): %_s$(objext): $(DPBIT)
433 $(gcc_s_compile) -DFINE_GRAINED_LIBRARIES -DL$* -c $(DPBIT)
434 libgcc-s-objects += $(dpbit-s-o)
440 tpbit-o = $(patsubst %,%$(objext),$(TPBIT_FUNCS))
441 $(tpbit-o): %$(objext): $(TPBIT)
442 $(gcc_compile) -DFINE_GRAINED_LIBRARIES -DL$* -c $(TPBIT) $(vis_hide)
443 libgcc-objects += $(tpbit-o)
445 ifeq ($(enable_shared),yes)
446 tpbit-s-o = $(patsubst %,%_s$(objext),$(TPBIT_FUNCS))
447 $(tpbit-s-o): %_s$(objext): $(TPBIT)
448 $(gcc_s_compile) -DFINE_GRAINED_LIBRARIES -DL$* -c $(TPBIT)
449 libgcc-s-objects += $(tpbit-s-o)
453 # Build decimal floating point support.
454 ifeq ($(decimal_float),yes)
456 # If $DFP_ENABLE is set, then we want all data type sizes.
457 ifneq ($(DFP_ENABLE),)
464 ifneq ($(D32PBIT)$(D64PBIT)$(D128PBIT),)
465 dec-filenames += decContext decNumber decRound decLibrary decUtility
469 dec-filenames += decimal32
473 dec-filenames += decimal64
477 dec-filenames += decimal128
480 dec-objects = $(patsubst %,%$(objext),$(dec-filenames))
481 $(dec-objects): %$(objext): $(srcdir)/../libdecnumber/%.c
483 libgcc-objects += $(dec-objects)
485 # Next build individual support functions.
487 d32pbit-o = $(patsubst %,%$(objext),$(D32PBIT_FUNCS))
488 $(d32pbit-o): %$(objext): $(gcc_srcdir)/config/dfp-bit.c
489 $(gcc_compile) -DFINE_GRAINED_LIBRARIES -DL$* -DWIDTH=32 -c $<
490 libgcc-objects += $(d32pbit-o)
494 d64pbit-o = $(patsubst %,%$(objext),$(D64PBIT_FUNCS))
495 $(d64pbit-o): %$(objext): $(gcc_srcdir)/config/dfp-bit.c
496 $(gcc_compile) -DFINE_GRAINED_LIBRARIES -DL$* -DWIDTH=64 -c $<
497 libgcc-objects += $(d64pbit-o)
501 d128pbit-o = $(patsubst %,%$(objext),$(D128PBIT_FUNCS))
502 $(d128pbit-o): %$(objext): $(gcc_srcdir)/config/dfp-bit.c
503 $(gcc_compile) -DFINE_GRAINED_LIBRARIES -DL$* -DWIDTH=128 -c $<
504 libgcc-objects += $(d128pbit-o)
509 # Build LIB2ADD and LIB2ADD_ST.
510 ifneq ($(filter-out %.c %.S %.asm,$(LIB2ADD) $(LIB2ADD_ST)),)
511 $(error Unsupported files in LIB2ADD or LIB2ADD_ST.)
514 libgcc-objects += $(addsuffix $(objext),$(basename $(notdir $(LIB2ADD))))
515 libgcc-objects += $(addsuffix $(objext),$(basename $(notdir $(LIB2ADD_ST))))
518 iter-items := $(LIB2ADD) $(LIB2ADD_ST)
521 ifeq ($(enable_shared),yes)
522 libgcc-s-objects += $(addsuffix _s$(objext),$(basename $(notdir $(LIB2ADD))))
525 # Build LIB2ADDEH, LIB2ADDEHSTATIC, and LIB2ADDEHSHARED. If we don't have
526 # libgcc_eh.a, only LIB2ADDEH matters. If we do, only LIB2ADDEHSTATIC and
527 # LIB2ADDEHSHARED matter. (Usually all three are identical.)
529 c_flags := -fexceptions
531 ifeq ($(enable_shared),yes)
533 libgcc-eh-objects += $(addsuffix $(objext),$(basename $(notdir $(LIB2ADDEHSTATIC))))
534 libgcc-s-objects += $(addsuffix _s$(objext),$(basename $(notdir $(LIB2ADDEHSHARED))))
536 iter-items := $(sort $(LIB2ADDEHSTATIC) $(LIB2ADDEHSHARED))
540 # Not shared. LIB2ADDEH are added to libgcc.a.
542 libgcc-objects += $(addsuffix $(objext),$(basename $(notdir $(LIB2ADDEH))))
544 iter-items := $(LIB2ADDEH)
551 c_flags := -fexceptions
553 libunwind-objects += $(addsuffix $(objext),$(basename $(notdir $(LIBUNWIND))))
555 ifeq ($(enable_shared),yes)
556 libunwind-s-objects += $(addsuffix _s$(objext),$(basename $(notdir $(LIBUNWIND))))
559 iter-items := $(LIBUNWIND)
562 # Build libgcov components.
563 libgcov-objects = $(patsubst %,%$(objext),$(LIBGCOV))
564 $(libgcov-objects): %$(objext): $(gcc_srcdir)/libgcov.c
565 $(gcc_compile) -DL$* -c $(gcc_srcdir)/libgcov.c
569 libgcc.a: $(libgcc-objects)
570 libgcov.a: $(libgcov-objects)
571 libunwind.a: $(libunwind-objects)
572 libgcc_eh.a: $(libgcc-eh-objects)
574 libgcc.a libgcov.a libunwind.a libgcc_eh.a:
577 objects="$(objects)"; \
578 if test -z "$$objects"; then \
579 echo 'int __libgcc_eh_dummy;' > eh_dummy.c; \
580 $(gcc_compile_bare) $(vis_hide) -c eh_dummy.c \
581 -o eh_dummy$(objext); \
582 objects=eh_dummy$(objext); \
584 $(AR_CREATE_FOR_TARGET) $@ $$objects
588 all: libgcc.a libgcov.a
590 ifneq ($(LIBUNWIND),)
594 ifeq ($(enable_shared),yes)
595 all: libgcc_eh.a libgcc_s$(SHLIB_EXT)
596 ifneq ($(LIBUNWIND),)
597 all: libunwind$(SHLIB_EXT)
601 ifeq ($(enable_shared),yes)
603 # Map-file generation.
604 ifneq ($(SHLIB_MKMAP),)
605 libgcc.map: $(SHLIB_MKMAP) $(SHLIB_MAPFILES) $(libgcc-s-objects)
606 { $(NM) $(SHLIB_NM_FLAGS) $(libgcc-s-objects); echo %%; \
607 cat $(SHLIB_MAPFILES) \
608 | sed -e '/^[ ]*#/d' \
609 -e 's/^%\(if\|else\|elif\|endif\|define\)/#\1/' \
610 | $(gcc_compile_bare) -E -xassembler-with-cpp -; \
611 } | $(AWK) -f $(SHLIB_MKMAP) $(SHLIB_MKMAP_OPTS) > tmp-$@
613 libgcc_s$(SHLIB_EXT): libgcc.map
617 libgcc_s$(SHLIB_EXT): $(libgcc-s-objects) $(extra-parts)
618 # @multilib_flags@ is still needed because this may use
619 # $(GCC_FOR_TARGET) and $(LIBGCC2_CFLAGS) directly.
620 # @multilib_dir@ is not really necessary, but sometimes it has
621 # more uses than just a directory name.
622 $(mkinstalldirs) $(MULTIDIR)
623 $(subst @multilib_flags@,$(CFLAGS),$(subst \
624 @multilib_dir@,$(MULTIDIR),$(subst \
625 @shlib_objs@,$(objects),$(subst \
626 @shlib_base_name@,libgcc_s,$(subst \
627 @shlib_map_file@,$(mapfile),$(subst \
628 @shlib_slibdir_qual@,$(MULTIOSSUBDIR),$(SHLIB_LINK)))))))
630 libunwind$(SHLIB_EXT): $(libunwind-s-objects) $(extra-parts)
631 # @multilib_flags@ is still needed because this may use
632 # $(GCC_FOR_TARGET) and $(LIBGCC2_CFLAGS) directly.
633 # @multilib_dir@ is not really necessary, but sometimes it has
634 # more uses than just a directory name.
635 $(mkinstalldirs) $(MULTIDIR)
636 $(subst @multilib_flags@,$(CFLAGS),$(subst \
637 @multilib_dir@,$(MULTIDIR),$(subst \
638 @shlib_objs@,$(objects),$(subst \
639 @shlib_base_name@,libunwind,$(subst \
640 @shlib_slibdir_qual@,$(MULTIOSSUBDIR),$(SHLIBUNWIND_LINK))))))
644 # Build the standard GCC startfiles and endfiles.
645 ALL_CRT_CFLAGS = $(CFLAGS) $(CRTSTUFF_CFLAGS) $(INCLUDES)
646 crt_compile = $(CC) $(ALL_CRT_CFLAGS) -o $@ $(compile_deps)
648 ifeq ($(CUSTOM_CRTSTUFF),)
649 crtbegin$(objext): $(gcc_srcdir)/crtstuff.c
650 $(crt_compile) $(CRTSTUFF_T_CFLAGS) \
651 -c $(gcc_srcdir)/crtstuff.c -DCRT_BEGIN
653 crtend$(objext): $(gcc_srcdir)/crtstuff.c
654 $(crt_compile) $(CRTSTUFF_T_CFLAGS) \
655 -c $(gcc_srcdir)/crtstuff.c -DCRT_END
657 # These are versions of crtbegin and crtend for shared libraries.
658 crtbeginS$(objext): $(gcc_srcdir)/crtstuff.c
659 $(crt_compile) $(CRTSTUFF_T_CFLAGS_S) \
660 -c $(gcc_srcdir)/crtstuff.c -DCRT_BEGIN -DCRTSTUFFS_O
662 crtendS$(objext): $(gcc_srcdir)/crtstuff.c
663 $(crt_compile) $(CRTSTUFF_T_CFLAGS_S) \
664 -c $(gcc_srcdir)/crtstuff.c -DCRT_END -DCRTSTUFFS_O
666 # This is a version of crtbegin for -static links.
667 crtbeginT.o: $(gcc_srcdir)/crtstuff.c
668 $(crt_compile) $(CRTSTUFF_T_CFLAGS) \
669 -c $(gcc_srcdir)/crtstuff.c -DCRT_BEGIN -DCRTSTUFFT_O
672 # Build extra startfiles in the libgcc directory.
673 .PHONY: libgcc-extra-parts
674 libgcc-extra-parts: $(EXTRA_PARTS)
675 ifneq ($(GCC_EXTRA_PARTS),)
676 ifneq ($(sort $(EXTRA_PARTS)),$(GCC_EXTRA_PARTS))
677 # If the gcc directory specifies which extra parts to
678 # build for this target, and the libgcc configuration also
679 # specifies, make sure they match. This can be removed
680 # when the gcc directory no longer holds libgcc configuration;
681 # it is useful when migrating a target.
682 @echo "Configuration mismatch!"
683 @echo "Extra parts from gcc directory: $(GCC_EXTRA_PARTS)"
684 @echo "Extra parts from libgcc: $(EXTRA_PARTS)"
689 # Early copyback; see "all" above for the rationale. The
690 # early copy is necessary so that the gcc -B options find
691 # the right startup files when linking shared libgcc.
692 $(mkinstalldirs) $(gcc_objdir)$(MULTISUBDIR)
693 parts="$(EXTRA_PARTS)"; \
694 for file in $$parts; do \
695 rm -f $(gcc_objdir)$(MULTISUBDIR)/$$file; \
696 $(INSTALL_DATA) $$file $(gcc_objdir)$(MULTISUBDIR)/; \
699 # Build extra startfiles in the gcc directory, for unconverted
701 .PHONY: gcc-extra-parts
703 # Recursively invoke make in the GCC directory to build any
704 # startfiles (for now). We must do this just once, passing
705 # it all the GCC_EXTRA_PARTS as simultaneous goal targets,
706 # so that rules which cannot execute simultaneously are properly
707 # serialized. We indirect through T_TARGET in case any multilib
708 # directories contain an equals sign, to prevent make from
709 # interpreting any of the goals as variable assignments.
711 # We must use cd && make rather than make -C, or else the stage
712 # number will be embedded in debug information.
714 T=`$(PWD_COMMAND)`/ \
715 && cd $(gcc_objdir) \
716 && $(MAKE) GCC_FOR_TARGET="$(CC)" \
717 MULTILIB_CFLAGS="$(CFLAGS)" \
719 T_TARGET="$(patsubst %,$${T}%,$(GCC_EXTRA_PARTS))" \
722 # Early copyback; see "all" above for the rationale. The
723 # early copy is necessary so that the gcc -B options find
724 # the right startup files when linking shared libgcc.
725 $(mkinstalldirs) $(gcc_objdir)$(MULTISUBDIR)
726 parts="$(GCC_EXTRA_PARTS)"; \
727 for file in $$parts; do \
728 rm -f $(gcc_objdir)$(MULTISUBDIR)/$$file; \
729 $(INSTALL_DATA) $$file $(gcc_objdir)$(MULTISUBDIR)/; \
734 # Install rules. These do not depend on "all", so that they can be invoked
735 # recursively from it.
737 $(mkinstalldirs) $(DESTDIR)$(inst_slibdir)
739 # NOTE: Maybe this should go into $(inst_libdir), but this
740 # is where the old mklibgcc.in put it.
741 $(INSTALL_DATA) libunwind.a $(DESTDIR)$(inst_slibdir)/
742 chmod 644 $(DESTDIR)$(inst_slibdir)/libunwind.a
743 $(RANLIB) $(DESTDIR)$(inst_slibdir)/libunwind.a
745 $(subst @multilib_dir@,$(MULTIDIR),$(subst \
746 @shlib_base_name@,libunwind,$(subst \
747 @shlib_slibdir_qual@,$(MULTIOSSUBDIR),$(SHLIBUNWIND_INSTALL))))
750 $(mkinstalldirs) $(DESTDIR)$(inst_libdir)
752 $(INSTALL_DATA) libgcc_eh.a $(DESTDIR)$(inst_libdir)/
753 chmod 644 $(DESTDIR)$(inst_libdir)/libgcc_eh.a
754 $(RANLIB) $(DESTDIR)$(inst_libdir)/libgcc_eh.a
756 $(subst @multilib_dir@,$(MULTIDIR),$(subst \
757 @shlib_base_name@,libgcc_s,$(subst \
758 @shlib_slibdir_qual@,$(MULTIOSSUBDIR),$(SHLIB_INSTALL))))
760 install: $(install-shared) $(install-libunwind)
761 $(mkinstalldirs) $(DESTDIR)$(inst_libdir)
763 $(INSTALL_DATA) libgcc.a $(DESTDIR)$(inst_libdir)/
764 chmod 644 $(DESTDIR)$(inst_libdir)/libgcc.a
765 $(RANLIB) $(DESTDIR)$(inst_libdir)/libgcc.a
766 $(INSTALL_DATA) libgcov.a $(DESTDIR)$(inst_libdir)/
767 chmod 644 $(DESTDIR)$(inst_libdir)/libgcov.a
768 $(RANLIB) $(DESTDIR)$(inst_libdir)/libgcov.a
770 parts="$(INSTALL_PARTS)"; \
771 for file in $$parts; do \
772 rm -f $(DESTDIR)$(inst_libdir)/$$file; \
773 $(INSTALL_DATA) $$file $(DESTDIR)$(inst_libdir)/; \
776 .PHONY: install install-shared install-libunwind
778 # Don't export variables to the environment, in order to not confuse
782 include $(srcdir)/empty.mk $(wildcard *.dep)
785 # Garbage collect in gcc/:
786 # $(LIBGCC) settings in t-* are now unused
788 # Remove use of $(gcc_srcdir). Source files referenced using $(gcc_srcdir)
789 # should move into the libgcc directory.