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
70 PWD_COMMAND
= $${PWDCMD-pwd
}
72 # Flags to pass to a recursive make.
75 "AR_FLAGS=$(AR_FLAGS)" \
78 "DESTDIR=$(DESTDIR)" \
79 "EXTRA_OFILES=$(EXTRA_OFILES)" \
80 "HDEFINES=$(HDEFINES)" \
81 "INSTALL=$(INSTALL)" \
82 "INSTALL_DATA=$(INSTALL_DATA)" \
83 "INSTALL_PROGRAM=$(INSTALL_PROGRAM)" \
84 "LDFLAGS=$(LDFLAGS)" \
85 "LOADLIBES=$(LOADLIBES)" \
89 "exec_prefix=$(exec_prefix)" \
91 "libsubdir=$(libsubdir)" \
94 # Dependencies for "all" are set later in the file.
96 # Now that we have built all the objects, we need to copy
97 # them back to the GCC directory. Too many things (other
98 # in-tree libraries, and DejaGNU) know about the layout
99 # of the build tree, for now.
100 $(MAKE
) install DESTDIR
=$(gcc_objdir
) \
101 slibdir
= libsubdir
= MULTIOSDIR
=$(MULTIDIR
)
105 # If this is the top-level multilib, build all the other
107 @
: $(MAKE
) ; exec
$(MULTIDO
) $(FLAGS_TO_PASS
) multi-do DO
=all
109 .PHONY
: check installcheck
116 -rm -f config.h stamp-h stmp-ldirs libgcc.map
120 -rm -f libunwind
$(SHLIB_EXT
)
122 @
$(MULTICLEAN
) multi-clean DO
=clean
124 @
$(MULTICLEAN
) multi-clean DO
=distclean
125 -rm -f
*~ Makefile config.cache config.status multilib.out
127 maintainer-clean
realclean: distclean
129 Makefile
: $(srcdir)/Makefile.in config.status
130 CONFIG_FILES
=Makefile CONFIG_HEADERS
= $(SHELL
) .
/config.status
132 # Depending on Makefile makes sure that config.status has been re-run
133 # if needed. This prevents problems with parallel builds.
134 config.h
: stamp-h
; @true
135 stamp-h
: $(srcdir)/config.in config.status Makefile
136 CONFIG_FILES
= CONFIG_HEADERS
=config.h
:$(srcdir)/config.in
$(SHELL
) .
/config.status
138 config.status
: $(srcdir)/configure
139 $(SHELL
) .
/config.status
--recheck
141 include $(gcc_objdir
)/libgcc.mvars
143 # Flags to pass to recursive makes.
145 AR_FOR_TARGET
= $(AR
)
146 AR_FLAGS_FOR_TARGET
=
147 AR_CREATE_FOR_TARGET
= $(AR_FOR_TARGET
) $(AR_FLAGS_FOR_TARGET
) rc
148 AR_EXTRACT_FOR_TARGET
= $(AR_FOR_TARGET
) $(AR_FLAGS_FOR_TARGET
) x
150 GCC_FOR_TARGET
= $(CC
)
152 LIPO_FOR_TARGET
= $(LIPO
)
153 MACHMODE_H
= machmode.h mode-classes.def insn-modes.h
155 NM_FOR_TARGET
= $(NM
)
156 RANLIB_FOR_TARGET
= $(RANLIB
)
158 STRIP_FOR_TARGET
= $(STRIP
)
160 # Directory in which the compiler finds libraries etc.
161 libsubdir
= $(libdir)/gcc
/$(host_noncanonical
)/$(version
)
162 # Used to install the shared libgcc.
166 export AR_CREATE_FOR_TARGET
167 export AR_FLAGS_FOR_TARGET
168 export AR_EXTRACT_FOR_TARGET
171 export GCC_FOR_TARGET
175 export LIBGCC2_CFLAGS
176 export LIPO_FOR_TARGET
179 export STRIP_FOR_TARGET
180 export RANLIB_FOR_TARGET
184 version
:= $(shell $(CC
) -dumpversion
)
186 DECNUMINC
= -I
$(srcdir)/..
/libdecnumber
-I
$(MULTIBUILDTOP
)..
/..
/libdecnumber
188 # Specify the directories to be searched for header files.
189 # Both . and srcdir are used, in that order,
190 # so that *config.h will be found in the compilation
191 # subdirectory rather than in the source directory.
192 # -I$(@D) and -I$(srcdir)/$(@D) cause the subdirectory of the file
193 # currently being compiled, in both source trees, to be examined as well.
194 INCLUDES
= -I.
-I
$(@D
) -I
$(gcc_objdir
) \
195 -I
$(srcdir) -I
$(srcdir)/$(@D
) -I
$(srcdir)/..
/gcc \
196 -I
$(srcdir)/..
/include $(DECNUMINC
)
198 # Forcibly remove any profiling-related flags. There is no point
199 # in supporting profiled bootstrap in this library.
200 override CFLAGS
:= $(filter-out -fprofile-generate
-fprofile-use
,$(CFLAGS
))
202 # CFLAGS first is not perfect; normally setting CFLAGS should override any
203 # options in LIBGCC2_CFLAGS. But LIBGCC2_CFLAGS may contain -g0, and CFLAGS
204 # will usually contain -g, so for the moment CFLAGS goes first. We must
205 # include CFLAGS - that's where multilib options live.
206 INTERNAL_CFLAGS
= $(CFLAGS
) $(LIBGCC2_CFLAGS
) $(HOST_LIBGCC2_CFLAGS
) $(INCLUDES
)
208 MULTIDIR
:= $(shell $(CC
) $(CFLAGS
) -print-multi-directory
)
209 MULTIOSDIR
:= $(shell $(CC
) $(CFLAGS
) -print-multi-os-directory
)
211 MULTIOSSUBDIR
:= $(shell if
test $(MULTIOSDIR
) != .
; then echo
/$(MULTIOSDIR
); fi
)
212 inst_libdir
= $(libsubdir
)$(MULTISUBDIR
)
213 inst_slibdir
= $(slibdir
)$(MULTIOSSUBDIR
)
215 gcc_compile_bare
= $(CC
) $(INTERNAL_CFLAGS
)
216 compile_deps
= -MT
$@
-MD
-MP
-MF
$(basename $@
).dep
217 gcc_compile
= $(gcc_compile_bare
) -o
$@
$(compile_deps
)
218 gcc_s_compile
= $(gcc_compile
) -DSHARED
220 objects
= $(filter %$(objext
),$^
)
222 # Collect any host-specific information from Makefile fragments.
223 tmake_file
= @tmake_file@
224 include $(srcdir)/empty.mk
$(tmake_file
)
226 # Only handle shared libraries if both:
227 # - the user requested them
228 # - we know how to build them
229 ifeq ($(SHLIB_LINK
),)
233 ifeq ($(enable_shared
),yes
)
234 iterator
= $(srcdir)/empty.mk
$(patsubst %,$(srcdir)/shared-object.mk
,$(iter-items
))
236 install-shared
= install-shared
238 ifneq ($(LIBUNWIND
),)
239 install-libunwind
= install-libunwind
242 # For -fvisibility=hidden. We need both a -fvisibility=hidden on
243 # the command line, and a #define to prevent libgcc2.h etc from
244 # overriding that with #pragmas.
245 vis_hide
= @vis_hide@
249 # If we have -fvisibility=hidden, then we need to generate hide
250 # lists for object files implemented in assembly.
251 ASM_HIDDEN_OP
= @asm_hidden_op@
255 $(AWK
) 'NF == 3 && $$2 !~ /^[UN]$$/ { print "\t$(ASM_HIDDEN_OP)", $$3 }' > $@T
259 gen-hide-list
= echo
> $@
264 iterator
= $(srcdir)/empty.mk
$(patsubst %,$(srcdir)/static-object.mk
,$(iter-items
))
266 gen-hide-list
= echo
> \
$@
269 ifneq ($(EXTRA_PARTS
),)
270 extra-parts
= libgcc-extra-parts
271 INSTALL_PARTS
= $(EXTRA_PARTS
)
273 ifneq ($(GCC_EXTRA_PARTS
),)
274 extra-parts
= gcc-extra-parts
275 INSTALL_PARTS
= $(GCC_EXTRA_PARTS
)
279 # Library members defined in libgcc2.c.
280 lib2funcs
= _muldi3 _negdi2 _lshrdi3 _ashldi3 _ashrdi3 _cmpdi2 _ucmpdi2 \
281 _clear_cache _enable_execute_stack _trampoline __main _absvsi2 \
282 _absvdi2 _addvsi3 _addvdi3 _subvsi3 _subvdi3 _mulvsi3 _mulvdi3 \
283 _negvsi2 _negvdi2 _ctors _ffssi2 _ffsdi2 _clz _clzsi2 _clzdi2 \
284 _ctzsi2 _ctzdi2 _popcount_tab _popcountsi2 _popcountdi2 \
285 _paritysi2 _paritydi2 _powisf2 _powidf2 _powixf2 _powitf2 \
286 _mulsc3 _muldc3 _mulxc3 _multc3 _divsc3 _divdc3 _divxc3 \
287 _divtc3 _bswapsi2 _bswapdi2
289 # The floating-point conversion routines that involve a single-word integer.
290 # XX stands for the integer mode.
291 swfloatfuncs
= $(patsubst %,_fixuns
%XX
,sf df xf
)
293 # Likewise double-word routines.
294 dwfloatfuncs
= $(patsubst %,_fix
%XX
,sf df xf tf
) \
295 $(patsubst %,_fixuns
%XX
,sf df xf tf
) \
296 $(patsubst %,_floatXX
%,sf df xf tf
) \
297 $(patsubst %,_floatunXX
%,sf df xf tf
)
299 ifeq ($(LIB2_SIDITI_CONV_FUNCS
),)
300 lib2funcs
+= $(subst XX
,si
,$(swfloatfuncs
))
301 lib2funcs
+= $(subst XX
,di
,$(dwfloatfuncs
))
304 # These might cause a divide overflow trap and so are compiled with
306 LIB2_DIVMOD_FUNCS
= _divdi3 _moddi3 _udivdi3 _umoddi3 _udiv_w_sdiv _udivmoddi4
308 # Remove any objects from lib2funcs and LIB2_DIVMOD_FUNCS that are
309 # defined as optimized assembly code in LIB1ASMFUNCS or as C code
310 # in LIB2FUNCS_EXCLUDE.
311 lib2funcs
:= $(filter-out $(LIB2FUNCS_EXCLUDE
) $(LIB1ASMFUNCS
),$(lib2funcs
))
312 LIB2_DIVMOD_FUNCS
:= $(filter-out $(LIB2FUNCS_EXCLUDE
) $(LIB1ASMFUNCS
), \
313 $(LIB2_DIVMOD_FUNCS
))
315 # Build "libgcc1" (assembly) components.
316 ifeq ($(enable_shared
),yes
)
318 lib1asmfuncs-o
= $(patsubst %,%$(objext
),$(LIB1ASMFUNCS
))
319 $(lib1asmfuncs-o
): %$(objext
): $(gcc_srcdir
)/config
/$(LIB1ASMSRC
) %.vis
320 $(gcc_compile
) -DL
$* -xassembler-with-cpp \
321 -c
$(gcc_srcdir
)/config
/$(LIB1ASMSRC
) -include $*.vis
322 $(patsubst %,%.vis
,$(LIB1ASMFUNCS
)): %.vis
: %_s
$(objext
)
324 libgcc-objects
+= $(lib1asmfuncs-o
)
326 lib1asmfuncs-s-o
= $(patsubst %,%_s
$(objext
),$(LIB1ASMFUNCS
))
327 $(lib1asmfuncs-s-o
): %_s
$(objext
): $(gcc_srcdir
)/config
/$(LIB1ASMSRC
)
328 $(gcc_s_compile
) -DL
$* -xassembler-with-cpp \
329 -c
$(gcc_srcdir
)/config
/$(LIB1ASMSRC
)
330 libgcc-s-objects
+= $(lib1asmfuncs-s-o
)
334 lib1asmfuncs-o
= $(patsubst %,%$(objext
),$(LIB1ASMFUNCS
))
335 $(lib1asmfuncs-o
): %$(objext
): $(gcc_srcdir
)/config
/$(LIB1ASMSRC
)
336 $(gcc_compile
) -DL
$* -xassembler-with-cpp \
337 -c
$(gcc_srcdir
)/config
/$(LIB1ASMSRC
)
338 libgcc-objects
+= $(lib1asmfuncs-o
)
342 # Build lib2funcs. For the static library also include LIB2FUNCS_ST.
343 lib2funcs-o
= $(patsubst %,%$(objext
),$(lib2funcs
) $(LIB2FUNCS_ST
))
344 $(lib2funcs-o
): %$(objext
): $(gcc_srcdir
)/libgcc2.c
345 $(gcc_compile
) -DL
$* -c
$(gcc_srcdir
)/libgcc2.c \
347 libgcc-objects
+= $(lib2funcs-o
)
349 ifeq ($(enable_shared
),yes
)
350 lib2funcs-s-o
= $(patsubst %,%_s
$(objext
),$(lib2funcs
))
351 $(lib2funcs-s-o
): %_s
$(objext
): $(gcc_srcdir
)/libgcc2.c
352 $(gcc_s_compile
) -DL
$* -c
$(gcc_srcdir
)/libgcc2.c
353 libgcc-s-objects
+= $(lib2funcs-s-o
)
356 ifneq ($(LIB2_SIDITI_CONV_FUNCS
),)
357 # Build libgcc2.c for each conversion function, with a specific
358 # L<func> definition and LIBGCC2_UNITS_PER_WORD setting. The DImode
359 # functions are built with a wordsize of 4; the TImode functions are
360 # built with the same labels, but a wordsize of 8.
362 sifuncs
= $(subst XX
,si
,$(swfloatfuncs
))
363 difuncs
= $(subst XX
,di
,$(dwfloatfuncs
))
364 tifuncs
= $(subst XX
,ti
,$(dwfloatfuncs
))
366 iter-items
:= $(sifuncs
) $(difuncs
) $(tifuncs
)
367 iter-labels
:= $(sifuncs
) $(difuncs
) $(difuncs
)
368 iter-sizes
:= $(patsubst %,4,$(sifuncs
) $(difuncs
)) $(patsubst %,8,$(tifuncs
))
370 include $(srcdir)/empty.mk
$(patsubst %,$(srcdir)/siditi-object.mk
,$(iter-items
))
372 libgcc-objects
+= $(patsubst %,%$(objext
),$(sifuncs
) $(difuncs
) $(tifuncs
))
373 ifeq ($(enable_shared
),yes
)
374 libgcc-s-objects
+= $(patsubst %,%_s
$(objext
),$(sifuncs
) $(difuncs
) $(tifuncs
))
378 # Build LIB2_DIVMOD_FUNCS.
379 lib2-divmod-o
= $(patsubst %,%$(objext
),$(LIB2_DIVMOD_FUNCS
))
380 $(lib2-divmod-o
): %$(objext
): $(gcc_srcdir
)/libgcc2.c
381 $(gcc_compile
) -DL
$* -c
$(gcc_srcdir
)/libgcc2.c \
382 -fexceptions
-fnon-call-exceptions
$(vis_hide
)
383 libgcc-objects
+= $(lib2-divmod-o
)
385 ifeq ($(enable_shared
),yes
)
386 lib2-divmod-s-o
= $(patsubst %,%_s
$(objext
),$(LIB2_DIVMOD_FUNCS
))
387 $(lib2-divmod-s-o
): %_s
$(objext
): $(gcc_srcdir
)/libgcc2.c
388 $(gcc_s_compile
) -DL
$* -c
$(gcc_srcdir
)/libgcc2.c \
389 -fexceptions
-fnon-call-exceptions
390 libgcc-s-objects
+= $(lib2-divmod-s-o
)
393 # $(FPBIT) et al. are pathnames relative to the GCC build
394 # directory; the supporting files are made by the GCC
396 # FIXME: Soon we will be able to move this logic into this directory.
398 ifneq ($(fpbit-in-libgcc
),yes
)
399 FPBIT
:=$(if
$(FPBIT
),$(gcc_objdir
)/$(FPBIT
),)
400 DPBIT
:=$(if
$(DPBIT
),$(gcc_objdir
)/$(DPBIT
),)
401 TPBIT
:=$(if
$(TPBIT
),$(gcc_objdir
)/$(TPBIT
),)
405 # _sf_to_tf and _df_to_tf require tp-bit.c being compiled in.
406 FPBIT_FUNCS
:= $(filter-out _sf_to_tf
,$(FPBIT_FUNCS
))
407 DPBIT_FUNCS
:= $(filter-out _df_to_tf
,$(DPBIT_FUNCS
))
412 fpbit-o
= $(patsubst %,%$(objext
),$(FPBIT_FUNCS
))
413 $(fpbit-o
): %$(objext
): $(FPBIT
)
414 $(gcc_compile
) -DFINE_GRAINED_LIBRARIES
-DL
$* -c
$(FPBIT
) $(vis_hide
)
415 libgcc-objects
+= $(fpbit-o
)
417 ifeq ($(enable_shared
),yes
)
418 fpbit-s-o
= $(patsubst %,%_s
$(objext
),$(FPBIT_FUNCS
))
419 $(fpbit-s-o
): %_s
$(objext
): $(FPBIT
)
420 $(gcc_s_compile
) -DFINE_GRAINED_LIBRARIES
-DL
$* -c
$(FPBIT
)
421 libgcc-s-objects
+= $(fpbit-s-o
)
427 dpbit-o
= $(patsubst %,%$(objext
),$(DPBIT_FUNCS
))
428 $(dpbit-o
): %$(objext
): $(DPBIT
)
429 $(gcc_compile
) -DFINE_GRAINED_LIBRARIES
-DL
$* -c
$(DPBIT
) $(vis_hide
)
430 libgcc-objects
+= $(dpbit-o
)
432 ifeq ($(enable_shared
),yes
)
433 dpbit-s-o
= $(patsubst %,%_s
$(objext
),$(DPBIT_FUNCS
))
434 $(dpbit-s-o
): %_s
$(objext
): $(DPBIT
)
435 $(gcc_s_compile
) -DFINE_GRAINED_LIBRARIES
-DL
$* -c
$(DPBIT
)
436 libgcc-s-objects
+= $(dpbit-s-o
)
442 tpbit-o
= $(patsubst %,%$(objext
),$(TPBIT_FUNCS
))
443 $(tpbit-o
): %$(objext
): $(TPBIT
)
444 $(gcc_compile
) -DFINE_GRAINED_LIBRARIES
-DL
$* -c
$(TPBIT
) $(vis_hide
)
445 libgcc-objects
+= $(tpbit-o
)
447 ifeq ($(enable_shared
),yes
)
448 tpbit-s-o
= $(patsubst %,%_s
$(objext
),$(TPBIT_FUNCS
))
449 $(tpbit-s-o
): %_s
$(objext
): $(TPBIT
)
450 $(gcc_s_compile
) -DFINE_GRAINED_LIBRARIES
-DL
$* -c
$(TPBIT
)
451 libgcc-s-objects
+= $(tpbit-s-o
)
455 # Build decimal floating point support.
456 ifeq ($(decimal_float
),yes
)
458 # If $DFP_ENABLE is set, then we want all data type sizes.
459 ifneq ($(DFP_ENABLE
),)
466 ifneq ($(D32PBIT
)$(D64PBIT
)$(D128PBIT
),)
467 dec-filenames
+= decContext decNumber decRound decLibrary decUtility
471 dec-filenames
+= decimal32
475 dec-filenames
+= decimal64
479 dec-filenames
+= decimal128
482 dec-objects
= $(patsubst %,%$(objext
),$(dec-filenames
))
483 $(dec-objects
): %$(objext
): $(srcdir)/..
/libdecnumber
/%.c
485 libgcc-objects
+= $(dec-objects
)
487 # Next build individual support functions.
489 d32pbit-o
= $(patsubst %,%$(objext
),$(D32PBIT_FUNCS
))
490 $(d32pbit-o
): %$(objext
): $(gcc_srcdir
)/config
/dfp-bit.c
491 $(gcc_compile
) -DFINE_GRAINED_LIBRARIES
-DL
$* -DWIDTH
=32 -c
$<
492 libgcc-objects
+= $(d32pbit-o
)
496 d64pbit-o
= $(patsubst %,%$(objext
),$(D64PBIT_FUNCS
))
497 $(d64pbit-o
): %$(objext
): $(gcc_srcdir
)/config
/dfp-bit.c
498 $(gcc_compile
) -DFINE_GRAINED_LIBRARIES
-DL
$* -DWIDTH
=64 -c
$<
499 libgcc-objects
+= $(d64pbit-o
)
503 d128pbit-o
= $(patsubst %,%$(objext
),$(D128PBIT_FUNCS
))
504 $(d128pbit-o
): %$(objext
): $(gcc_srcdir
)/config
/dfp-bit.c
505 $(gcc_compile
) -DFINE_GRAINED_LIBRARIES
-DL
$* -DWIDTH
=128 -c
$<
506 libgcc-objects
+= $(d128pbit-o
)
511 # Build LIB2ADD and LIB2ADD_ST.
512 ifneq ($(filter-out %.c
%.S
%.asm
,$(LIB2ADD
) $(LIB2ADD_ST
)),)
513 $(error Unsupported files in LIB2ADD or LIB2ADD_ST.
)
516 libgcc-objects
+= $(addsuffix $(objext
),$(basename $(notdir $(LIB2ADD
))))
517 libgcc-objects
+= $(addsuffix $(objext
),$(basename $(notdir $(LIB2ADD_ST
))))
520 iter-items
:= $(LIB2ADD
) $(LIB2ADD_ST
)
523 ifeq ($(enable_shared
),yes
)
524 libgcc-s-objects
+= $(addsuffix _s
$(objext
),$(basename $(notdir $(LIB2ADD
))))
527 # Build LIB2ADDEH, LIB2ADDEHSTATIC, and LIB2ADDEHSHARED. If we don't have
528 # libgcc_eh.a, only LIB2ADDEH matters. If we do, only LIB2ADDEHSTATIC and
529 # LIB2ADDEHSHARED matter. (Usually all three are identical.)
531 c_flags
:= -fexceptions
533 ifeq ($(enable_shared
),yes
)
535 libgcc-eh-objects
+= $(addsuffix $(objext
),$(basename $(notdir $(LIB2ADDEHSTATIC
))))
536 libgcc-s-objects
+= $(addsuffix _s
$(objext
),$(basename $(notdir $(LIB2ADDEHSHARED
))))
538 iter-items
:= $(sort $(LIB2ADDEHSTATIC
) $(LIB2ADDEHSHARED
))
542 # Not shared. LIB2ADDEH are added to libgcc.a.
544 libgcc-objects
+= $(addsuffix $(objext
),$(basename $(notdir $(LIB2ADDEH
))))
546 iter-items
:= $(LIB2ADDEH
)
553 c_flags
:= -fexceptions
555 libunwind-objects
+= $(addsuffix $(objext
),$(basename $(notdir $(LIBUNWIND
))))
557 ifeq ($(enable_shared
),yes
)
558 libunwind-s-objects
+= $(addsuffix _s
$(objext
),$(basename $(notdir $(LIBUNWIND
))))
561 iter-items
:= $(LIBUNWIND
)
564 # Build libgcov components.
565 libgcov-objects
= $(patsubst %,%$(objext
),$(LIBGCOV
))
566 $(libgcov-objects
): %$(objext
): $(gcc_srcdir
)/libgcov.c
567 $(gcc_compile
) -DL
$* -c
$(gcc_srcdir
)/libgcov.c
571 libgcc.a
: $(libgcc-objects
)
572 libgcov.a
: $(libgcov-objects
)
573 libunwind.a
: $(libunwind-objects
)
574 libgcc_eh.a
: $(libgcc-eh-objects
)
576 libgcc.a libgcov.a libunwind.a libgcc_eh.a
:
579 objects
="$(objects)"; \
580 if
test -z
"$$objects"; then \
581 echo
'int __libgcc_eh_dummy;' > eh_dummy.c
; \
582 $(gcc_compile_bare
) $(vis_hide
) -c eh_dummy.c \
583 -o eh_dummy
$(objext
); \
584 objects
=eh_dummy
$(objext
); \
586 $(AR_CREATE_FOR_TARGET
) $@
$$objects
590 all: libgcc.a libgcov.a
592 ifneq ($(LIBUNWIND
),)
596 ifeq ($(enable_shared
),yes
)
597 all: libgcc_eh.a libgcc_s
$(SHLIB_EXT
)
598 ifneq ($(LIBUNWIND
),)
599 all: libunwind
$(SHLIB_EXT
)
603 ifeq ($(enable_shared
),yes
)
605 # Map-file generation.
606 ifneq ($(SHLIB_MKMAP
),)
607 libgcc.map
: $(SHLIB_MKMAP
) $(SHLIB_MAPFILES
) $(libgcc-s-objects
)
608 { $(NM
) $(SHLIB_NM_FLAGS
) $(libgcc-s-objects
); echo
%%; \
609 cat
$(SHLIB_MAPFILES
) \
610 | sed
-e
'/^[ ]*#/d' \
611 -e
's/^%\(if\|else\|elif\|endif\|define\)/#\1/' \
612 |
$(gcc_compile_bare
) -E
-xassembler-with-cpp
-; \
613 } |
$(AWK
) -f
$(SHLIB_MKMAP
) $(SHLIB_MKMAP_OPTS
) > tmp-
$@
615 libgcc_s
$(SHLIB_EXT
): libgcc.map
619 libgcc_s
$(SHLIB_EXT
): $(libgcc-s-objects
) $(extra-parts
)
620 # @multilib_flags@ is still needed because this may use
621 # $(GCC_FOR_TARGET) and $(LIBGCC2_CFLAGS) directly.
622 # @multilib_dir@ is not really necessary, but sometimes it has
623 # more uses than just a directory name.
624 $(mkinstalldirs
) $(MULTIDIR
)
625 $(subst @multilib_flags@
,$(CFLAGS
),$(subst \
626 @multilib_dir@
,$(MULTIDIR
),$(subst \
627 @shlib_objs@
,$(objects
),$(subst \
628 @shlib_base_name@
,libgcc_s
,$(subst \
629 @shlib_map_file@
,$(mapfile
),$(subst \
630 @shlib_slibdir_qual@
,$(MULTIOSSUBDIR
),$(SHLIB_LINK
)))))))
632 libunwind
$(SHLIB_EXT
): $(libunwind-s-objects
) $(extra-parts
)
633 # @multilib_flags@ is still needed because this may use
634 # $(GCC_FOR_TARGET) and $(LIBGCC2_CFLAGS) directly.
635 # @multilib_dir@ is not really necessary, but sometimes it has
636 # more uses than just a directory name.
637 $(mkinstalldirs
) $(MULTIDIR
)
638 $(subst @multilib_flags@
,$(CFLAGS
),$(subst \
639 @multilib_dir@
,$(MULTIDIR
),$(subst \
640 @shlib_objs@
,$(objects
),$(subst \
641 @shlib_base_name@
,libunwind
,$(subst \
642 @shlib_slibdir_qual@
,$(MULTIOSSUBDIR
),$(SHLIBUNWIND_LINK
))))))
646 # Build the standard GCC startfiles and endfiles.
647 ALL_CRT_CFLAGS
= $(CFLAGS
) $(CRTSTUFF_CFLAGS
) $(INCLUDES
)
648 crt_compile
= $(CC
) $(ALL_CRT_CFLAGS
) -o
$@
$(compile_deps
)
650 ifeq ($(CUSTOM_CRTSTUFF
),)
651 crtbegin
$(objext
): $(gcc_srcdir
)/crtstuff.c
652 $(crt_compile
) $(CRTSTUFF_T_CFLAGS
) \
653 -c
$(gcc_srcdir
)/crtstuff.c
-DCRT_BEGIN
655 crtend
$(objext
): $(gcc_srcdir
)/crtstuff.c
656 $(crt_compile
) $(CRTSTUFF_T_CFLAGS
) \
657 -c
$(gcc_srcdir
)/crtstuff.c
-DCRT_END
659 # These are versions of crtbegin and crtend for shared libraries.
660 crtbeginS
$(objext
): $(gcc_srcdir
)/crtstuff.c
661 $(crt_compile
) $(CRTSTUFF_T_CFLAGS_S
) \
662 -c
$(gcc_srcdir
)/crtstuff.c
-DCRT_BEGIN
-DCRTSTUFFS_O
664 crtendS
$(objext
): $(gcc_srcdir
)/crtstuff.c
665 $(crt_compile
) $(CRTSTUFF_T_CFLAGS_S
) \
666 -c
$(gcc_srcdir
)/crtstuff.c
-DCRT_END
-DCRTSTUFFS_O
668 # This is a version of crtbegin for -static links.
669 crtbeginT.o
: $(gcc_srcdir
)/crtstuff.c
670 $(crt_compile
) $(CRTSTUFF_T_CFLAGS
) \
671 -c
$(gcc_srcdir
)/crtstuff.c
-DCRT_BEGIN
-DCRTSTUFFT_O
674 # Build extra startfiles in the libgcc directory.
675 .PHONY
: libgcc-extra-parts
676 libgcc-extra-parts
: $(EXTRA_PARTS
)
677 ifneq ($(GCC_EXTRA_PARTS
),)
678 ifneq ($(sort $(EXTRA_PARTS
)),$(GCC_EXTRA_PARTS
))
679 # If the gcc directory specifies which extra parts to
680 # build for this target, and the libgcc configuration also
681 # specifies, make sure they match. This can be removed
682 # when the gcc directory no longer holds libgcc configuration;
683 # it is useful when migrating a target.
684 @echo
"Configuration mismatch!"
685 @echo
"Extra parts from gcc directory: $(GCC_EXTRA_PARTS)"
686 @echo
"Extra parts from libgcc: $(EXTRA_PARTS)"
691 # Early copyback; see "all" above for the rationale. The
692 # early copy is necessary so that the gcc -B options find
693 # the right startup files when linking shared libgcc.
694 $(mkinstalldirs
) $(gcc_objdir
)$(MULTISUBDIR
)
695 parts
="$(EXTRA_PARTS)"; \
696 for file in
$$parts; do \
697 rm -f
$(gcc_objdir
)$(MULTISUBDIR
)/$$file; \
698 $(INSTALL_DATA
) $$file $(gcc_objdir
)$(MULTISUBDIR
)/; \
701 # Build extra startfiles in the gcc directory, for unconverted
703 .PHONY
: gcc-extra-parts
705 # Recursively invoke make in the GCC directory to build any
706 # startfiles (for now). We must do this just once, passing
707 # it all the GCC_EXTRA_PARTS as simultaneous goal targets,
708 # so that rules which cannot execute simultaneously are properly
709 # serialized. We indirect through T_TARGET in case any multilib
710 # directories contain an equals sign, to prevent make from
711 # interpreting any of the goals as variable assignments.
713 # We must use cd && make rather than make -C, or else the stage
714 # number will be embedded in debug information.
716 T
=`$(PWD_COMMAND)`/ \
717 && cd
$(gcc_objdir
) \
718 && $(MAKE
) GCC_FOR_TARGET
="$(CC)" \
719 MULTILIB_CFLAGS
="$(CFLAGS)" \
721 T_TARGET
="$(patsubst %,$${T}%,$(GCC_EXTRA_PARTS))" \
724 # Early copyback; see "all" above for the rationale. The
725 # early copy is necessary so that the gcc -B options find
726 # the right startup files when linking shared libgcc.
727 $(mkinstalldirs
) $(gcc_objdir
)$(MULTISUBDIR
)
728 parts
="$(GCC_EXTRA_PARTS)"; \
729 for file in
$$parts; do \
730 rm -f
$(gcc_objdir
)$(MULTISUBDIR
)/$$file; \
731 $(INSTALL_DATA
) $$file $(gcc_objdir
)$(MULTISUBDIR
)/; \
736 # Documentation targets (empty).
737 .PHONY
: info html
dvi pdf
747 # Install rules. These do not depend on "all", so that they can be invoked
748 # recursively from it.
750 $(mkinstalldirs
) $(DESTDIR
)$(inst_slibdir
)
752 # NOTE: Maybe this should go into $(inst_libdir), but this
753 # is where the old mklibgcc.in put it.
754 $(INSTALL_DATA
) libunwind.a
$(DESTDIR
)$(inst_slibdir
)/
755 chmod
644 $(DESTDIR
)$(inst_slibdir
)/libunwind.a
756 $(RANLIB
) $(DESTDIR
)$(inst_slibdir
)/libunwind.a
758 $(subst @multilib_dir@
,$(MULTIDIR
),$(subst \
759 @shlib_base_name@
,libunwind
,$(subst \
760 @shlib_slibdir_qual@
,$(MULTIOSSUBDIR
),$(SHLIBUNWIND_INSTALL
))))
763 $(mkinstalldirs
) $(DESTDIR
)$(inst_libdir
)
765 $(INSTALL_DATA
) libgcc_eh.a
$(DESTDIR
)$(inst_libdir
)/
766 chmod
644 $(DESTDIR
)$(inst_libdir
)/libgcc_eh.a
767 $(RANLIB
) $(DESTDIR
)$(inst_libdir
)/libgcc_eh.a
769 $(subst @multilib_dir@
,$(MULTIDIR
),$(subst \
770 @shlib_base_name@
,libgcc_s
,$(subst \
771 @shlib_slibdir_qual@
,$(MULTIOSSUBDIR
),$(SHLIB_INSTALL
))))
773 install: $(install-shared
) $(install-libunwind
)
774 $(mkinstalldirs
) $(DESTDIR
)$(inst_libdir
)
776 $(INSTALL_DATA
) libgcc.a
$(DESTDIR
)$(inst_libdir
)/
777 chmod
644 $(DESTDIR
)$(inst_libdir
)/libgcc.a
778 $(RANLIB
) $(DESTDIR
)$(inst_libdir
)/libgcc.a
779 $(INSTALL_DATA
) libgcov.a
$(DESTDIR
)$(inst_libdir
)/
780 chmod
644 $(DESTDIR
)$(inst_libdir
)/libgcov.a
781 $(RANLIB
) $(DESTDIR
)$(inst_libdir
)/libgcov.a
783 parts
="$(INSTALL_PARTS)"; \
784 for file in
$$parts; do \
785 rm -f
$(DESTDIR
)$(inst_libdir
)/$$file; \
786 $(INSTALL_DATA
) $$file $(DESTDIR
)$(inst_libdir
)/; \
789 @
$(MULTIDO
) $(FLAGS_TO_PASS
) multi-do DO
=install
791 .PHONY
: install install-shared install-libunwind
793 # Don't export variables to the environment, in order to not confuse
797 include $(srcdir)/empty.mk
$(wildcard *.dep
)
800 # Garbage collect in gcc/:
801 # $(LIBGCC) settings in t-* are now unused
803 # Remove use of $(gcc_srcdir). Source files referenced using $(gcc_srcdir)
804 # should move into the libgcc directory.