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