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@
40 enable_decimal_float
= @enable_decimal_float@
42 host_noncanonical
= @host_noncanonical@
44 # List of extra object files that should be compiled for this target machine.
45 # The rules for compiling them should be in the t-* file for the machine.
46 EXTRA_PARTS
= @extra_parts@
48 # Multilib support variables.
57 INSTALL_PROGRAM
= @INSTALL_PROGRAM@
58 INSTALL_DATA
= @INSTALL_DATA@
59 mkinstalldirs
= $(SHELL
) $(libgcc_topdir
)/mkinstalldirs
71 PWD_COMMAND
= $${PWDCMD-pwd
}
73 # Flags to pass to a recursive make.
76 "AR_FLAGS=$(AR_FLAGS)" \
79 "DESTDIR=$(DESTDIR)" \
80 "EXTRA_OFILES=$(EXTRA_OFILES)" \
81 "HDEFINES=$(HDEFINES)" \
82 "INSTALL=$(INSTALL)" \
83 "INSTALL_DATA=$(INSTALL_DATA)" \
84 "INSTALL_PROGRAM=$(INSTALL_PROGRAM)" \
85 "LDFLAGS=$(LDFLAGS)" \
86 "LOADLIBES=$(LOADLIBES)" \
90 "exec_prefix=$(exec_prefix)" \
92 "libsubdir=$(libsubdir)" \
95 # Dependencies for "all" are set later in the file.
97 # Now that we have built all the objects, we need to copy
98 # them back to the GCC directory. Too many things (other
99 # in-tree libraries, and DejaGNU) know about the layout
100 # of the build tree, for now.
101 $(MAKE
) install DESTDIR
=$(gcc_objdir
) \
102 slibdir
= libsubdir
= MULTIOSDIR
=$(MULTIDIR
)
106 # If this is the top-level multilib, build all the other
108 @
: $(MAKE
) ; exec
$(MULTIDO
) $(FLAGS_TO_PASS
) multi-do DO
=all
110 .PHONY
: check installcheck
117 -rm -f config.h stamp-h stmp-ldirs libgcc.map
121 -rm -f libunwind
$(SHLIB_EXT
)
123 @
$(MULTICLEAN
) multi-clean DO
=clean
125 @
$(MULTICLEAN
) multi-clean DO
=distclean
126 -rm -f
*~ Makefile config.cache config.status multilib.out
128 maintainer-clean
realclean: distclean
130 Makefile
: $(srcdir)/Makefile.in config.status
131 CONFIG_FILES
=Makefile CONFIG_HEADERS
= $(SHELL
) .
/config.status
133 # Depending on Makefile makes sure that config.status has been re-run
134 # if needed. This prevents problems with parallel builds.
135 config.h
: stamp-h
; @true
136 stamp-h
: $(srcdir)/config.in config.status Makefile
137 CONFIG_FILES
= CONFIG_HEADERS
=config.h
:$(srcdir)/config.in
$(SHELL
) .
/config.status
139 config.status
: $(srcdir)/configure
140 $(SHELL
) .
/config.status
--recheck
142 include $(gcc_objdir
)/libgcc.mvars
144 # Flags to pass to recursive makes.
146 AR_FOR_TARGET
= $(AR
)
147 AR_FLAGS_FOR_TARGET
=
148 AR_CREATE_FOR_TARGET
= $(AR_FOR_TARGET
) $(AR_FLAGS_FOR_TARGET
) rc
149 AR_EXTRACT_FOR_TARGET
= $(AR_FOR_TARGET
) $(AR_FLAGS_FOR_TARGET
) x
151 GCC_FOR_TARGET
= $(CC
)
153 LIPO_FOR_TARGET
= $(LIPO
)
154 MACHMODE_H
= machmode.h mode-classes.def insn-modes.h
156 NM_FOR_TARGET
= $(NM
)
157 RANLIB_FOR_TARGET
= $(RANLIB
)
159 STRIP_FOR_TARGET
= $(STRIP
)
161 # Directory in which the compiler finds libraries etc.
162 libsubdir
= $(libdir)/gcc
/$(host_noncanonical
)/$(version
)
163 # Used to install the shared libgcc.
167 export AR_CREATE_FOR_TARGET
168 export AR_FLAGS_FOR_TARGET
169 export AR_EXTRACT_FOR_TARGET
172 export GCC_FOR_TARGET
176 export LIBGCC2_CFLAGS
177 export LIPO_FOR_TARGET
180 export STRIP_FOR_TARGET
181 export RANLIB_FOR_TARGET
185 version
:= $(shell $(CC
) -dumpversion
)
187 ifeq ($(decimal_float
),yes
)
188 ifeq ($(enable_decimal_float
),bid
)
189 DECNUMINC
= -I
$(srcdir)/config
/libbid
-DENABLE_DECIMAL_BID_FORMAT
191 DECNUMINC
= -I
$(srcdir)/..
/libdecnumber
/$(enable_decimal_float
) \
192 -I
$(srcdir)/..
/libdecnumber \
193 -I
$(MULTIBUILDTOP
)..
/..
/libdecnumber
199 # Specify the directories to be searched for header files.
200 # Both . and srcdir are used, in that order,
201 # so that *config.h will be found in the compilation
202 # subdirectory rather than in the source directory.
203 # -I$(@D) and -I$(srcdir)/$(@D) cause the subdirectory of the file
204 # currently being compiled, in both source trees, to be examined as well.
205 INCLUDES
= -I.
-I
$(@D
) -I
$(gcc_objdir
) \
206 -I
$(srcdir) -I
$(srcdir)/$(@D
) -I
$(srcdir)/..
/gcc \
207 -I
$(srcdir)/..
/include $(DECNUMINC
)
209 # Forcibly remove any profiling-related flags. There is no point
210 # in supporting profiled bootstrap in this library.
211 override CFLAGS
:= $(filter-out -fprofile-generate
-fprofile-use
,$(CFLAGS
))
213 # CFLAGS first is not perfect; normally setting CFLAGS should override any
214 # options in LIBGCC2_CFLAGS. But LIBGCC2_CFLAGS may contain -g0, and CFLAGS
215 # will usually contain -g, so for the moment CFLAGS goes first. We must
216 # include CFLAGS - that's where multilib options live.
217 INTERNAL_CFLAGS
= $(CFLAGS
) $(LIBGCC2_CFLAGS
) $(HOST_LIBGCC2_CFLAGS
) $(INCLUDES
)
219 MULTIDIR
:= $(shell $(CC
) $(CFLAGS
) -print-multi-directory
)
220 MULTIOSDIR
:= $(shell $(CC
) $(CFLAGS
) -print-multi-os-directory
)
222 MULTIOSSUBDIR
:= $(shell if
test $(MULTIOSDIR
) != .
; then echo
/$(MULTIOSDIR
); fi
)
223 inst_libdir
= $(libsubdir
)$(MULTISUBDIR
)
224 inst_slibdir
= $(slibdir
)$(MULTIOSSUBDIR
)
226 gcc_compile_bare
= $(CC
) $(INTERNAL_CFLAGS
)
227 compile_deps
= -MT
$@
-MD
-MP
-MF
$(basename $@
).dep
228 gcc_compile
= $(gcc_compile_bare
) -o
$@
$(compile_deps
)
229 gcc_s_compile
= $(gcc_compile
) -DSHARED
231 objects
= $(filter %$(objext
),$^
)
233 # Collect any host-specific information from Makefile fragments.
234 tmake_file
= @tmake_file@
235 include $(srcdir)/empty.mk
$(tmake_file
)
237 # Only handle shared libraries if both:
238 # - the user requested them
239 # - we know how to build them
240 ifeq ($(SHLIB_LINK
),)
244 ifeq ($(enable_shared
),yes
)
245 iterator
= $(srcdir)/empty.mk
$(patsubst %,$(srcdir)/shared-object.mk
,$(iter-items
))
247 install-shared
= install-shared
249 ifneq ($(LIBUNWIND
),)
250 install-libunwind
= install-libunwind
253 # For -fvisibility=hidden. We need both a -fvisibility=hidden on
254 # the command line, and a #define to prevent libgcc2.h etc from
255 # overriding that with #pragmas.
256 vis_hide
= @vis_hide@
260 # If we have -fvisibility=hidden, then we need to generate hide
261 # lists for object files implemented in assembly.
262 ASM_HIDDEN_OP
= @asm_hidden_op@
266 $(AWK
) 'NF == 3 && $$2 !~ /^[UN]$$/ { print "\t$(ASM_HIDDEN_OP)", $$3 }' > $@T
270 gen-hide-list
= echo
> $@
275 iterator
= $(srcdir)/empty.mk
$(patsubst %,$(srcdir)/static-object.mk
,$(iter-items
))
277 gen-hide-list
= echo
> \
$@
280 ifneq ($(EXTRA_PARTS
),)
281 extra-parts
= libgcc-extra-parts
282 INSTALL_PARTS
= $(EXTRA_PARTS
)
284 ifneq ($(GCC_EXTRA_PARTS
),)
285 extra-parts
= gcc-extra-parts
286 INSTALL_PARTS
= $(GCC_EXTRA_PARTS
)
290 # Library members defined in libgcc2.c.
291 lib2funcs
= _muldi3 _negdi2 _lshrdi3 _ashldi3 _ashrdi3 _cmpdi2 _ucmpdi2 \
292 _clear_cache _enable_execute_stack _trampoline __main _absvsi2 \
293 _absvdi2 _addvsi3 _addvdi3 _subvsi3 _subvdi3 _mulvsi3 _mulvdi3 \
294 _negvsi2 _negvdi2 _ctors _ffssi2 _ffsdi2 _clz _clzsi2 _clzdi2 \
295 _ctzsi2 _ctzdi2 _popcount_tab _popcountsi2 _popcountdi2 \
296 _paritysi2 _paritydi2 _powisf2 _powidf2 _powixf2 _powitf2 \
297 _mulsc3 _muldc3 _mulxc3 _multc3 _divsc3 _divdc3 _divxc3 \
298 _divtc3 _bswapsi2 _bswapdi2
300 # The floating-point conversion routines that involve a single-word integer.
301 # XX stands for the integer mode.
302 swfloatfuncs
= $(patsubst %,_fixuns
%XX
,sf df xf
)
304 # Likewise double-word routines.
305 dwfloatfuncs
= $(patsubst %,_fix
%XX
,sf df xf tf
) \
306 $(patsubst %,_fixuns
%XX
,sf df xf tf
) \
307 $(patsubst %,_floatXX
%,sf df xf tf
) \
308 $(patsubst %,_floatunXX
%,sf df xf tf
)
310 ifeq ($(LIB2_SIDITI_CONV_FUNCS
),)
311 lib2funcs
+= $(subst XX
,si
,$(swfloatfuncs
))
312 lib2funcs
+= $(subst XX
,di
,$(dwfloatfuncs
))
315 # These might cause a divide overflow trap and so are compiled with
317 LIB2_DIVMOD_FUNCS
= _divdi3 _moddi3 _udivdi3 _umoddi3 _udiv_w_sdiv _udivmoddi4
319 # Remove any objects from lib2funcs and LIB2_DIVMOD_FUNCS that are
320 # defined as optimized assembly code in LIB1ASMFUNCS or as C code
321 # in LIB2FUNCS_EXCLUDE.
322 lib2funcs
:= $(filter-out $(LIB2FUNCS_EXCLUDE
) $(LIB1ASMFUNCS
),$(lib2funcs
))
323 LIB2_DIVMOD_FUNCS
:= $(filter-out $(LIB2FUNCS_EXCLUDE
) $(LIB1ASMFUNCS
), \
324 $(LIB2_DIVMOD_FUNCS
))
326 # Build "libgcc1" (assembly) components.
327 ifeq ($(enable_shared
),yes
)
329 lib1asmfuncs-o
= $(patsubst %,%$(objext
),$(LIB1ASMFUNCS
))
330 $(lib1asmfuncs-o
): %$(objext
): $(gcc_srcdir
)/config
/$(LIB1ASMSRC
) %.vis
331 $(gcc_compile
) -DL
$* -xassembler-with-cpp \
332 -c
$(gcc_srcdir
)/config
/$(LIB1ASMSRC
) -include $*.vis
333 $(patsubst %,%.vis
,$(LIB1ASMFUNCS
)): %.vis
: %_s
$(objext
)
335 libgcc-objects
+= $(lib1asmfuncs-o
)
337 lib1asmfuncs-s-o
= $(patsubst %,%_s
$(objext
),$(LIB1ASMFUNCS
))
338 $(lib1asmfuncs-s-o
): %_s
$(objext
): $(gcc_srcdir
)/config
/$(LIB1ASMSRC
)
339 $(gcc_s_compile
) -DL
$* -xassembler-with-cpp \
340 -c
$(gcc_srcdir
)/config
/$(LIB1ASMSRC
)
341 libgcc-s-objects
+= $(lib1asmfuncs-s-o
)
345 lib1asmfuncs-o
= $(patsubst %,%$(objext
),$(LIB1ASMFUNCS
))
346 $(lib1asmfuncs-o
): %$(objext
): $(gcc_srcdir
)/config
/$(LIB1ASMSRC
)
347 $(gcc_compile
) -DL
$* -xassembler-with-cpp \
348 -c
$(gcc_srcdir
)/config
/$(LIB1ASMSRC
)
349 libgcc-objects
+= $(lib1asmfuncs-o
)
353 # Build lib2funcs. For the static library also include LIB2FUNCS_ST.
354 lib2funcs-o
= $(patsubst %,%$(objext
),$(lib2funcs
) $(LIB2FUNCS_ST
))
355 $(lib2funcs-o
): %$(objext
): $(gcc_srcdir
)/libgcc2.c
356 $(gcc_compile
) -DL
$* -c
$(gcc_srcdir
)/libgcc2.c \
358 libgcc-objects
+= $(lib2funcs-o
)
360 ifeq ($(enable_shared
),yes
)
361 lib2funcs-s-o
= $(patsubst %,%_s
$(objext
),$(lib2funcs
))
362 $(lib2funcs-s-o
): %_s
$(objext
): $(gcc_srcdir
)/libgcc2.c
363 $(gcc_s_compile
) -DL
$* -c
$(gcc_srcdir
)/libgcc2.c
364 libgcc-s-objects
+= $(lib2funcs-s-o
)
367 ifneq ($(LIB2_SIDITI_CONV_FUNCS
),)
368 # Build libgcc2.c for each conversion function, with a specific
369 # L<func> definition and LIBGCC2_UNITS_PER_WORD setting. The DImode
370 # functions are built with a wordsize of 4; the TImode functions are
371 # built with the same labels, but a wordsize of 8.
373 sifuncs
= $(subst XX
,si
,$(swfloatfuncs
))
374 difuncs
= $(subst XX
,di
,$(dwfloatfuncs
))
375 tifuncs
= $(subst XX
,ti
,$(dwfloatfuncs
))
377 iter-items
:= $(sifuncs
) $(difuncs
) $(tifuncs
)
378 iter-labels
:= $(sifuncs
) $(difuncs
) $(difuncs
)
379 iter-sizes
:= $(patsubst %,4,$(sifuncs
) $(difuncs
)) $(patsubst %,8,$(tifuncs
))
381 include $(srcdir)/empty.mk
$(patsubst %,$(srcdir)/siditi-object.mk
,$(iter-items
))
383 libgcc-objects
+= $(patsubst %,%$(objext
),$(sifuncs
) $(difuncs
) $(tifuncs
))
384 ifeq ($(enable_shared
),yes
)
385 libgcc-s-objects
+= $(patsubst %,%_s
$(objext
),$(sifuncs
) $(difuncs
) $(tifuncs
))
389 # Build LIB2_DIVMOD_FUNCS.
390 lib2-divmod-o
= $(patsubst %,%$(objext
),$(LIB2_DIVMOD_FUNCS
))
391 $(lib2-divmod-o
): %$(objext
): $(gcc_srcdir
)/libgcc2.c
392 $(gcc_compile
) -DL
$* -c
$(gcc_srcdir
)/libgcc2.c \
393 -fexceptions
-fnon-call-exceptions
$(vis_hide
)
394 libgcc-objects
+= $(lib2-divmod-o
)
396 ifeq ($(enable_shared
),yes
)
397 lib2-divmod-s-o
= $(patsubst %,%_s
$(objext
),$(LIB2_DIVMOD_FUNCS
))
398 $(lib2-divmod-s-o
): %_s
$(objext
): $(gcc_srcdir
)/libgcc2.c
399 $(gcc_s_compile
) -DL
$* -c
$(gcc_srcdir
)/libgcc2.c \
400 -fexceptions
-fnon-call-exceptions
401 libgcc-s-objects
+= $(lib2-divmod-s-o
)
404 # $(FPBIT) et al. are pathnames relative to the GCC build
405 # directory; the supporting files are made by the GCC
407 # FIXME: Soon we will be able to move this logic into this directory.
409 ifneq ($(fpbit-in-libgcc
),yes
)
410 FPBIT
:=$(if
$(FPBIT
),$(gcc_objdir
)/$(FPBIT
),)
411 DPBIT
:=$(if
$(DPBIT
),$(gcc_objdir
)/$(DPBIT
),)
412 TPBIT
:=$(if
$(TPBIT
),$(gcc_objdir
)/$(TPBIT
),)
416 # _sf_to_tf and _df_to_tf require tp-bit.c being compiled in.
417 FPBIT_FUNCS
:= $(filter-out _sf_to_tf
,$(FPBIT_FUNCS
))
418 DPBIT_FUNCS
:= $(filter-out _df_to_tf
,$(DPBIT_FUNCS
))
423 fpbit-o
= $(patsubst %,%$(objext
),$(FPBIT_FUNCS
))
424 $(fpbit-o
): %$(objext
): $(FPBIT
)
425 $(gcc_compile
) -DFINE_GRAINED_LIBRARIES
-DL
$* -c
$(FPBIT
) $(vis_hide
)
426 libgcc-objects
+= $(fpbit-o
)
428 ifeq ($(enable_shared
),yes
)
429 fpbit-s-o
= $(patsubst %,%_s
$(objext
),$(FPBIT_FUNCS
))
430 $(fpbit-s-o
): %_s
$(objext
): $(FPBIT
)
431 $(gcc_s_compile
) -DFINE_GRAINED_LIBRARIES
-DL
$* -c
$(FPBIT
)
432 libgcc-s-objects
+= $(fpbit-s-o
)
438 dpbit-o
= $(patsubst %,%$(objext
),$(DPBIT_FUNCS
))
439 $(dpbit-o
): %$(objext
): $(DPBIT
)
440 $(gcc_compile
) -DFINE_GRAINED_LIBRARIES
-DL
$* -c
$(DPBIT
) $(vis_hide
)
441 libgcc-objects
+= $(dpbit-o
)
443 ifeq ($(enable_shared
),yes
)
444 dpbit-s-o
= $(patsubst %,%_s
$(objext
),$(DPBIT_FUNCS
))
445 $(dpbit-s-o
): %_s
$(objext
): $(DPBIT
)
446 $(gcc_s_compile
) -DFINE_GRAINED_LIBRARIES
-DL
$* -c
$(DPBIT
)
447 libgcc-s-objects
+= $(dpbit-s-o
)
453 tpbit-o
= $(patsubst %,%$(objext
),$(TPBIT_FUNCS
))
454 $(tpbit-o
): %$(objext
): $(TPBIT
)
455 $(gcc_compile
) -DFINE_GRAINED_LIBRARIES
-DL
$* -c
$(TPBIT
) $(vis_hide
)
456 libgcc-objects
+= $(tpbit-o
)
458 ifeq ($(enable_shared
),yes
)
459 tpbit-s-o
= $(patsubst %,%_s
$(objext
),$(TPBIT_FUNCS
))
460 $(tpbit-s-o
): %_s
$(objext
): $(TPBIT
)
461 $(gcc_s_compile
) -DFINE_GRAINED_LIBRARIES
-DL
$* -c
$(TPBIT
)
462 libgcc-s-objects
+= $(tpbit-s-o
)
466 # Build decimal floating point support.
467 ifeq ($(decimal_float
),yes
)
469 # If $DFP_ENABLE is set, then we want all data type sizes.
470 ifneq ($(DFP_ENABLE
),)
477 ifneq ($(D32PBIT
)$(D64PBIT
)$(D128PBIT
),)
478 ifeq ($(enable_decimal_float
),bid
)
479 dfp-filenames
+= decimal_globals decimal_data binarydecimal \
480 _isinfd32 _isinfd64 _isinfd128 bid64_noncomp \
481 bid128_fma bid_round bid_from_int convert_data \
482 bid64_add bid128_add bid64_div bid128_div \
483 bid64_mul bid128_mul bid64_compare bid128_compare \
484 bid128 bid32_to_bid64 bid32_to_bid128 bid64_to_bid128 \
485 bid64_to_int32 bid64_to_int64 \
486 bid64_to_uint32 bid64_to_uint64 \
487 bid128_to_int32 bid128_to_int64 \
488 bid128_to_uint32 bid128_to_uint64
490 dfp-filenames
+= decContext decNumber decExcept decRound decLibrary decUtility
494 dfp-objects
= $(patsubst %,%$(objext
),$(dfp-filenames
))
495 ifeq ($(enable_decimal_float
),bid
)
496 $(dfp-objects
): %$(objext
): $(srcdir)/config
/libbid
/%.c
498 $(dfp-objects
): %$(objext
): $(srcdir)/..
/libdecnumber
/%.c
501 libgcc-objects
+= $(dfp-objects
)
504 ifneq ($(enable_decimal_float
),bid
)
506 decbits-filenames
+= decimal32
510 decbits-filenames
+= decimal64
514 decbits-filenames
+= decimal128
518 decbits-objects
= $(patsubst %,%$(objext
),$(decbits-filenames
))
519 ifeq ($(enable_decimal_float
),bid
)
520 $(decbits-objects
): %$(objext
): $(srcdir)/config
/libbid
/%.c
522 $(decbits-objects
): %$(objext
): $(srcdir)/..
/libdecnumber
/$(enable_decimal_float
)/%.c
525 libgcc-objects
+= $(decbits-objects
)
527 # Next build individual support functions.
528 ifeq ($(enable_decimal_float
),bid
)
530 D32PBIT_FUNCS
:=$(filter-out _plus_sd _minus_sd _conv_sd
, $(D32PBIT_FUNCS
))
534 D64PBIT_FUNCS
:=$(filter-out _plus_dd _minus_dd _conv_dd
, $(D64PBIT_FUNCS
))
538 D128PBIT_FUNCS
:=$(filter-out _plus_td _minus_td _conv_td
, $(D128PBIT_FUNCS
))
543 d32pbit-o
= $(patsubst %,%$(objext
),$(D32PBIT_FUNCS
))
544 ifeq ($(enable_decimal_float
),bid
)
545 $(d32pbit-o
): %$(objext
): $(srcdir)/config
/libbid
/%.c
547 $(d32pbit-o
): %$(objext
): $(gcc_srcdir
)/config
/dfp-bit.c
549 $(gcc_compile
) -DFINE_GRAINED_LIBRARIES
-DL
$* -DWIDTH
=32 -c
$<
550 libgcc-objects
+= $(d32pbit-o
)
554 d64pbit-o
= $(patsubst %,%$(objext
),$(D64PBIT_FUNCS
))
555 ifeq ($(enable_decimal_float
),bid
)
556 $(d64pbit-o
): %$(objext
): $(srcdir)/config
/libbid
/%.c
558 $(d64pbit-o
): %$(objext
): $(gcc_srcdir
)/config
/dfp-bit.c
560 $(gcc_compile
) -DFINE_GRAINED_LIBRARIES
-DL
$* -DWIDTH
=64 -c
$<
561 libgcc-objects
+= $(d64pbit-o
)
565 d128pbit-o
= $(patsubst %,%$(objext
),$(D128PBIT_FUNCS
))
566 ifeq ($(enable_decimal_float
),bid
)
567 $(d128pbit-o
): %$(objext
): $(srcdir)/config
/libbid
/%.c
569 $(d128pbit-o
): %$(objext
): $(gcc_srcdir
)/config
/dfp-bit.c
571 $(gcc_compile
) -DFINE_GRAINED_LIBRARIES
-DL
$* -DWIDTH
=128 -c
$<
572 libgcc-objects
+= $(d128pbit-o
)
577 # Build LIB2ADD and LIB2ADD_ST.
578 ifneq ($(filter-out %.c
%.S
%.asm
,$(LIB2ADD
) $(LIB2ADD_ST
)),)
579 $(error Unsupported files in LIB2ADD or LIB2ADD_ST.
)
582 libgcc-objects
+= $(addsuffix $(objext
),$(basename $(notdir $(LIB2ADD
))))
583 libgcc-objects
+= $(addsuffix $(objext
),$(basename $(notdir $(LIB2ADD_ST
))))
586 iter-items
:= $(LIB2ADD
) $(LIB2ADD_ST
)
589 ifeq ($(enable_shared
),yes
)
590 libgcc-s-objects
+= $(addsuffix _s
$(objext
),$(basename $(notdir $(LIB2ADD
))))
593 # Build LIB2ADDEH, LIB2ADDEHSTATIC, and LIB2ADDEHSHARED. If we don't have
594 # libgcc_eh.a, only LIB2ADDEH matters. If we do, only LIB2ADDEHSTATIC and
595 # LIB2ADDEHSHARED matter. (Usually all three are identical.)
597 c_flags
:= -fexceptions
599 ifeq ($(enable_shared
),yes
)
601 libgcc-eh-objects
+= $(addsuffix $(objext
),$(basename $(notdir $(LIB2ADDEHSTATIC
))))
602 libgcc-s-objects
+= $(addsuffix _s
$(objext
),$(basename $(notdir $(LIB2ADDEHSHARED
))))
604 iter-items
:= $(sort $(LIB2ADDEHSTATIC
) $(LIB2ADDEHSHARED
))
608 # Not shared. LIB2ADDEH are added to libgcc.a.
610 libgcc-objects
+= $(addsuffix $(objext
),$(basename $(notdir $(LIB2ADDEH
))))
612 iter-items
:= $(LIB2ADDEH
)
619 c_flags
:= -fexceptions
621 libunwind-objects
+= $(addsuffix $(objext
),$(basename $(notdir $(LIBUNWIND
))))
623 ifeq ($(enable_shared
),yes
)
624 libunwind-s-objects
+= $(addsuffix _s
$(objext
),$(basename $(notdir $(LIBUNWIND
))))
627 iter-items
:= $(LIBUNWIND
)
630 # Build libgcov components.
631 libgcov-objects
= $(patsubst %,%$(objext
),$(LIBGCOV
))
632 $(libgcov-objects
): %$(objext
): $(gcc_srcdir
)/libgcov.c
633 $(gcc_compile
) -DL
$* -c
$(gcc_srcdir
)/libgcov.c
637 libgcc.a
: $(libgcc-objects
)
638 libgcov.a
: $(libgcov-objects
)
639 libunwind.a
: $(libunwind-objects
)
640 libgcc_eh.a
: $(libgcc-eh-objects
)
642 libgcc.a libgcov.a libunwind.a libgcc_eh.a
:
645 objects
="$(objects)"; \
646 if
test -z
"$$objects"; then \
647 echo
'int __libgcc_eh_dummy;' > eh_dummy.c
; \
648 $(gcc_compile_bare
) $(vis_hide
) -c eh_dummy.c \
649 -o eh_dummy
$(objext
); \
650 objects
=eh_dummy
$(objext
); \
652 $(AR_CREATE_FOR_TARGET
) $@
$$objects
656 all: libgcc.a libgcov.a
658 ifneq ($(LIBUNWIND
),)
660 libgcc_s
$(SHLIB_EXT
): libunwind
$(SHLIB_EXT
)
663 ifeq ($(enable_shared
),yes
)
664 all: libgcc_eh.a libgcc_s
$(SHLIB_EXT
)
665 ifneq ($(LIBUNWIND
),)
666 all: libunwind
$(SHLIB_EXT
)
670 ifeq ($(enable_shared
),yes
)
672 # Map-file generation.
673 ifneq ($(SHLIB_MKMAP
),)
674 libgcc.map
: $(SHLIB_MKMAP
) $(SHLIB_MAPFILES
) $(libgcc-s-objects
)
675 { $(NM
) $(SHLIB_NM_FLAGS
) $(libgcc-s-objects
); echo
%%; \
676 cat
$(SHLIB_MAPFILES
) \
677 | sed
-e
'/^[ ]*#/d' \
678 -e
's/^%\(if\|else\|elif\|endif\|define\)/#\1/' \
679 |
$(gcc_compile_bare
) -E
-xassembler-with-cpp
-; \
680 } |
$(AWK
) -f
$(SHLIB_MKMAP
) $(SHLIB_MKMAP_OPTS
) > tmp-
$@
682 libgcc_s
$(SHLIB_EXT
): libgcc.map
686 libgcc_s
$(SHLIB_EXT
): $(libgcc-s-objects
) $(extra-parts
)
687 # @multilib_flags@ is still needed because this may use
688 # $(GCC_FOR_TARGET) and $(LIBGCC2_CFLAGS) directly.
689 # @multilib_dir@ is not really necessary, but sometimes it has
690 # more uses than just a directory name.
691 $(mkinstalldirs
) $(MULTIDIR
)
692 $(subst @multilib_flags@
,$(CFLAGS
) -B.
/,$(subst \
693 @multilib_dir@
,$(MULTIDIR
),$(subst \
694 @shlib_objs@
,$(objects
),$(subst \
695 @shlib_base_name@
,libgcc_s
,$(subst \
696 @shlib_map_file@
,$(mapfile
),$(subst \
697 @shlib_slibdir_qual@
,$(MULTIOSSUBDIR
),$(SHLIB_LINK
)))))))
699 libunwind
$(SHLIB_EXT
): $(libunwind-s-objects
) $(extra-parts
)
700 # @multilib_flags@ is still needed because this may use
701 # $(GCC_FOR_TARGET) and $(LIBGCC2_CFLAGS) directly.
702 # @multilib_dir@ is not really necessary, but sometimes it has
703 # more uses than just a directory name.
704 $(mkinstalldirs
) $(MULTIDIR
)
705 $(subst @multilib_flags@
,$(CFLAGS
) -B.
/,$(subst \
706 @multilib_dir@
,$(MULTIDIR
),$(subst \
707 @shlib_objs@
,$(objects
),$(subst \
708 @shlib_base_name@
,libunwind
,$(subst \
709 @shlib_slibdir_qual@
,$(MULTIOSSUBDIR
),$(SHLIBUNWIND_LINK
))))))
713 # Build the standard GCC startfiles and endfiles.
714 ALL_CRT_CFLAGS
= $(CFLAGS
) $(CRTSTUFF_CFLAGS
) $(INCLUDES
)
715 crt_compile
= $(CC
) $(ALL_CRT_CFLAGS
) -o
$@
$(compile_deps
)
717 ifeq ($(CUSTOM_CRTSTUFF
),)
718 crtbegin
$(objext
): $(gcc_srcdir
)/crtstuff.c
719 $(crt_compile
) $(CRTSTUFF_T_CFLAGS
) \
720 -c
$(gcc_srcdir
)/crtstuff.c
-DCRT_BEGIN
722 crtend
$(objext
): $(gcc_srcdir
)/crtstuff.c
723 $(crt_compile
) $(CRTSTUFF_T_CFLAGS
) \
724 -c
$(gcc_srcdir
)/crtstuff.c
-DCRT_END
726 # These are versions of crtbegin and crtend for shared libraries.
727 crtbeginS
$(objext
): $(gcc_srcdir
)/crtstuff.c
728 $(crt_compile
) $(CRTSTUFF_T_CFLAGS_S
) \
729 -c
$(gcc_srcdir
)/crtstuff.c
-DCRT_BEGIN
-DCRTSTUFFS_O
731 crtendS
$(objext
): $(gcc_srcdir
)/crtstuff.c
732 $(crt_compile
) $(CRTSTUFF_T_CFLAGS_S
) \
733 -c
$(gcc_srcdir
)/crtstuff.c
-DCRT_END
-DCRTSTUFFS_O
735 # This is a version of crtbegin for -static links.
736 crtbeginT.o
: $(gcc_srcdir
)/crtstuff.c
737 $(crt_compile
) $(CRTSTUFF_T_CFLAGS
) \
738 -c
$(gcc_srcdir
)/crtstuff.c
-DCRT_BEGIN
-DCRTSTUFFT_O
741 # Build extra startfiles in the libgcc directory.
742 .PHONY
: libgcc-extra-parts
743 libgcc-extra-parts
: $(EXTRA_PARTS
)
744 ifneq ($(GCC_EXTRA_PARTS
),)
745 ifneq ($(sort $(EXTRA_PARTS
)),$(GCC_EXTRA_PARTS
))
746 # If the gcc directory specifies which extra parts to
747 # build for this target, and the libgcc configuration also
748 # specifies, make sure they match. This can be removed
749 # when the gcc directory no longer holds libgcc configuration;
750 # it is useful when migrating a target.
751 @echo
"Configuration mismatch!"
752 @echo
"Extra parts from gcc directory: $(GCC_EXTRA_PARTS)"
753 @echo
"Extra parts from libgcc: $(EXTRA_PARTS)"
758 # Early copyback; see "all" above for the rationale. The
759 # early copy is necessary so that the gcc -B options find
760 # the right startup files when linking shared libgcc.
761 $(mkinstalldirs
) $(gcc_objdir
)$(MULTISUBDIR
)
762 parts
="$(EXTRA_PARTS)"; \
763 for file in
$$parts; do \
764 rm -f
$(gcc_objdir
)$(MULTISUBDIR
)/$$file; \
765 $(INSTALL_DATA
) $$file $(gcc_objdir
)$(MULTISUBDIR
)/; \
768 # Build extra startfiles in the gcc directory, for unconverted
770 .PHONY
: gcc-extra-parts
772 # Recursively invoke make in the GCC directory to build any
773 # startfiles (for now). We must do this just once, passing
774 # it all the GCC_EXTRA_PARTS as simultaneous goal targets,
775 # so that rules which cannot execute simultaneously are properly
776 # serialized. We indirect through T_TARGET in case any multilib
777 # directories contain an equals sign, to prevent make from
778 # interpreting any of the goals as variable assignments.
780 # We must use cd && make rather than make -C, or else the stage
781 # number will be embedded in debug information.
783 T
=`$(PWD_COMMAND)`/ \
784 && cd
$(gcc_objdir
) \
785 && $(MAKE
) GCC_FOR_TARGET
="$(CC)" \
786 MULTILIB_CFLAGS
="$(CFLAGS)" \
788 T_TARGET
="$(patsubst %,$${T}%,$(GCC_EXTRA_PARTS))" \
791 # Early copyback; see "all" above for the rationale. The
792 # early copy is necessary so that the gcc -B options find
793 # the right startup files when linking shared libgcc.
794 $(mkinstalldirs
) $(gcc_objdir
)$(MULTISUBDIR
)
795 parts
="$(GCC_EXTRA_PARTS)"; \
796 for file in
$$parts; do \
797 rm -f
$(gcc_objdir
)$(MULTISUBDIR
)/$$file; \
798 $(INSTALL_DATA
) $$file $(gcc_objdir
)$(MULTISUBDIR
)/; \
803 # Documentation targets (empty).
804 .PHONY
: info html
dvi pdf install-info install-html install-pdf
814 # Install rules. These do not depend on "all", so that they can be invoked
815 # recursively from it.
817 $(mkinstalldirs
) $(DESTDIR
)$(inst_slibdir
)
819 # NOTE: Maybe this should go into $(inst_libdir), but this
820 # is where the old mklibgcc.in put it.
821 $(INSTALL_DATA
) libunwind.a
$(DESTDIR
)$(inst_slibdir
)/
822 chmod
644 $(DESTDIR
)$(inst_slibdir
)/libunwind.a
823 $(RANLIB
) $(DESTDIR
)$(inst_slibdir
)/libunwind.a
825 $(subst @multilib_dir@
,$(MULTIDIR
),$(subst \
826 @shlib_base_name@
,libunwind
,$(subst \
827 @shlib_slibdir_qual@
,$(MULTIOSSUBDIR
),$(SHLIBUNWIND_INSTALL
))))
830 $(mkinstalldirs
) $(DESTDIR
)$(inst_libdir
)
832 $(INSTALL_DATA
) libgcc_eh.a
$(DESTDIR
)$(inst_libdir
)/
833 chmod
644 $(DESTDIR
)$(inst_libdir
)/libgcc_eh.a
834 $(RANLIB
) $(DESTDIR
)$(inst_libdir
)/libgcc_eh.a
836 $(subst @multilib_dir@
,$(MULTIDIR
),$(subst \
837 @shlib_base_name@
,libgcc_s
,$(subst \
838 @shlib_slibdir_qual@
,$(MULTIOSSUBDIR
),$(SHLIB_INSTALL
))))
840 install: $(install-shared
) $(install-libunwind
)
841 $(mkinstalldirs
) $(DESTDIR
)$(inst_libdir
)
843 $(INSTALL_DATA
) libgcc.a
$(DESTDIR
)$(inst_libdir
)/
844 chmod
644 $(DESTDIR
)$(inst_libdir
)/libgcc.a
845 $(RANLIB
) $(DESTDIR
)$(inst_libdir
)/libgcc.a
846 $(INSTALL_DATA
) libgcov.a
$(DESTDIR
)$(inst_libdir
)/
847 chmod
644 $(DESTDIR
)$(inst_libdir
)/libgcov.a
848 $(RANLIB
) $(DESTDIR
)$(inst_libdir
)/libgcov.a
850 parts
="$(INSTALL_PARTS)"; \
851 for file in
$$parts; do \
852 rm -f
$(DESTDIR
)$(inst_libdir
)/$$file; \
853 $(INSTALL_DATA
) $$file $(DESTDIR
)$(inst_libdir
)/; \
856 @
$(MULTIDO
) $(FLAGS_TO_PASS
) multi-do DO
=install
858 .PHONY
: install install-shared install-libunwind
860 # Don't export variables to the environment, in order to not confuse
864 include $(srcdir)/empty.mk
$(wildcard *.dep
)
867 # Garbage collect in gcc/:
868 # $(LIBGCC) settings in t-* are now unused
870 # Remove use of $(gcc_srcdir). Source files referenced using $(gcc_srcdir)
871 # should move into the libgcc directory.