compiler: Logical operators should yield untyped bool for untyped operands.
[official-gcc.git] / libgcc / Makefile.in
blob357e15c37614ce7a5dad44aaaeba9fc652314320
1 # Makefile.in
3 # Copyright (C) 2005-2014 Free Software Foundation, Inc.
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 3 of the License, or (at your option)
10 # any later version.
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
15 # more details.
17 # You should have received a copy of the GNU General Public License along
18 # with GCC; see the file COPYING3. If not see
19 # <http://www.gnu.org/licenses/>.
22 libgcc_topdir = @libgcc_topdir@
23 host_subdir = @host_subdir@
25 gcc_objdir = $(MULTIBUILDTOP)../../$(host_subdir)/gcc
27 srcdir = @srcdir@
29 prefix = @prefix@
31 exec_prefix = @exec_prefix@
32 libdir = @libdir@
33 shlib_slibdir = @slibdir@
35 SHELL = @SHELL@
37 cpu_type = @cpu_type@
38 enable_shared = @enable_shared@
39 double_type_size = @double_type_size@
40 long_double_type_size = @long_double_type_size@
41 decimal_float = @decimal_float@
42 enable_vtable_verify = @enable_vtable_verify@
43 enable_decimal_float = @enable_decimal_float@
44 fixed_point = @fixed_point@
46 host_noncanonical = @host_noncanonical@
47 target_noncanonical = @target_noncanonical@
49 # List of extra object files that should be compiled for this target machine.
50 # The rules for compiling them should be in the t-* file for the machine.
51 EXTRA_PARTS = @extra_parts@
53 FORCE_EXPLICIT_EH_REGISTRY = @force_explicit_eh_registry@
55 extra-parts = libgcc-extra-parts
57 # Multilib support variables.
58 MULTISRCTOP =
59 MULTIBUILDTOP =
60 MULTIDIRS =
61 MULTISUBDIR =
62 MULTIDO = true
63 MULTICLEAN = true
65 INSTALL = @INSTALL@
66 INSTALL_PROGRAM = @INSTALL_PROGRAM@
67 INSTALL_DATA = @INSTALL_DATA@
68 mkinstalldirs = $(SHELL) $(libgcc_topdir)/mkinstalldirs
69 INSTALL_PARTS = $(EXTRA_PARTS)
71 objext = .o
73 AR = @AR@
74 AR_FLAGS = rc
76 CC = @CC@
77 CFLAGS = @CFLAGS@
78 RANLIB = @RANLIB@
79 LN_S = @LN_S@
81 PWD_COMMAND = $${PWDCMD-pwd}
83 # Flags to pass to a recursive make.
84 FLAGS_TO_PASS = \
85 "AR=$(AR)" \
86 "AR_FLAGS=$(AR_FLAGS)" \
87 "CC=$(CC)" \
88 "CFLAGS=$(CFLAGS)" \
89 "DESTDIR=$(DESTDIR)" \
90 "EXTRA_OFILES=$(EXTRA_OFILES)" \
91 "HDEFINES=$(HDEFINES)" \
92 "INSTALL=$(INSTALL)" \
93 "INSTALL_DATA=$(INSTALL_DATA)" \
94 "INSTALL_PROGRAM=$(INSTALL_PROGRAM)" \
95 "LDFLAGS=$(LDFLAGS)" \
96 "LOADLIBES=$(LOADLIBES)" \
97 "RANLIB=$(RANLIB)" \
98 "SHELL=$(SHELL)" \
99 "prefix=$(prefix)" \
100 "exec_prefix=$(exec_prefix)" \
101 "libdir=$(libdir)" \
102 "libsubdir=$(libsubdir)" \
103 "tooldir=$(tooldir)"
105 # Dependencies for "all" are set later in the file.
106 all: all-multi
107 # Now that we have built all the objects, we need to copy
108 # them back to the GCC directory. Too many things (other
109 # in-tree libraries, and DejaGNU) know about the layout
110 # of the build tree, for now.
111 $(MAKE) install-leaf DESTDIR=$(gcc_objdir) \
112 slibdir= libsubdir= MULTIOSDIR=$(MULTIDIR)
114 .PHONY: all-multi
115 all-multi:
116 # If this is the top-level multilib, build all the other
117 # multilibs.
118 @: $(MAKE) ; exec $(MULTIDO) $(FLAGS_TO_PASS) multi-do DO=all
120 .PHONY: check installcheck
121 check:
122 installcheck:
124 .PHONY: all clean
126 clean:
127 -rm -f libgcc_tm.h libgcc.map
128 -rm -f libgcc_tm.stamp stmp-ldirs
129 -rm -f *$(objext)
130 -rm -f *.dep
131 -rm -f *.a
132 -rm -f libunwind$(SHLIB_EXT)
133 -rm -f libgcc_s*
134 @$(MULTICLEAN) multi-clean DO=clean
135 distclean: clean
136 @$(MULTICLEAN) multi-clean DO=distclean
137 -rm -f auto-target.h
138 -rm -f stamp-h
139 -rm -f *~ Makefile config.cache config.status multilib.out
140 -rm -f config.log
141 maintainer-clean realclean: distclean
143 Makefile: $(srcdir)/Makefile.in config.status
144 CONFIG_FILES=Makefile CONFIG_HEADERS= $(SHELL) ./config.status
146 # Depending on Makefile makes sure that config.status has been re-run
147 # if needed. This prevents problems with parallel builds.
148 auto-target.h: stamp-h ; @true
149 stamp-h: $(srcdir)/config.in config.status Makefile
150 CONFIG_FILES= CONFIG_HEADERS=auto-target.h:$(srcdir)/config.in $(SHELL) ./config.status
152 config.status: $(srcdir)/configure $(srcdir)/config.host
153 $(SHELL) ./config.status --recheck
155 AUTOCONF = autoconf
156 configure_deps = \
157 $(srcdir)/../config/enable.m4 \
158 $(srcdir)/../config/tls.m4 \
159 $(srcdir)/../config/acx.m4 \
160 $(srcdir)/../config/no-executables.m4 \
161 $(srcdir)/../config/override.m4 \
162 $(srcdir)/../config/dfp.m4 \
164 $(srcdir)/configure: @MAINT@ $(srcdir)/configure.ac $(configure_deps)
165 cd $(srcdir) && $(AUTOCONF)
167 include $(gcc_objdir)/libgcc.mvars
169 # Flags to pass to recursive makes.
171 AR_FOR_TARGET = $(AR)
172 AR_FLAGS_FOR_TARGET =
173 AR_CREATE_FOR_TARGET = $(AR_FOR_TARGET) $(AR_FLAGS_FOR_TARGET) rc
174 AR_EXTRACT_FOR_TARGET = $(AR_FOR_TARGET) $(AR_FLAGS_FOR_TARGET) x
175 AWK = @AWK@
176 GCC_FOR_TARGET = $(CC)
177 LIPO = @LIPO@
178 LIPO_FOR_TARGET = $(LIPO)
179 MACHMODE_H = machmode.h mode-classes.def insn-modes.h
180 NM = @NM@
181 NM_FOR_TARGET = $(NM)
182 RANLIB_FOR_TARGET = $(RANLIB)
183 STRIP = @STRIP@
184 STRIP_FOR_TARGET = $(STRIP)
186 # Directory in which the compiler finds libraries etc.
187 libsubdir = $(libdir)/gcc/$(host_noncanonical)/$(version)
188 # Used to install the shared libgcc.
189 slibdir = @slibdir@
190 # Maybe used for DLLs on Windows targets.
191 toolexecdir = @toolexecdir@
192 toolexeclibdir = @toolexeclibdir@
194 export AR_FOR_TARGET
195 export AR_CREATE_FOR_TARGET
196 export AR_FLAGS_FOR_TARGET
197 export AR_EXTRACT_FOR_TARGET
198 export AWK
199 export DESTDIR
200 export GCC_FOR_TARGET
201 export INCLUDES
202 export INSTALL_DATA
203 export LIB1ASMSRC
204 export LIBGCC2_CFLAGS
205 export LIPO_FOR_TARGET
206 export MACHMODE_H
207 export NM_FOR_TARGET
208 export STRIP_FOR_TARGET
209 export RANLIB_FOR_TARGET
210 export libsubdir
211 export slibdir
212 export toolexecdir
213 export toolexeclibdir
215 version := $(shell cat $(srcdir)/../gcc/BASE-VER)
217 ifeq ($(decimal_float),yes)
218 ifeq ($(enable_decimal_float),bid)
219 DECNUMINC = -I$(srcdir)/config/libbid -DENABLE_DECIMAL_BID_FORMAT
220 else
221 DECNUMINC = -I$(srcdir)/../libdecnumber/$(enable_decimal_float) \
222 -I$(srcdir)/../libdecnumber
223 endif
224 else
225 DECNUMINC =
226 endif
228 # Options to use when compiling libgcc2.a.
230 LIBGCC2_DEBUG_CFLAGS = -g
231 LIBGCC2_CFLAGS = -O2 $(LIBGCC2_INCLUDES) $(GCC_CFLAGS) $(HOST_LIBGCC2_CFLAGS) \
232 $(LIBGCC2_DEBUG_CFLAGS) -DIN_LIBGCC2 \
233 -fbuilding-libgcc -fno-stack-protector \
234 $(INHIBIT_LIBC_CFLAGS)
236 # Additional options to use when compiling libgcc2.a.
237 # Some targets override this to -isystem include
238 LIBGCC2_INCLUDES =
240 # Additional target-dependent options for compiling libgcc2.a.
241 HOST_LIBGCC2_CFLAGS =
243 PICFLAG = @PICFLAG@
245 # Defined in libgcc2.c, included only in the static library.
246 LIB2FUNCS_ST = _eprintf __gcc_bcmp
248 # List of functions not to build from libgcc2.c.
249 LIB2FUNCS_EXCLUDE =
251 # These might cause a divide overflow trap and so are compiled with
252 # unwinder info.
253 LIB2_DIVMOD_FUNCS = _divdi3 _moddi3 _udivdi3 _umoddi3 _udiv_w_sdiv _udivmoddi4
255 # List of extra C and assembler files to add to static and shared libgcc2.
256 # Assembler files should have names ending in `.S'.
257 LIB2ADD =
259 # List of extra C and assembler files to add to static libgcc2.
260 # Assembler files should have names ending in `.S'.
261 LIB2ADD_ST =
263 # Specify the directories to be searched for header files.
264 # Both . and srcdir are used, in that order,
265 # so that *config.h will be found in the compilation
266 # subdirectory rather than in the source directory.
267 # -I$(@D) and -I$(srcdir)/$(@D) cause the subdirectory of the file
268 # currently being compiled, in both source trees, to be examined as well.
269 INCLUDES = -I. -I$(@D) -I$(gcc_objdir) \
270 -I$(srcdir) -I$(srcdir)/$(@D) -I$(srcdir)/../gcc \
271 -I$(srcdir)/../include $(DECNUMINC)
273 # Forcibly remove any profiling-related flags. There is no point
274 # in supporting profiled bootstrap in this library.
275 override CFLAGS := $(filter-out -fprofile-generate -fprofile-use,$(CFLAGS))
277 # CFLAGS first is not perfect; normally setting CFLAGS should override any
278 # options in LIBGCC2_CFLAGS. But LIBGCC2_CFLAGS may contain -g0, and CFLAGS
279 # will usually contain -g, so for the moment CFLAGS goes first. We must
280 # include CFLAGS - that's where multilib options live.
281 INTERNAL_CFLAGS = $(CFLAGS) $(LIBGCC2_CFLAGS) $(HOST_LIBGCC2_CFLAGS) \
282 $(INCLUDES) @set_have_cc_tls@ @set_use_emutls@
284 # Options to use when compiling crtbegin/end.
285 CRTSTUFF_CFLAGS = -O2 $(GCC_CFLAGS) $(INCLUDES) $(MULTILIB_CFLAGS) -g0 \
286 -finhibit-size-directive -fno-inline -fno-exceptions \
287 -fno-zero-initialized-in-bss -fno-toplevel-reorder -fno-tree-vectorize \
288 -fbuilding-libgcc -fno-stack-protector $(FORCE_EXPLICIT_EH_REGISTRY) \
289 $(INHIBIT_LIBC_CFLAGS)
291 # Extra flags to use when compiling crt{begin,end}.o.
292 CRTSTUFF_T_CFLAGS =
294 MULTIDIR := $(shell $(CC) $(CFLAGS) -print-multi-directory)
295 MULTIOSDIR := $(shell $(CC) $(CFLAGS) -print-multi-os-directory)
297 MULTIOSSUBDIR := $(shell if test $(MULTIOSDIR) != .; then echo /$(MULTIOSDIR); fi)
298 inst_libdir = $(libsubdir)$(MULTISUBDIR)
299 inst_slibdir = $(slibdir)$(MULTIOSSUBDIR)
301 gcc_compile_bare = $(CC) $(INTERNAL_CFLAGS)
302 compile_deps = -MT $@ -MD -MP -MF $(basename $@).dep
303 gcc_compile = $(gcc_compile_bare) -o $@ $(compile_deps)
304 gcc_s_compile = $(gcc_compile) -DSHARED
306 objects = $(filter %$(objext),$^)
308 # Collect any host-specific information from Makefile fragments.
310 LIBGCC_VER_GNU_PREFIX = __
311 LIBGCC_VER_FIXEDPOINT_GNU_PREFIX = __
312 LIBGCC_VER_SYMBOLS_PREFIX =
314 FPBIT_FUNCS = _pack_sf _unpack_sf _addsub_sf _mul_sf _div_sf \
315 _fpcmp_parts_sf _compare_sf _eq_sf _ne_sf _gt_sf _ge_sf \
316 _lt_sf _le_sf _unord_sf _si_to_sf _sf_to_si _negate_sf _make_sf \
317 _sf_to_df _sf_to_tf _thenan_sf _sf_to_usi _usi_to_sf
319 DPBIT_FUNCS = _pack_df _unpack_df _addsub_df _mul_df _div_df \
320 _fpcmp_parts_df _compare_df _eq_df _ne_df _gt_df _ge_df \
321 _lt_df _le_df _unord_df _si_to_df _df_to_si _negate_df _make_df \
322 _df_to_sf _df_to_tf _thenan_df _df_to_usi _usi_to_df
324 TPBIT_FUNCS = _pack_tf _unpack_tf _addsub_tf _mul_tf _div_tf \
325 _fpcmp_parts_tf _compare_tf _eq_tf _ne_tf _gt_tf _ge_tf \
326 _lt_tf _le_tf _unord_tf _si_to_tf _tf_to_si _negate_tf _make_tf \
327 _tf_to_df _tf_to_sf _thenan_tf _tf_to_usi _usi_to_tf
329 # Additional sources to handle exceptions; overridden by targets as needed.
330 LIB2ADDEH = $(srcdir)/unwind-dw2.c $(srcdir)/unwind-dw2-fde.c \
331 $(srcdir)/unwind-sjlj.c $(srcdir)/unwind-c.c
332 LIB2ADDEHSTATIC = $(LIB2ADDEH)
333 LIB2ADDEHSHARED = $(LIB2ADDEH)
335 # nm flags to list global symbols in libgcc object files.
336 SHLIB_NM_FLAGS = -pg
338 # Don't build libunwind by default.
339 LIBUNWIND =
340 SHLIBUNWIND_LINK =
341 SHLIBUNWIND_INSTALL =
343 tmake_file = @tmake_file@
344 include $(srcdir)/empty.mk $(tmake_file)
346 # Collect target defines and headers from config.host.
347 libgcc_tm_defines = @tm_defines@
348 libgcc_tm_file = @tm_file@
349 libgcc_tm.h: libgcc_tm.stamp; @true
350 libgcc_tm.stamp:
351 DEFINES='$(libgcc_tm_defines)' HEADERS='$(libgcc_tm_file)' \
352 $(srcdir)/mkheader.sh > tmp-libgcc_tm.h
353 $(SHELL) $(srcdir)/../move-if-change tmp-libgcc_tm.h libgcc_tm.h
354 echo timestamp > $@
356 # Only handle shared libraries if both:
357 # - the user requested them
358 # - we know how to build them
359 ifeq ($(SHLIB_LINK),)
360 enable_shared := no
361 endif
363 ifeq ($(enable_shared),yes)
364 iterator = $(srcdir)/empty.mk $(patsubst %,$(srcdir)/shared-object.mk,$(iter-items))
366 install-shared = install-shared
368 ifneq ($(LIBUNWIND),)
369 install-libunwind = install-libunwind
370 endif
371 endif
373 # For -fvisibility=hidden. We need both a -fvisibility=hidden on
374 # the command line, and a #define to prevent libgcc2.h etc from
375 # overriding that with #pragmas.
376 vis_hide = @vis_hide@
378 ifneq (,$(vis_hide))
380 # If we have -fvisibility=hidden, then we need to generate hide
381 # lists for object files implemented in assembly.
382 ASM_HIDDEN_OP = @asm_hidden_op@
384 define gen-hide-list
385 $(NM) -pg $< | \
386 $(AWK) 'NF == 3 && $$2 !~ /^[UN]$$/ && $$3 !~ /.*_compat/ \
387 && $$3 !~ /.*@.*/ \
388 { print "\t$(ASM_HIDDEN_OP)", $$3 }' > $@T
389 mv -f $@T $@
390 endef
391 else
392 gen-hide-list = echo > $@
393 endif
395 ifneq ($(enable_shared),yes)
396 iterator = $(srcdir)/empty.mk $(patsubst %,$(srcdir)/static-object.mk,$(iter-items))
397 endif
399 LIB2ADD += enable-execute-stack.c
401 # While emutls.c has nothing to do with EH, it is in LIB2ADDEH*
402 # instead of LIB2ADD because that's the way to be sure on some targets
403 # (e.g. *-*-darwin*) only one copy of it is linked.
404 LIB2ADDEH += $(srcdir)/emutls.c
405 LIB2ADDEHSTATIC += $(srcdir)/emutls.c
406 LIB2ADDEHSHARED += $(srcdir)/emutls.c
408 # Library members defined in libgcc2.c.
409 lib2funcs = _muldi3 _negdi2 _lshrdi3 _ashldi3 _ashrdi3 _cmpdi2 _ucmpdi2 \
410 _clear_cache _trampoline __main _absvsi2 \
411 _absvdi2 _addvsi3 _addvdi3 _subvsi3 _subvdi3 _mulvsi3 _mulvdi3 \
412 _negvsi2 _negvdi2 _ctors _ffssi2 _ffsdi2 _clz _clzsi2 _clzdi2 \
413 _ctzsi2 _ctzdi2 _popcount_tab _popcountsi2 _popcountdi2 \
414 _paritysi2 _paritydi2 _powisf2 _powidf2 _powixf2 _powitf2 \
415 _mulsc3 _muldc3 _mulxc3 _multc3 _divsc3 _divdc3 _divxc3 \
416 _divtc3 _bswapsi2 _bswapdi2 _clrsbsi2 _clrsbdi2
418 # The floating-point conversion routines that involve a single-word integer.
419 # XX stands for the integer mode.
420 swfloatfuncs = $(patsubst %,_fixuns%XX,sf df xf)
422 # Likewise double-word routines.
423 dwfloatfuncs = $(patsubst %,_fix%XX,sf df xf tf) \
424 $(patsubst %,_fixuns%XX,sf df xf tf) \
425 $(patsubst %,_floatXX%,sf df xf tf) \
426 $(patsubst %,_floatunXX%,sf df xf tf)
428 ifeq ($(LIB2_SIDITI_CONV_FUNCS),)
429 lib2funcs += $(subst XX,si,$(swfloatfuncs))
430 lib2funcs += $(subst XX,di,$(dwfloatfuncs))
431 endif
433 # These might cause a divide overflow trap and so are compiled with
434 # unwinder info.
435 LIB2_DIVMOD_FUNCS = _divdi3 _moddi3 _udivdi3 _umoddi3 _udiv_w_sdiv _udivmoddi4
437 # Remove any objects from lib2funcs and LIB2_DIVMOD_FUNCS that are
438 # defined as optimized assembly code in LIB1ASMFUNCS or as C code
439 # in LIB2FUNCS_EXCLUDE.
440 lib2funcs := $(filter-out $(LIB2FUNCS_EXCLUDE) $(LIB1ASMFUNCS),$(lib2funcs))
441 LIB2_DIVMOD_FUNCS := $(filter-out $(LIB2FUNCS_EXCLUDE) $(LIB1ASMFUNCS), \
442 $(LIB2_DIVMOD_FUNCS))
444 # Build "libgcc1" (assembly) components.
446 lib1asmfuncs-o = $(patsubst %,%$(objext),$(LIB1ASMFUNCS))
447 $(lib1asmfuncs-o): %$(objext): $(srcdir)/config/$(LIB1ASMSRC) %.vis
448 $(gcc_compile) -DL$* -xassembler-with-cpp -c $< -include $*.vis
449 $(patsubst %,%.vis,$(LIB1ASMFUNCS)): %.vis: %_s$(objext)
450 $(gen-hide-list)
451 libgcc-objects += $(lib1asmfuncs-o)
453 lib1asmfuncs-s-o = $(patsubst %,%_s$(objext),$(LIB1ASMFUNCS))
454 $(lib1asmfuncs-s-o): %_s$(objext): $(srcdir)/config/$(LIB1ASMSRC)
455 $(gcc_s_compile) -DL$* -xassembler-with-cpp -c $<
456 ifeq ($(enable_shared),yes)
458 libgcc-s-objects += $(lib1asmfuncs-s-o)
460 endif
462 # Build lib2funcs. For the static library also include LIB2FUNCS_ST.
463 lib2funcs-o = $(patsubst %,%$(objext),$(lib2funcs) $(LIB2FUNCS_ST))
464 $(lib2funcs-o): %$(objext): $(srcdir)/libgcc2.c
465 $(gcc_compile) -DL$* -c $< $(vis_hide)
466 libgcc-objects += $(lib2funcs-o)
468 ifeq ($(enable_shared),yes)
469 lib2funcs-s-o = $(patsubst %,%_s$(objext),$(lib2funcs))
470 $(lib2funcs-s-o): %_s$(objext): $(srcdir)/libgcc2.c
471 $(gcc_s_compile) -DL$* -c $<
472 libgcc-s-objects += $(lib2funcs-s-o)
473 endif
475 ifneq ($(LIB2_SIDITI_CONV_FUNCS),)
476 # Build libgcc2.c for each conversion function, with a specific
477 # L<func> definition and LIBGCC2_UNITS_PER_WORD setting. The DImode
478 # functions are built with a wordsize of 4; the TImode functions are
479 # built with the same labels, but a wordsize of 8.
481 sifuncs := $(filter-out $(LIB2FUNCS_EXCLUDE),$(subst XX,si,$(swfloatfuncs)))
482 difuncs := $(filter-out $(LIB2FUNCS_EXCLUDE),$(subst XX,di,$(dwfloatfuncs)))
483 tifuncs := $(filter-out $(LIB2FUNCS_EXCLUDE),$(subst XX,ti,$(dwfloatfuncs)))
485 iter-items := $(sifuncs) $(difuncs) $(tifuncs)
486 iter-labels := $(sifuncs) $(difuncs) $(difuncs)
487 iter-sizes := $(patsubst %,4,$(sifuncs) $(difuncs)) $(patsubst %,8,$(tifuncs))
489 include $(srcdir)/empty.mk $(patsubst %,$(srcdir)/siditi-object.mk,$(iter-items))
491 libgcc-objects += $(patsubst %,%$(objext),$(sifuncs) $(difuncs) $(tifuncs))
492 ifeq ($(enable_shared),yes)
493 libgcc-s-objects += $(patsubst %,%_s$(objext),$(sifuncs) $(difuncs) $(tifuncs))
494 endif
495 endif
497 ifeq ($(LIB2_DIVMOD_EXCEPTION_FLAGS),)
498 # Provide default flags for compiling divmod functions, if they haven't been
499 # set already by a target-specific Makefile fragment.
500 LIB2_DIVMOD_EXCEPTION_FLAGS := -fexceptions -fnon-call-exceptions
501 endif
503 # Build LIB2_DIVMOD_FUNCS.
504 lib2-divmod-o = $(patsubst %,%$(objext),$(LIB2_DIVMOD_FUNCS))
505 $(lib2-divmod-o): %$(objext): $(srcdir)/libgcc2.c
506 $(gcc_compile) -DL$* -c $< \
507 $(LIB2_DIVMOD_EXCEPTION_FLAGS) $(vis_hide)
508 libgcc-objects += $(lib2-divmod-o)
510 ifeq ($(enable_shared),yes)
511 lib2-divmod-s-o = $(patsubst %,%_s$(objext),$(LIB2_DIVMOD_FUNCS))
512 $(lib2-divmod-s-o): %_s$(objext): $(srcdir)/libgcc2.c
513 $(gcc_s_compile) -DL$* -c $< \
514 $(LIB2_DIVMOD_EXCEPTION_FLAGS)
515 libgcc-s-objects += $(lib2-divmod-s-o)
516 endif
518 ifeq ($(TPBIT),)
519 # _sf_to_tf and _df_to_tf require tp-bit.c being compiled in.
520 FPBIT_FUNCS := $(filter-out _sf_to_tf,$(FPBIT_FUNCS))
521 DPBIT_FUNCS := $(filter-out _df_to_tf,$(DPBIT_FUNCS))
522 endif
524 FPBIT_FUNCS := $(filter-out $(LIB2FUNCS_EXCLUDE),$(FPBIT_FUNCS))
525 DPBIT_FUNCS := $(filter-out $(LIB2FUNCS_EXCLUDE),$(DPBIT_FUNCS))
526 TPBIT_FUNCS := $(filter-out $(LIB2FUNCS_EXCLUDE),$(TPBIT_FUNCS))
528 fpbit-src := $(srcdir)/fp-bit.c
530 # Build FPBIT.
531 ifneq ($(FPBIT),)
532 fpbit-o = $(patsubst %,%$(objext),$(FPBIT_FUNCS))
533 $(fpbit-o): %$(objext): $(fpbit-src)
534 $(gcc_compile) -DFINE_GRAINED_LIBRARIES -DL$* -DFLOAT $(FPBIT_CFLAGS) -c $< $(vis_hide)
535 libgcc-objects += $(fpbit-o)
537 ifeq ($(enable_shared),yes)
538 fpbit-s-o = $(patsubst %,%_s$(objext),$(FPBIT_FUNCS))
539 $(fpbit-s-o): %_s$(objext): $(fpbit-src)
540 $(gcc_s_compile) -DFINE_GRAINED_LIBRARIES -DL$* -DFLOAT $(FPBIT_CFLAGS) -c $<
541 libgcc-s-objects += $(fpbit-s-o)
542 endif
543 endif
545 # Build DPBIT.
546 ifneq ($(DPBIT),)
547 dpbit-o = $(patsubst %,%$(objext),$(DPBIT_FUNCS))
548 $(dpbit-o): %$(objext): $(fpbit-src)
549 $(gcc_compile) -DFINE_GRAINED_LIBRARIES -DL$* $(DPBIT_CFLAGS) -c $< $(vis_hide)
550 libgcc-objects += $(dpbit-o)
552 ifeq ($(enable_shared),yes)
553 dpbit-s-o = $(patsubst %,%_s$(objext),$(DPBIT_FUNCS))
554 $(dpbit-s-o): %_s$(objext): $(fpbit-src)
555 $(gcc_s_compile) -DFINE_GRAINED_LIBRARIES -DL$* $(DPBIT_CFLAGS) -c $<
556 libgcc-s-objects += $(dpbit-s-o)
557 endif
558 endif
560 # Build TPBIT.
561 ifneq ($(TPBIT),)
562 tpbit-o = $(patsubst %,%$(objext),$(TPBIT_FUNCS))
563 $(tpbit-o): %$(objext): $(fpbit-src)
564 $(gcc_compile) -DFINE_GRAINED_LIBRARIES -DL$* -DTFLOAT $(TPBIT_CFLAGS) -c $< $(vis_hide)
565 libgcc-objects += $(tpbit-o)
567 ifeq ($(enable_shared),yes)
568 tpbit-s-o = $(patsubst %,%_s$(objext),$(TPBIT_FUNCS))
569 $(tpbit-s-o): %_s$(objext): $(fpbit-src)
570 $(gcc_s_compile) -DFINE_GRAINED_LIBRARIES -DL$* -DTFLOAT $(TPBIT_CFLAGS) -c $<
571 libgcc-s-objects += $(tpbit-s-o)
572 endif
573 endif
575 # Build decimal floating point support.
576 ifeq ($(decimal_float),yes)
578 # If $DFP_ENABLE is set, then we want all data type sizes.
579 ifneq ($(DFP_ENABLE),)
580 D32PBIT = 1
581 D64PBIT = 1
582 D128PBIT = 1
583 endif
585 dfp-filenames =
586 ifneq ($(D32PBIT)$(D64PBIT)$(D128PBIT),)
587 ifeq ($(enable_decimal_float),bid)
588 dfp-filenames += bid_decimal_globals bid_decimal_data \
589 bid_binarydecimal bid_convert_data \
590 _isinfd32 _isinfd64 _isinfd128 bid64_noncomp \
591 bid128_noncomp bid128_fma bid_round bid_from_int \
592 bid64_add bid128_add bid64_div bid128_div \
593 bid64_mul bid128_mul bid64_compare bid128_compare \
594 bid128 bid32_to_bid64 bid32_to_bid128 bid64_to_bid128 \
595 bid64_to_int32 bid64_to_int64 \
596 bid64_to_uint32 bid64_to_uint64 \
597 bid128_to_int32 bid128_to_int64 \
598 bid128_to_uint32 bid128_to_uint64
599 else
600 dfp-filenames += decContext decNumber decExcept decRound decLibrary decDouble decPacked decQuad decSingle
601 endif
602 endif
604 dfp-objects = $(patsubst %,%$(objext),$(dfp-filenames))
605 ifeq ($(enable_decimal_float),bid)
606 $(dfp-objects): %$(objext): $(srcdir)/config/libbid/%.c
607 else
608 $(dfp-objects): %$(objext): $(srcdir)/../libdecnumber/%.c
609 endif
610 $(gcc_compile) -c $<
611 libgcc-objects += $(dfp-objects)
613 decbits-filenames =
614 ifneq ($(enable_decimal_float),bid)
615 ifneq ($(D32PBIT),)
616 decbits-filenames += decimal32
617 endif
619 ifneq ($(D64PBIT),)
620 decbits-filenames += decimal64
621 endif
623 ifneq ($(D128PBIT),)
624 decbits-filenames += decimal128
625 endif
626 endif
628 decbits-objects = $(patsubst %,%$(objext),$(decbits-filenames))
629 ifeq ($(enable_decimal_float),bid)
630 $(decbits-objects): %$(objext): $(srcdir)/config/libbid/%.c
631 else
632 $(decbits-objects): %$(objext): $(srcdir)/../libdecnumber/$(enable_decimal_float)/%.c
633 endif
634 $(gcc_compile) -c $<
635 libgcc-objects += $(decbits-objects)
637 # Next build individual support functions.
638 D32PBIT_FUNCS = _addsub_sd _div_sd _mul_sd _plus_sd _minus_sd \
639 _eq_sd _ne_sd _lt_sd _gt_sd _le_sd _ge_sd \
640 _sd_to_si _sd_to_di _sd_to_usi _sd_to_udi \
641 _si_to_sd _di_to_sd _usi_to_sd _udi_to_sd \
642 _sd_to_sf _sd_to_df _sd_to_xf _sd_to_tf \
643 _sf_to_sd _df_to_sd _xf_to_sd _tf_to_sd \
644 _sd_to_dd _sd_to_td _unord_sd _conv_sd
646 D64PBIT_FUNCS = _addsub_dd _div_dd _mul_dd _plus_dd _minus_dd \
647 _eq_dd _ne_dd _lt_dd _gt_dd _le_dd _ge_dd \
648 _dd_to_si _dd_to_di _dd_to_usi _dd_to_udi \
649 _si_to_dd _di_to_dd _usi_to_dd _udi_to_dd \
650 _dd_to_sf _dd_to_df _dd_to_xf _dd_to_tf \
651 _sf_to_dd _df_to_dd _xf_to_dd _tf_to_dd \
652 _dd_to_sd _dd_to_td _unord_dd _conv_dd
654 D128PBIT_FUNCS = _addsub_td _div_td _mul_td _plus_td _minus_td \
655 _eq_td _ne_td _lt_td _gt_td _le_td _ge_td \
656 _td_to_si _td_to_di _td_to_usi _td_to_udi \
657 _si_to_td _di_to_td _usi_to_td _udi_to_td \
658 _td_to_sf _td_to_df _td_to_xf _td_to_tf \
659 _sf_to_td _df_to_td _xf_to_td _tf_to_td \
660 _td_to_sd _td_to_dd _unord_td _conv_td
662 ifeq ($(enable_decimal_float),bid)
663 ifneq ($(D32PBIT),)
664 D32PBIT_FUNCS:=$(filter-out _plus_sd _minus_sd _conv_sd, $(D32PBIT_FUNCS))
665 endif
667 ifneq ($(D64PBIT),)
668 D64PBIT_FUNCS:=$(filter-out _plus_dd _minus_dd _conv_dd, $(D64PBIT_FUNCS))
669 endif
671 ifneq ($(D128PBIT),)
672 D128PBIT_FUNCS:=$(filter-out _plus_td _minus_td _conv_td, $(D128PBIT_FUNCS))
673 endif
674 endif
676 ifneq ($(D32PBIT),)
677 d32pbit-o = $(patsubst %,%$(objext),$(D32PBIT_FUNCS))
678 ifeq ($(enable_decimal_float),bid)
679 $(d32pbit-o): %$(objext): $(srcdir)/config/libbid/%.c
680 else
681 $(d32pbit-o): %$(objext): $(srcdir)/dfp-bit.c
682 endif
683 $(gcc_compile) -DFINE_GRAINED_LIBRARIES -DL$* -DWIDTH=32 -c $<
684 libgcc-objects += $(d32pbit-o)
685 endif
687 ifneq ($(D64PBIT),)
688 d64pbit-o = $(patsubst %,%$(objext),$(D64PBIT_FUNCS))
689 ifeq ($(enable_decimal_float),bid)
690 $(d64pbit-o): %$(objext): $(srcdir)/config/libbid/%.c
691 else
692 $(d64pbit-o): %$(objext): $(srcdir)/dfp-bit.c
693 endif
694 $(gcc_compile) -DFINE_GRAINED_LIBRARIES -DL$* -DWIDTH=64 -c $<
695 libgcc-objects += $(d64pbit-o)
696 endif
698 ifneq ($(D128PBIT),)
699 d128pbit-o = $(patsubst %,%$(objext),$(D128PBIT_FUNCS))
700 ifeq ($(enable_decimal_float),bid)
701 $(d128pbit-o): %$(objext): $(srcdir)/config/libbid/%.c
702 else
703 $(d128pbit-o): %$(objext): $(srcdir)/dfp-bit.c
704 endif
705 $(gcc_compile) -DFINE_GRAINED_LIBRARIES -DL$* -DWIDTH=128 -c $<
706 libgcc-objects += $(d128pbit-o)
707 endif
709 endif
711 ifeq ($(SYNC),yes)
712 libgcc-sync-size-funcs := $(foreach op, add sub or and xor nand, \
713 sync_fetch_and_$(op) \
714 sync_$(op)_and_fetch) \
715 sync_bool_compare_and_swap \
716 sync_val_compare_and_swap \
717 sync_lock_test_and_set
719 libgcc-sync-size-funcs := $(foreach prefix, $(libgcc-sync-size-funcs), \
720 $(foreach suffix, 1 2 4 8 16, \
721 $(prefix)_$(suffix)))
723 libgcc-sync-size-funcs-o = $(patsubst %,%$(objext),$(libgcc-sync-size-funcs))
724 $(libgcc-sync-size-funcs-o): %$(objext): $(srcdir)/sync.c
725 $(gcc_compile) $(SYNC_CFLAGS) \
726 -DFN=`echo "$*" | sed 's/_[^_]*$$//'` \
727 -DSIZE=`echo "$*" | sed 's/.*_//'` \
728 -c $< $(vis_hide)
729 libgcc-objects += $(libgcc-sync-size-funcs-o)
731 libgcc-sync-funcs := sync_synchronize
733 libgcc-sync-funcs-o = $(patsubst %,%$(objext),$(libgcc-sync-funcs))
734 $(libgcc-sync-funcs-o): %$(objext): $(srcdir)/sync.c
735 $(gcc_compile) $(SYNC_CFLAGS) \
736 -DL$* \
737 -c $< $(vis_hide)
738 libgcc-objects += $(libgcc-sync-funcs-o)
740 ifeq ($(enable_shared),yes)
741 libgcc-sync-size-funcs-s-o = $(patsubst %,%_s$(objext), \
742 $(libgcc-sync-size-funcs))
743 $(libgcc-sync-size-funcs-s-o): %_s$(objext): $(srcdir)/sync.c
744 $(gcc_s_compile) $(SYNC_CFLAGS) \
745 -DFN=`echo "$*" | sed 's/_[^_]*$$//'` \
746 -DSIZE=`echo "$*" | sed 's/.*_//'` \
747 -c $<
748 libgcc-s-objects += $(libgcc-sync-size-funcs-s-o)
750 libgcc-sync-funcs-s-o = $(patsubst %,%_s$(objext),$(libgcc-sync-funcs))
751 $(libgcc-sync-funcs-s-o): %_s$(objext): $(srcdir)/sync.c
752 $(gcc_s_compile) $(SYNC_CFLAGS) \
753 -DL$* \
754 -c $<
755 libgcc-s-objects += $(libgcc-sync-funcs-s-o)
756 endif
757 endif
759 # Build fixed-point support.
760 ifeq ($(fixed_point),yes)
762 # Generate permutations of function name and mode
763 fixed-labels := $(shell $(SHELL) $(srcdir)/gen-fixed.sh arith labels)
764 fixed-funcs := $(shell $(SHELL) $(srcdir)/gen-fixed.sh arith funcs)
765 fixed-modes := $(shell $(SHELL) $(srcdir)/gen-fixed.sh arith modes)
767 # Generate the rules for each arithmetic function
768 iter-items := $(fixed-funcs)
769 iter-labels := $(fixed-labels)
770 iter-from := $(fixed-modes)
771 iter-to := $(fixed-modes)
772 include $(srcdir)/empty.mk $(patsubst %,$(srcdir)/fixed-obj.mk,$(iter-items))
774 # Add arithmetic functions to list of objects to be built
775 libgcc-objects += $(patsubst %,%$(objext),$(filter-out $(LIB2FUNCS_EXCLUDE),$(fixed-funcs)))
776 ifeq ($(enable_shared),yes)
777 libgcc-s-objects += $(patsubst %,%_s$(objext),$(filter-out $(LIB2FUNCS_EXCLUDE),$(fixed-funcs)))
778 endif
780 # Convert from or to fractional
781 fixed-conv-funcs := $(shell $(SHELL) $(srcdir)/gen-fixed.sh conv funcs)
782 fixed-conv-labels := $(shell $(SHELL) $(srcdir)/gen-fixed.sh conv labels)
783 fixed-conv-from := $(shell $(SHELL) $(srcdir)/gen-fixed.sh conv from)
784 fixed-conv-to := $(shell $(SHELL) $(srcdir)/gen-fixed.sh conv to)
786 # Generate the make rules for each conversion function
787 iter-items := $(fixed-conv-funcs)
788 iter-labels := $(fixed-conv-labels)
789 iter-from := $(fixed-conv-from)
790 iter-to := $(fixed-conv-to)
791 include $(srcdir)/empty.mk $(patsubst %,$(srcdir)/fixed-obj.mk,$(iter-items))
793 # Add conversion functions to list of objects to be built
794 libgcc-objects += $(patsubst %,%$(objext),$(filter-out $(LIB2FUNCS_EXCLUDE),$(fixed-conv-funcs)))
795 ifeq ($(enable_shared),yes)
796 libgcc-s-objects += $(patsubst %,%_s$(objext),$(filter-out $(LIB2FUNCS_EXCLUDE),$(fixed-conv-funcs)))
797 endif
799 endif
801 # Build LIB2ADD and LIB2ADD_ST.
802 ifneq ($(filter-out %.c %.S %.asm,$(LIB2ADD) $(LIB2ADD_ST)),)
803 $(error Unsupported files in LIB2ADD or LIB2ADD_ST.)
804 endif
806 libgcc-objects += $(addsuffix $(objext),$(basename $(notdir $(LIB2ADD))))
807 libgcc-objects += $(addsuffix $(objext),$(basename $(notdir $(LIB2ADD_ST))))
809 c_flags :=
810 iter-items := $(LIB2ADD) $(LIB2ADD_ST)
811 include $(iterator)
813 ifeq ($(enable_shared),yes)
814 libgcc-s-objects += $(addsuffix _s$(objext),$(basename $(notdir $(LIB2ADD))))
815 endif
817 # Build LIB2ADDEH, LIB2ADDEHSTATIC, and LIB2ADDEHSHARED. If we don't have
818 # libgcc_eh.a, only LIB2ADDEH matters. If we do, only LIB2ADDEHSTATIC and
819 # LIB2ADDEHSHARED matter. (Usually all three are identical.)
821 c_flags := -fexceptions
823 ifeq ($(enable_shared),yes)
825 libgcc-eh-objects += $(addsuffix $(objext),$(basename $(notdir $(LIB2ADDEHSTATIC))))
826 libgcc-s-objects += $(addsuffix _s$(objext),$(basename $(notdir $(LIB2ADDEHSHARED))))
828 iter-items := $(sort $(LIB2ADDEHSTATIC) $(LIB2ADDEHSHARED))
829 include $(iterator)
831 else
832 # Not shared. LIB2ADDEH are added to libgcc.a.
834 libgcc-objects += $(addsuffix $(objext),$(basename $(notdir $(LIB2ADDEH))))
836 iter-items := $(LIB2ADDEH)
837 include $(iterator)
839 endif
841 # Build LIBUNWIND. Use -fno-exceptions so that the unwind library does
842 # not generate calls to __gcc_personality_v0.
844 c_flags := -fno-exceptions
846 libunwind-objects += $(addsuffix $(objext),$(basename $(notdir $(LIBUNWIND))))
848 ifeq ($(enable_shared),yes)
849 libunwind-s-objects += $(addsuffix _s$(objext),$(basename $(notdir $(LIBUNWIND))))
850 endif
852 iter-items := $(LIBUNWIND)
853 include $(iterator)
855 # Build libgcov components.
857 LIBGCOV_MERGE = _gcov_merge_add _gcov_merge_single _gcov_merge_delta \
858 _gcov_merge_ior _gcov_merge_time_profile _gcov_merge_icall_topn
859 LIBGCOV_PROFILER = _gcov_interval_profiler _gcov_pow2_profiler \
860 _gcov_one_value_profiler _gcov_indirect_call_profiler \
861 _gcov_average_profiler _gcov_ior_profiler \
862 _gcov_indirect_call_profiler_v2 _gcov_time_profiler \
863 _gcov_indirect_call_topn_profiler
864 LIBGCOV_INTERFACE = _gcov_dump _gcov_flush _gcov_fork \
865 _gcov_execl _gcov_execlp \
866 _gcov_execle _gcov_execv _gcov_execvp _gcov_execve _gcov_reset
867 LIBGCOV_DRIVER = _gcov
869 libgcov-merge-objects = $(patsubst %,%$(objext),$(LIBGCOV_MERGE))
870 libgcov-profiler-objects = $(patsubst %,%$(objext),$(LIBGCOV_PROFILER))
871 libgcov-interface-objects = $(patsubst %,%$(objext),$(LIBGCOV_INTERFACE))
872 libgcov-driver-objects = $(patsubst %,%$(objext),$(LIBGCOV_DRIVER))
873 libgcov-objects = $(libgcov-merge-objects) $(libgcov-profiler-objects) \
874 $(libgcov-interface-objects) $(libgcov-driver-objects)
876 $(libgcov-merge-objects): %$(objext): $(srcdir)/libgcov-merge.c $(srcdir)/libgcov.h
877 $(gcc_compile) -DL$* -c $(srcdir)/libgcov-merge.c
878 $(libgcov-profiler-objects): %$(objext): $(srcdir)/libgcov-profiler.c $(srcdir)/libgcov.h
879 $(gcc_compile) -DL$* -c $(srcdir)/libgcov-profiler.c
880 $(libgcov-interface-objects): %$(objext): $(srcdir)/libgcov-interface.c $(srcdir)/libgcov.h
881 $(gcc_compile) -DL$* -c $(srcdir)/libgcov-interface.c
882 $(libgcov-driver-objects): %$(objext): $(srcdir)/libgcov-driver.c \
883 $(srcdir)/libgcov-driver-system.c $(srcdir)/libgcov.h
884 $(gcc_compile) -DL$* -c $(srcdir)/libgcov-driver.c
887 # Static libraries.
888 libgcc.a: $(libgcc-objects)
889 libgcov.a: $(libgcov-objects)
890 libunwind.a: $(libunwind-objects)
891 libgcc_eh.a: $(libgcc-eh-objects)
893 libgcc.a libgcov.a libunwind.a libgcc_eh.a:
894 -rm -f $@
896 objects="$(objects)"; \
897 if test -z "$$objects"; then \
898 echo 'int __libgcc_eh_dummy;' > eh_dummy.c; \
899 $(gcc_compile_bare) $(vis_hide) -c eh_dummy.c \
900 -o eh_dummy$(objext); \
901 objects=eh_dummy$(objext); \
902 fi; \
903 $(AR_CREATE_FOR_TARGET) $@ $$objects
905 $(RANLIB) $@
907 all: libgcc.a libgcov.a
909 ifneq ($(LIBUNWIND),)
910 all: libunwind.a
911 libgcc_s$(SHLIB_EXT): libunwind$(SHLIB_EXT)
912 endif
914 ifeq ($(enable_shared),yes)
915 all: libgcc_eh.a libgcc_s$(SHLIB_EXT)
916 ifneq ($(LIBUNWIND),)
917 all: libunwind$(SHLIB_EXT)
918 endif
919 endif
921 ifeq ($(enable_shared),yes)
923 # Map-file generation.
924 ifneq ($(SHLIB_MKMAP),)
925 libgcc.map.in: $(SHLIB_MAPFILES)
926 { cat $(SHLIB_MAPFILES) \
927 | sed -e '/^[ ]*#/d' \
928 -e 's/^%\(if\|else\|elif\|endif\|define\)/#\1/' \
929 | $(gcc_compile_bare) -E -xassembler-with-cpp -; \
930 } > tmp-$@
931 mv tmp-$@ $@
932 libgcc.map: $(SHLIB_MKMAP) libgcc.map.in $(libgcc-s-objects)
933 { $(NM) $(SHLIB_NM_FLAGS) $(libgcc-s-objects); echo %%; \
934 cat libgcc.map.in; \
935 } | $(AWK) -f $(SHLIB_MKMAP) $(SHLIB_MKMAP_OPTS) > tmp-$@
936 mv tmp-$@ $@
937 libgcc_s$(SHLIB_EXT): libgcc.map
938 mapfile = libgcc.map
939 endif
941 libgcc-std.ver: $(srcdir)/libgcc-std.ver.in
942 sed -e 's/__PFX__/$(LIBGCC_VER_GNU_PREFIX)/g' \
943 -e 's/__FIXPTPFX__/$(LIBGCC_VER_FIXEDPOINT_GNU_PREFIX)/g' < $< > $@
945 libgcc_s$(SHLIB_EXT): $(libgcc-s-objects) $(extra-parts) libgcc.a
946 # @multilib_flags@ is still needed because this may use
947 # $(GCC_FOR_TARGET) and $(LIBGCC2_CFLAGS) directly.
948 # @multilib_dir@ is not really necessary, but sometimes it has
949 # more uses than just a directory name.
950 $(mkinstalldirs) $(MULTIDIR)
951 $(subst @multilib_flags@,$(CFLAGS) -B./,$(subst \
952 @multilib_dir@,$(MULTIDIR),$(subst \
953 @shlib_objs@,$(objects) libgcc.a,$(subst \
954 @shlib_base_name@,libgcc_s,$(subst \
955 @shlib_map_file@,$(mapfile),$(subst \
956 @shlib_slibdir_qual@,$(MULTIOSSUBDIR),$(subst \
957 @shlib_slibdir@,$(shlib_slibdir),$(SHLIB_LINK))))))))
959 libunwind$(SHLIB_EXT): $(libunwind-s-objects) $(extra-parts)
960 # @multilib_flags@ is still needed because this may use
961 # $(GCC_FOR_TARGET) and $(LIBGCC2_CFLAGS) directly.
962 # @multilib_dir@ is not really necessary, but sometimes it has
963 # more uses than just a directory name.
964 $(mkinstalldirs) $(MULTIDIR)
965 $(subst @multilib_flags@,$(CFLAGS) -B./,$(subst \
966 @multilib_dir@,$(MULTIDIR),$(subst \
967 @shlib_objs@,$(objects),$(subst \
968 @shlib_base_name@,libunwind,$(subst \
969 @shlib_slibdir_qual@,$(MULTIOSSUBDIR),$(SHLIBUNWIND_LINK))))))
971 endif
973 # Build the standard GCC startfiles and endfiles.
974 ALL_CRT_CFLAGS = $(CFLAGS) $(CRTSTUFF_CFLAGS) $(INCLUDES)
975 crt_compile = $(CC) $(ALL_CRT_CFLAGS) -o $@ $(compile_deps)
977 ifeq ($(CUSTOM_CRTSTUFF),)
978 # Compile two additional files that are linked with every program
979 # linked using GCC on systems using COFF or ELF, for the sake of C++
980 # constructors.
981 crtbegin$(objext): $(srcdir)/crtstuff.c
982 $(crt_compile) $(CRTSTUFF_T_CFLAGS) -c $< -DCRT_BEGIN
984 crtend$(objext): $(srcdir)/crtstuff.c
985 $(crt_compile) $(CRTSTUFF_T_CFLAGS) -c $< -DCRT_END
987 # These are versions of crtbegin and crtend for shared libraries.
988 crtbeginS$(objext): $(srcdir)/crtstuff.c
989 $(crt_compile) $(CRTSTUFF_T_CFLAGS_S) -c $< -DCRT_BEGIN -DCRTSTUFFS_O
991 crtendS$(objext): $(srcdir)/crtstuff.c
992 $(crt_compile) $(CRTSTUFF_T_CFLAGS_S) -c $< -DCRT_END -DCRTSTUFFS_O
994 # This is a version of crtbegin for -static links.
995 crtbeginT$(objext): $(srcdir)/crtstuff.c
996 $(crt_compile) $(CRTSTUFF_T_CFLAGS) -c $< -DCRT_BEGIN -DCRTSTUFFT_O
998 ifeq ($(enable_vtable_verify),yes)
999 # These are used in vtable verification; see comments in source files for
1000 # more details.
1001 vtv_start$(objext): $(srcdir)/vtv_start.c
1002 $(crt_compile) $(CRTSTUFF_T_CFLAGS_S) -c $(srcdir)/vtv_start.c
1004 vtv_end$(objext): $(srcdir)/vtv_end.c
1005 $(crt_compile) $(CRTSTUFF_T_CFLAGS_S) -c $(srcdir)/vtv_end.c
1007 vtv_start_preinit$(objext): $(srcdir)/vtv_start_preinit.c
1008 $(crt_compile) $(CRTSTUFF_T_CFLAGS_S) -c $(srcdir)/vtv_start_preinit.c
1010 vtv_end_preinit$(objext): $(srcdir)/vtv_end_preinit.c
1011 $(crt_compile) $(CRTSTUFF_T_CFLAGS_S) -c $(srcdir)/vtv_end_preinit.c
1012 endif
1013 endif
1015 ifeq ($(CUSTOM_CRTIN),)
1016 # -x assembler-with-cpp is only needed on case-insensitive filesystem.
1017 crti$(objext): $(srcdir)/config/$(cpu_type)/crti.S
1018 $(crt_compile) -c -x assembler-with-cpp $<
1020 crtn$(objext): $(srcdir)/config/$(cpu_type)/crtn.S
1021 $(crt_compile) -c -x assembler-with-cpp $<
1022 endif
1024 # Build extra startfiles in the libgcc directory.
1025 .PHONY: libgcc-extra-parts
1026 libgcc-extra-parts: $(EXTRA_PARTS)
1028 # Early copyback; see "all" above for the rationale. The
1029 # early copy is necessary so that the gcc -B options find
1030 # the right startup files when linking shared libgcc.
1031 $(mkinstalldirs) $(gcc_objdir)$(MULTISUBDIR)
1032 parts="$(EXTRA_PARTS)"; \
1033 for file in $$parts; do \
1034 rm -f $(gcc_objdir)$(MULTISUBDIR)/$$file; \
1035 $(INSTALL_DATA) $$file $(gcc_objdir)$(MULTISUBDIR)/; \
1036 case $$file in \
1037 *.a) \
1038 $(RANLIB) $(gcc_objdir)$(MULTISUBDIR)/$$file ;; \
1039 esac; \
1040 done
1042 all: $(extra-parts)
1044 $(libgcc-objects) $(libgcc-s-objects) $(libgcc-eh-objects) \
1045 $(libgcov-objects) \
1046 $(libunwind-objects) $(libunwind-s-objects) \
1047 $(EXTRA_PARTS): libgcc_tm.h
1049 # Copy unwind.h to the place where gcc will look for it at build-time
1050 install-unwind_h-forbuild:
1051 dest=$(gcc_objdir)/include/tmp$$$$-unwind.h; \
1052 cp unwind.h $$dest; \
1053 chmod a+r $$dest; \
1054 sh $(srcdir)/../move-if-change $$dest $(gcc_objdir)/include/unwind.h
1056 # Copy unwind.h to the place where gcc will look at run-time, once installed
1058 # This is redundant with the internal copy above when using a regular toplevel
1059 # "install" target, because gcc's install will copy to the destination as well.
1061 # This is however useful for "install-no-fixincludes" case, when only the gcc
1062 # internal headers are copied by gcc's install.
1063 install-unwind_h:
1064 $(mkinstalldirs) $(DESTDIR)$(libsubdir)/include
1065 $(INSTALL_DATA) unwind.h $(DESTDIR)$(libsubdir)/include
1067 all: install-unwind_h-forbuild
1069 # Documentation targets (empty).
1070 .PHONY: info html dvi pdf install-info install-html install-pdf
1072 info:
1073 install-info:
1074 html:
1075 install-html:
1076 dvi:
1077 pdf:
1078 install-pdf:
1080 # Install rules. These do not depend on "all", so that they can be invoked
1081 # recursively from it.
1082 install-libunwind:
1083 $(mkinstalldirs) $(DESTDIR)$(inst_slibdir)
1085 # NOTE: Maybe this should go into $(inst_libdir), but this
1086 # is where the old mklibgcc.in put it.
1087 $(INSTALL_DATA) libunwind.a $(DESTDIR)$(inst_slibdir)/
1088 chmod 644 $(DESTDIR)$(inst_slibdir)/libunwind.a
1089 $(RANLIB) $(DESTDIR)$(inst_slibdir)/libunwind.a
1091 $(subst @multilib_dir@,$(MULTIDIR),$(subst \
1092 @shlib_base_name@,libunwind,$(subst \
1093 @shlib_slibdir_qual@,$(MULTIOSSUBDIR),$(SHLIBUNWIND_INSTALL))))
1095 install-shared:
1096 $(mkinstalldirs) $(DESTDIR)$(inst_libdir)
1098 $(INSTALL_DATA) libgcc_eh.a $(DESTDIR)$(inst_libdir)/
1099 chmod 644 $(DESTDIR)$(inst_libdir)/libgcc_eh.a
1100 $(RANLIB) $(DESTDIR)$(inst_libdir)/libgcc_eh.a
1102 $(subst @multilib_dir@,$(MULTIDIR),$(subst \
1103 @shlib_base_name@,libgcc_s,$(subst \
1104 @shlib_slibdir_qual@,$(MULTIOSSUBDIR),$(SHLIB_INSTALL))))
1106 install-leaf: $(install-shared) $(install-libunwind)
1107 $(mkinstalldirs) $(DESTDIR)$(inst_libdir)
1109 $(INSTALL_DATA) libgcc.a $(DESTDIR)$(inst_libdir)/
1110 chmod 644 $(DESTDIR)$(inst_libdir)/libgcc.a
1111 $(RANLIB) $(DESTDIR)$(inst_libdir)/libgcc.a
1112 $(INSTALL_DATA) libgcov.a $(DESTDIR)$(inst_libdir)/
1113 chmod 644 $(DESTDIR)$(inst_libdir)/libgcov.a
1114 $(RANLIB) $(DESTDIR)$(inst_libdir)/libgcov.a
1116 parts="$(INSTALL_PARTS)"; \
1117 for file in $$parts; do \
1118 rm -f $(DESTDIR)$(inst_libdir)/$$file; \
1119 $(INSTALL_DATA) $$file $(DESTDIR)$(inst_libdir)/; \
1120 case $$file in \
1121 *.a) \
1122 $(RANLIB) $(gcc_objdir)$(MULTISUBDIR)/$$file ;; \
1123 esac; \
1124 done
1126 install: install-leaf install-unwind_h
1127 @: $(MAKE) ; $(MULTIDO) $(FLAGS_TO_PASS) multi-do DO=install
1129 install-strip: install
1131 .PHONY: install install-shared install-libunwind install-strip
1132 .PHONY: install-unwind_h install-unwind_h-forbuild
1134 # Don't export variables to the environment, in order to not confuse
1135 # configure.
1136 .NOEXPORT:
1138 include $(srcdir)/empty.mk $(wildcard *.dep)