* g++.dg/debug/dwarf2/pr44641.C: Revert line number change. Remove
[official-gcc.git] / libgcc / Makefile.in
blob527d87b03104d4b642303a61a5bf479f99cc9c48
1 # Makefile.in
3 # Copyright (C) 2005-2015 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 _mulsc3 _muldc3 _mulxc3 _multc3 _divsc3 _divdc3 _divxc3 \
418 _divtc3 _bswapsi2 _bswapdi2 _clrsbsi2 _clrsbdi2
420 # The floating-point conversion routines that involve a single-word integer.
421 # XX stands for the integer mode.
422 swfloatfuncs = $(patsubst %,_fixuns%XX,sf df xf)
424 # Likewise double-word routines.
425 dwfloatfuncs = $(patsubst %,_fix%XX,sf df xf tf) \
426 $(patsubst %,_fixuns%XX,sf df xf tf) \
427 $(patsubst %,_floatXX%,sf df xf tf) \
428 $(patsubst %,_floatunXX%,sf df xf tf)
430 ifeq ($(LIB2_SIDITI_CONV_FUNCS),)
431 lib2funcs += $(subst XX,si,$(swfloatfuncs))
432 lib2funcs += $(subst XX,di,$(dwfloatfuncs))
433 endif
435 # These might cause a divide overflow trap and so are compiled with
436 # unwinder info.
437 LIB2_DIVMOD_FUNCS = _divdi3 _moddi3 _udivdi3 _umoddi3 _udiv_w_sdiv _udivmoddi4
439 # Remove any objects from lib2funcs and LIB2_DIVMOD_FUNCS that are
440 # defined as optimized assembly code in LIB1ASMFUNCS or as C code
441 # in LIB2FUNCS_EXCLUDE.
442 lib2funcs := $(filter-out $(LIB2FUNCS_EXCLUDE) $(LIB1ASMFUNCS),$(lib2funcs))
443 LIB2_DIVMOD_FUNCS := $(filter-out $(LIB2FUNCS_EXCLUDE) $(LIB1ASMFUNCS), \
444 $(LIB2_DIVMOD_FUNCS))
446 # Build "libgcc1" (assembly) components.
448 lib1asmfuncs-o = $(patsubst %,%$(objext),$(LIB1ASMFUNCS))
449 $(lib1asmfuncs-o): %$(objext): $(srcdir)/config/$(LIB1ASMSRC) %.vis
450 $(gcc_compile) -DL$* -xassembler-with-cpp -c $< -include $*.vis
451 $(patsubst %,%.vis,$(LIB1ASMFUNCS)): %.vis: %_s$(objext)
452 $(gen-hide-list)
453 libgcc-objects += $(lib1asmfuncs-o)
455 lib1asmfuncs-s-o = $(patsubst %,%_s$(objext),$(LIB1ASMFUNCS))
456 $(lib1asmfuncs-s-o): %_s$(objext): $(srcdir)/config/$(LIB1ASMSRC)
457 $(gcc_s_compile) -DL$* -xassembler-with-cpp -c $<
458 ifeq ($(enable_shared),yes)
460 libgcc-s-objects += $(lib1asmfuncs-s-o)
462 endif
464 # Build lib2funcs. For the static library also include LIB2FUNCS_ST.
465 lib2funcs-o = $(patsubst %,%$(objext),$(lib2funcs) $(LIB2FUNCS_ST))
466 $(lib2funcs-o): %$(objext): $(srcdir)/libgcc2.c
467 $(gcc_compile) -DL$* -c $< $(vis_hide)
468 libgcc-objects += $(lib2funcs-o)
470 ifeq ($(enable_shared),yes)
471 lib2funcs-s-o = $(patsubst %,%_s$(objext),$(lib2funcs))
472 $(lib2funcs-s-o): %_s$(objext): $(srcdir)/libgcc2.c
473 $(gcc_s_compile) -DL$* -c $<
474 libgcc-s-objects += $(lib2funcs-s-o)
475 endif
477 ifneq ($(LIB2_SIDITI_CONV_FUNCS),)
478 # Build libgcc2.c for each conversion function, with a specific
479 # L<func> definition and LIBGCC2_UNITS_PER_WORD setting. The DImode
480 # functions are built with a wordsize of 4; the TImode functions are
481 # built with the same labels, but a wordsize of 8.
483 sifuncs := $(filter-out $(LIB2FUNCS_EXCLUDE),$(subst XX,si,$(swfloatfuncs)))
484 difuncs := $(filter-out $(LIB2FUNCS_EXCLUDE),$(subst XX,di,$(dwfloatfuncs)))
485 tifuncs := $(filter-out $(LIB2FUNCS_EXCLUDE),$(subst XX,ti,$(dwfloatfuncs)))
487 iter-items := $(sifuncs) $(difuncs) $(tifuncs)
488 iter-labels := $(sifuncs) $(difuncs) $(difuncs)
489 iter-sizes := $(patsubst %,4,$(sifuncs) $(difuncs)) $(patsubst %,8,$(tifuncs))
491 include $(srcdir)/empty.mk $(patsubst %,$(srcdir)/siditi-object.mk,$(iter-items))
493 libgcc-objects += $(patsubst %,%$(objext),$(sifuncs) $(difuncs) $(tifuncs))
494 ifeq ($(enable_shared),yes)
495 libgcc-s-objects += $(patsubst %,%_s$(objext),$(sifuncs) $(difuncs) $(tifuncs))
496 endif
497 endif
499 ifeq ($(LIB2_DIVMOD_EXCEPTION_FLAGS),)
500 # Provide default flags for compiling divmod functions, if they haven't been
501 # set already by a target-specific Makefile fragment.
502 LIB2_DIVMOD_EXCEPTION_FLAGS := -fexceptions -fnon-call-exceptions
503 endif
505 # Build LIB2_DIVMOD_FUNCS.
506 lib2-divmod-o = $(patsubst %,%$(objext),$(LIB2_DIVMOD_FUNCS))
507 $(lib2-divmod-o): %$(objext): $(srcdir)/libgcc2.c
508 $(gcc_compile) -DL$* -c $< \
509 $(LIB2_DIVMOD_EXCEPTION_FLAGS) $(vis_hide)
510 libgcc-objects += $(lib2-divmod-o)
512 ifeq ($(enable_shared),yes)
513 lib2-divmod-s-o = $(patsubst %,%_s$(objext),$(LIB2_DIVMOD_FUNCS))
514 $(lib2-divmod-s-o): %_s$(objext): $(srcdir)/libgcc2.c
515 $(gcc_s_compile) -DL$* -c $< \
516 $(LIB2_DIVMOD_EXCEPTION_FLAGS)
517 libgcc-s-objects += $(lib2-divmod-s-o)
518 endif
520 ifeq ($(TPBIT),)
521 # _sf_to_tf and _df_to_tf require tp-bit.c being compiled in.
522 FPBIT_FUNCS := $(filter-out _sf_to_tf,$(FPBIT_FUNCS))
523 DPBIT_FUNCS := $(filter-out _df_to_tf,$(DPBIT_FUNCS))
524 endif
526 FPBIT_FUNCS := $(filter-out $(LIB2FUNCS_EXCLUDE),$(FPBIT_FUNCS))
527 DPBIT_FUNCS := $(filter-out $(LIB2FUNCS_EXCLUDE),$(DPBIT_FUNCS))
528 TPBIT_FUNCS := $(filter-out $(LIB2FUNCS_EXCLUDE),$(TPBIT_FUNCS))
530 fpbit-src := $(srcdir)/fp-bit.c
532 # Build FPBIT.
533 ifneq ($(FPBIT),)
534 fpbit-o = $(patsubst %,%$(objext),$(FPBIT_FUNCS))
535 $(fpbit-o): %$(objext): $(fpbit-src)
536 $(gcc_compile) -DFINE_GRAINED_LIBRARIES -DL$* -DFLOAT $(FPBIT_CFLAGS) -c $< $(vis_hide)
537 libgcc-objects += $(fpbit-o)
539 ifeq ($(enable_shared),yes)
540 fpbit-s-o = $(patsubst %,%_s$(objext),$(FPBIT_FUNCS))
541 $(fpbit-s-o): %_s$(objext): $(fpbit-src)
542 $(gcc_s_compile) -DFINE_GRAINED_LIBRARIES -DL$* -DFLOAT $(FPBIT_CFLAGS) -c $<
543 libgcc-s-objects += $(fpbit-s-o)
544 endif
545 endif
547 # Build DPBIT.
548 ifneq ($(DPBIT),)
549 dpbit-o = $(patsubst %,%$(objext),$(DPBIT_FUNCS))
550 $(dpbit-o): %$(objext): $(fpbit-src)
551 $(gcc_compile) -DFINE_GRAINED_LIBRARIES -DL$* $(DPBIT_CFLAGS) -c $< $(vis_hide)
552 libgcc-objects += $(dpbit-o)
554 ifeq ($(enable_shared),yes)
555 dpbit-s-o = $(patsubst %,%_s$(objext),$(DPBIT_FUNCS))
556 $(dpbit-s-o): %_s$(objext): $(fpbit-src)
557 $(gcc_s_compile) -DFINE_GRAINED_LIBRARIES -DL$* $(DPBIT_CFLAGS) -c $<
558 libgcc-s-objects += $(dpbit-s-o)
559 endif
560 endif
562 # Build TPBIT.
563 ifneq ($(TPBIT),)
564 tpbit-o = $(patsubst %,%$(objext),$(TPBIT_FUNCS))
565 $(tpbit-o): %$(objext): $(fpbit-src)
566 $(gcc_compile) -DFINE_GRAINED_LIBRARIES -DL$* -DTFLOAT $(TPBIT_CFLAGS) -c $< $(vis_hide)
567 libgcc-objects += $(tpbit-o)
569 ifeq ($(enable_shared),yes)
570 tpbit-s-o = $(patsubst %,%_s$(objext),$(TPBIT_FUNCS))
571 $(tpbit-s-o): %_s$(objext): $(fpbit-src)
572 $(gcc_s_compile) -DFINE_GRAINED_LIBRARIES -DL$* -DTFLOAT $(TPBIT_CFLAGS) -c $<
573 libgcc-s-objects += $(tpbit-s-o)
574 endif
575 endif
577 # Build decimal floating point support.
578 ifeq ($(decimal_float),yes)
580 # If $DFP_ENABLE is set, then we want all data type sizes.
581 ifneq ($(DFP_ENABLE),)
582 D32PBIT = 1
583 D64PBIT = 1
584 D128PBIT = 1
585 endif
587 dfp-filenames =
588 ifneq ($(D32PBIT)$(D64PBIT)$(D128PBIT),)
589 ifeq ($(enable_decimal_float),bid)
590 dfp-filenames += bid_decimal_globals bid_decimal_data \
591 bid_binarydecimal bid_convert_data \
592 _isinfd32 _isinfd64 _isinfd128 bid64_noncomp \
593 bid128_noncomp bid128_fma bid_round bid_from_int \
594 bid64_add bid128_add bid64_div bid128_div \
595 bid64_mul bid128_mul bid64_compare bid128_compare \
596 bid128 bid32_to_bid64 bid32_to_bid128 bid64_to_bid128 \
597 bid64_to_int32 bid64_to_int64 \
598 bid64_to_uint32 bid64_to_uint64 \
599 bid128_to_int32 bid128_to_int64 \
600 bid128_to_uint32 bid128_to_uint64
601 else
602 dfp-filenames += decContext decNumber decExcept decRound decLibrary decDouble decPacked decQuad decSingle
603 endif
604 endif
606 dfp-objects = $(patsubst %,%$(objext),$(dfp-filenames))
607 ifeq ($(enable_decimal_float),bid)
608 $(dfp-objects): %$(objext): $(srcdir)/config/libbid/%.c
609 else
610 $(dfp-objects): %$(objext): $(srcdir)/../libdecnumber/%.c
611 endif
612 $(gcc_compile) -c $<
613 libgcc-objects += $(dfp-objects)
615 decbits-filenames =
616 ifneq ($(enable_decimal_float),bid)
617 ifneq ($(D32PBIT),)
618 decbits-filenames += decimal32
619 endif
621 ifneq ($(D64PBIT),)
622 decbits-filenames += decimal64
623 endif
625 ifneq ($(D128PBIT),)
626 decbits-filenames += decimal128
627 endif
628 endif
630 decbits-objects = $(patsubst %,%$(objext),$(decbits-filenames))
631 ifeq ($(enable_decimal_float),bid)
632 $(decbits-objects): %$(objext): $(srcdir)/config/libbid/%.c
633 else
634 $(decbits-objects): %$(objext): $(srcdir)/../libdecnumber/$(enable_decimal_float)/%.c
635 endif
636 $(gcc_compile) -c $<
637 libgcc-objects += $(decbits-objects)
639 # Next build individual support functions.
640 D32PBIT_FUNCS = _addsub_sd _div_sd _mul_sd _plus_sd _minus_sd \
641 _eq_sd _ne_sd _lt_sd _gt_sd _le_sd _ge_sd \
642 _sd_to_si _sd_to_di _sd_to_usi _sd_to_udi \
643 _si_to_sd _di_to_sd _usi_to_sd _udi_to_sd \
644 _sd_to_sf _sd_to_df _sd_to_xf _sd_to_tf \
645 _sf_to_sd _df_to_sd _xf_to_sd _tf_to_sd \
646 _sd_to_dd _sd_to_td _unord_sd _conv_sd
648 D64PBIT_FUNCS = _addsub_dd _div_dd _mul_dd _plus_dd _minus_dd \
649 _eq_dd _ne_dd _lt_dd _gt_dd _le_dd _ge_dd \
650 _dd_to_si _dd_to_di _dd_to_usi _dd_to_udi \
651 _si_to_dd _di_to_dd _usi_to_dd _udi_to_dd \
652 _dd_to_sf _dd_to_df _dd_to_xf _dd_to_tf \
653 _sf_to_dd _df_to_dd _xf_to_dd _tf_to_dd \
654 _dd_to_sd _dd_to_td _unord_dd _conv_dd
656 D128PBIT_FUNCS = _addsub_td _div_td _mul_td _plus_td _minus_td \
657 _eq_td _ne_td _lt_td _gt_td _le_td _ge_td \
658 _td_to_si _td_to_di _td_to_usi _td_to_udi \
659 _si_to_td _di_to_td _usi_to_td _udi_to_td \
660 _td_to_sf _td_to_df _td_to_xf _td_to_tf \
661 _sf_to_td _df_to_td _xf_to_td _tf_to_td \
662 _td_to_sd _td_to_dd _unord_td _conv_td
664 ifeq ($(enable_decimal_float),bid)
665 ifneq ($(D32PBIT),)
666 D32PBIT_FUNCS:=$(filter-out _plus_sd _minus_sd _conv_sd, $(D32PBIT_FUNCS))
667 endif
669 ifneq ($(D64PBIT),)
670 D64PBIT_FUNCS:=$(filter-out _plus_dd _minus_dd _conv_dd, $(D64PBIT_FUNCS))
671 endif
673 ifneq ($(D128PBIT),)
674 D128PBIT_FUNCS:=$(filter-out _plus_td _minus_td _conv_td, $(D128PBIT_FUNCS))
675 endif
676 endif
678 ifneq ($(D32PBIT),)
679 d32pbit-o = $(patsubst %,%$(objext),$(D32PBIT_FUNCS))
680 ifeq ($(enable_decimal_float),bid)
681 $(d32pbit-o): %$(objext): $(srcdir)/config/libbid/%.c
682 else
683 $(d32pbit-o): %$(objext): $(srcdir)/dfp-bit.c
684 endif
685 $(gcc_compile) -DFINE_GRAINED_LIBRARIES -DL$* -DWIDTH=32 -c $<
686 libgcc-objects += $(d32pbit-o)
687 endif
689 ifneq ($(D64PBIT),)
690 d64pbit-o = $(patsubst %,%$(objext),$(D64PBIT_FUNCS))
691 ifeq ($(enable_decimal_float),bid)
692 $(d64pbit-o): %$(objext): $(srcdir)/config/libbid/%.c
693 else
694 $(d64pbit-o): %$(objext): $(srcdir)/dfp-bit.c
695 endif
696 $(gcc_compile) -DFINE_GRAINED_LIBRARIES -DL$* -DWIDTH=64 -c $<
697 libgcc-objects += $(d64pbit-o)
698 endif
700 ifneq ($(D128PBIT),)
701 d128pbit-o = $(patsubst %,%$(objext),$(D128PBIT_FUNCS))
702 ifeq ($(enable_decimal_float),bid)
703 $(d128pbit-o): %$(objext): $(srcdir)/config/libbid/%.c
704 else
705 $(d128pbit-o): %$(objext): $(srcdir)/dfp-bit.c
706 endif
707 $(gcc_compile) -DFINE_GRAINED_LIBRARIES -DL$* -DWIDTH=128 -c $<
708 libgcc-objects += $(d128pbit-o)
709 endif
711 endif
713 ifeq ($(SYNC),yes)
714 libgcc-sync-size-funcs := $(foreach op, add sub or and xor nand, \
715 sync_fetch_and_$(op) \
716 sync_$(op)_and_fetch) \
717 sync_bool_compare_and_swap \
718 sync_val_compare_and_swap \
719 sync_lock_test_and_set
721 libgcc-sync-size-funcs := $(foreach prefix, $(libgcc-sync-size-funcs), \
722 $(foreach suffix, 1 2 4 8 16, \
723 $(prefix)_$(suffix)))
725 libgcc-sync-size-funcs-o = $(patsubst %,%$(objext),$(libgcc-sync-size-funcs))
726 $(libgcc-sync-size-funcs-o): %$(objext): $(srcdir)/sync.c
727 $(gcc_compile) $(SYNC_CFLAGS) \
728 -DFN=`echo "$*" | sed 's/_[^_]*$$//'` \
729 -DSIZE=`echo "$*" | sed 's/.*_//'` \
730 -c $< $(vis_hide)
731 libgcc-objects += $(libgcc-sync-size-funcs-o)
733 libgcc-sync-funcs := sync_synchronize
735 libgcc-sync-funcs-o = $(patsubst %,%$(objext),$(libgcc-sync-funcs))
736 $(libgcc-sync-funcs-o): %$(objext): $(srcdir)/sync.c
737 $(gcc_compile) $(SYNC_CFLAGS) \
738 -DL$* \
739 -c $< $(vis_hide)
740 libgcc-objects += $(libgcc-sync-funcs-o)
742 ifeq ($(enable_shared),yes)
743 libgcc-sync-size-funcs-s-o = $(patsubst %,%_s$(objext), \
744 $(libgcc-sync-size-funcs))
745 $(libgcc-sync-size-funcs-s-o): %_s$(objext): $(srcdir)/sync.c
746 $(gcc_s_compile) $(SYNC_CFLAGS) \
747 -DFN=`echo "$*" | sed 's/_[^_]*$$//'` \
748 -DSIZE=`echo "$*" | sed 's/.*_//'` \
749 -c $<
750 libgcc-s-objects += $(libgcc-sync-size-funcs-s-o)
752 libgcc-sync-funcs-s-o = $(patsubst %,%_s$(objext),$(libgcc-sync-funcs))
753 $(libgcc-sync-funcs-s-o): %_s$(objext): $(srcdir)/sync.c
754 $(gcc_s_compile) $(SYNC_CFLAGS) \
755 -DL$* \
756 -c $<
757 libgcc-s-objects += $(libgcc-sync-funcs-s-o)
758 endif
759 endif
761 # Build fixed-point support.
762 ifeq ($(fixed_point),yes)
764 # Generate permutations of function name and mode
765 fixed-labels := $(shell $(SHELL) $(srcdir)/gen-fixed.sh arith labels)
766 fixed-funcs := $(shell $(SHELL) $(srcdir)/gen-fixed.sh arith funcs)
767 fixed-modes := $(shell $(SHELL) $(srcdir)/gen-fixed.sh arith modes)
769 # Generate the rules for each arithmetic function
770 iter-items := $(fixed-funcs)
771 iter-labels := $(fixed-labels)
772 iter-from := $(fixed-modes)
773 iter-to := $(fixed-modes)
774 include $(srcdir)/empty.mk $(patsubst %,$(srcdir)/fixed-obj.mk,$(iter-items))
776 # Add arithmetic functions to list of objects to be built
777 libgcc-objects += $(patsubst %,%$(objext),$(filter-out $(LIB2FUNCS_EXCLUDE),$(fixed-funcs)))
778 ifeq ($(enable_shared),yes)
779 libgcc-s-objects += $(patsubst %,%_s$(objext),$(filter-out $(LIB2FUNCS_EXCLUDE),$(fixed-funcs)))
780 endif
782 # Convert from or to fractional
783 fixed-conv-funcs := $(shell $(SHELL) $(srcdir)/gen-fixed.sh conv funcs)
784 fixed-conv-labels := $(shell $(SHELL) $(srcdir)/gen-fixed.sh conv labels)
785 fixed-conv-from := $(shell $(SHELL) $(srcdir)/gen-fixed.sh conv from)
786 fixed-conv-to := $(shell $(SHELL) $(srcdir)/gen-fixed.sh conv to)
788 # Generate the make rules for each conversion function
789 iter-items := $(fixed-conv-funcs)
790 iter-labels := $(fixed-conv-labels)
791 iter-from := $(fixed-conv-from)
792 iter-to := $(fixed-conv-to)
793 include $(srcdir)/empty.mk $(patsubst %,$(srcdir)/fixed-obj.mk,$(iter-items))
795 # Add conversion functions to list of objects to be built
796 libgcc-objects += $(patsubst %,%$(objext),$(filter-out $(LIB2FUNCS_EXCLUDE),$(fixed-conv-funcs)))
797 ifeq ($(enable_shared),yes)
798 libgcc-s-objects += $(patsubst %,%_s$(objext),$(filter-out $(LIB2FUNCS_EXCLUDE),$(fixed-conv-funcs)))
799 endif
801 endif
803 # Build LIB2ADD and LIB2ADD_ST.
804 ifneq ($(filter-out %.c %.S %.asm,$(LIB2ADD) $(LIB2ADD_ST)),)
805 $(error Unsupported files in LIB2ADD or LIB2ADD_ST.)
806 endif
808 libgcc-objects += $(addsuffix $(objext),$(basename $(notdir $(LIB2ADD))))
809 libgcc-objects += $(addsuffix $(objext),$(basename $(notdir $(LIB2ADD_ST))))
811 c_flags :=
812 iter-items := $(LIB2ADD) $(LIB2ADD_ST)
813 include $(iterator)
815 ifeq ($(enable_shared),yes)
816 libgcc-s-objects += $(addsuffix _s$(objext),$(basename $(notdir $(LIB2ADD))))
817 endif
819 # Build LIB2ADDEH, LIB2ADDEHSTATIC, and LIB2ADDEHSHARED. If we don't have
820 # libgcc_eh.a, only LIB2ADDEH matters. If we do, only LIB2ADDEHSTATIC and
821 # LIB2ADDEHSHARED matter. (Usually all three are identical.)
823 c_flags := -fexceptions
825 ifeq ($(enable_shared),yes)
827 libgcc-eh-objects += $(addsuffix $(objext),$(basename $(notdir $(LIB2ADDEHSTATIC))))
828 libgcc-s-objects += $(addsuffix _s$(objext),$(basename $(notdir $(LIB2ADDEHSHARED))))
830 iter-items := $(sort $(LIB2ADDEHSTATIC) $(LIB2ADDEHSHARED))
831 include $(iterator)
833 else
834 # Not shared. LIB2ADDEH are added to libgcc.a.
836 libgcc-objects += $(addsuffix $(objext),$(basename $(notdir $(LIB2ADDEH))))
838 iter-items := $(LIB2ADDEH)
839 include $(iterator)
841 endif
843 # Build LIBUNWIND. Use -fno-exceptions so that the unwind library does
844 # not generate calls to __gcc_personality_v0.
846 c_flags := -fno-exceptions
848 libunwind-objects += $(addsuffix $(objext),$(basename $(notdir $(LIBUNWIND))))
850 ifeq ($(enable_shared),yes)
851 libunwind-s-objects += $(addsuffix _s$(objext),$(basename $(notdir $(LIBUNWIND))))
852 endif
854 iter-items := $(LIBUNWIND)
855 include $(iterator)
857 # Build libgcov components.
859 LIBGCOV_MERGE = _gcov_merge_add _gcov_merge_single _gcov_merge_delta \
860 _gcov_merge_ior _gcov_merge_time_profile _gcov_merge_icall_topn
861 LIBGCOV_PROFILER = _gcov_interval_profiler _gcov_pow2_profiler \
862 _gcov_one_value_profiler _gcov_indirect_call_profiler \
863 _gcov_average_profiler _gcov_ior_profiler \
864 _gcov_indirect_call_profiler_v2 _gcov_time_profiler \
865 _gcov_indirect_call_topn_profiler
866 LIBGCOV_INTERFACE = _gcov_dump _gcov_flush _gcov_fork \
867 _gcov_execl _gcov_execlp \
868 _gcov_execle _gcov_execv _gcov_execvp _gcov_execve _gcov_reset
869 LIBGCOV_DRIVER = _gcov
871 libgcov-merge-objects = $(patsubst %,%$(objext),$(LIBGCOV_MERGE))
872 libgcov-profiler-objects = $(patsubst %,%$(objext),$(LIBGCOV_PROFILER))
873 libgcov-interface-objects = $(patsubst %,%$(objext),$(LIBGCOV_INTERFACE))
874 libgcov-driver-objects = $(patsubst %,%$(objext),$(LIBGCOV_DRIVER))
875 libgcov-objects = $(libgcov-merge-objects) $(libgcov-profiler-objects) \
876 $(libgcov-interface-objects) $(libgcov-driver-objects)
878 $(libgcov-merge-objects): %$(objext): $(srcdir)/libgcov-merge.c $(srcdir)/libgcov.h
879 $(gcc_compile) -DL$* -c $(srcdir)/libgcov-merge.c
880 $(libgcov-profiler-objects): %$(objext): $(srcdir)/libgcov-profiler.c $(srcdir)/libgcov.h
881 $(gcc_compile) -DL$* -c $(srcdir)/libgcov-profiler.c
882 $(libgcov-interface-objects): %$(objext): $(srcdir)/libgcov-interface.c $(srcdir)/libgcov.h
883 $(gcc_compile) -DL$* -c $(srcdir)/libgcov-interface.c
884 $(libgcov-driver-objects): %$(objext): $(srcdir)/libgcov-driver.c \
885 $(srcdir)/libgcov-driver-system.c $(srcdir)/libgcov.h
886 $(gcc_compile) -DL$* -c $(srcdir)/libgcov-driver.c
889 # Static libraries.
890 libgcc.a: $(libgcc-objects)
891 libgcov.a: $(libgcov-objects)
892 libunwind.a: $(libunwind-objects)
893 libgcc_eh.a: $(libgcc-eh-objects)
895 libgcc.a libgcov.a libunwind.a libgcc_eh.a:
896 -rm -f $@
898 objects="$(objects)"; \
899 if test -z "$$objects"; then \
900 echo 'int __libgcc_eh_dummy;' > eh_dummy.c; \
901 $(gcc_compile_bare) $(vis_hide) -c eh_dummy.c \
902 -o eh_dummy$(objext); \
903 objects=eh_dummy$(objext); \
904 fi; \
905 $(AR_CREATE_FOR_TARGET) $@ $$objects
907 $(RANLIB) $@
909 all: libgcc.a libgcov.a
911 ifneq ($(LIBUNWIND),)
912 all: libunwind.a
913 endif
915 ifeq ($(enable_shared),yes)
916 all: libgcc_eh.a libgcc_s$(SHLIB_EXT)
917 ifneq ($(LIBUNWIND),)
918 all: libunwind$(SHLIB_EXT)
919 libgcc_s$(SHLIB_EXT): libunwind$(SHLIB_EXT)
920 endif
922 # Map-file generation.
923 ifneq ($(SHLIB_MKMAP),)
924 libgcc.map.in: $(SHLIB_MAPFILES)
925 { cat $(SHLIB_MAPFILES) \
926 | sed -e '/^[ ]*#/d' \
927 -e 's/^%\(if\|else\|elif\|endif\|define\)/#\1/' \
928 | $(gcc_compile_bare) -E -xassembler-with-cpp -; \
929 } > tmp-$@
930 mv tmp-$@ $@
931 libgcc.map: $(SHLIB_MKMAP) libgcc.map.in $(libgcc-s-objects)
932 { $(NM) $(SHLIB_NM_FLAGS) $(libgcc-s-objects); echo %%; \
933 cat libgcc.map.in; \
934 } | $(AWK) -f $(SHLIB_MKMAP) $(SHLIB_MKMAP_OPTS) > tmp-$@
935 mv tmp-$@ $@
936 libgcc_s$(SHLIB_EXT): libgcc.map
937 mapfile = libgcc.map
938 endif
940 libgcc-std.ver: $(srcdir)/libgcc-std.ver.in
941 sed -e 's/__PFX__/$(LIBGCC_VER_GNU_PREFIX)/g' \
942 -e 's/__FIXPTPFX__/$(LIBGCC_VER_FIXEDPOINT_GNU_PREFIX)/g' < $< > $@
944 libgcc_s$(SHLIB_EXT): $(libgcc-s-objects) $(extra-parts) libgcc.a
945 # @multilib_flags@ is still needed because this may use
946 # $(GCC_FOR_TARGET) and $(LIBGCC2_CFLAGS) directly.
947 # @multilib_dir@ is not really necessary, but sometimes it has
948 # more uses than just a directory name.
949 $(mkinstalldirs) $(MULTIDIR)
950 $(subst @multilib_flags@,$(CFLAGS) -B./,$(subst \
951 @multilib_dir@,$(MULTIDIR),$(subst \
952 @shlib_objs@,$(objects) libgcc.a,$(subst \
953 @shlib_base_name@,libgcc_s,$(subst \
954 @shlib_map_file@,$(mapfile),$(subst \
955 @shlib_slibdir_qual@,$(MULTIOSSUBDIR),$(subst \
956 @shlib_slibdir@,$(shlib_slibdir),$(SHLIB_LINK))))))))
958 libunwind$(SHLIB_EXT): $(libunwind-s-objects) $(extra-parts)
959 # @multilib_flags@ is still needed because this may use
960 # $(GCC_FOR_TARGET) and $(LIBGCC2_CFLAGS) directly.
961 # @multilib_dir@ is not really necessary, but sometimes it has
962 # more uses than just a directory name.
963 $(mkinstalldirs) $(MULTIDIR)
964 $(subst @multilib_flags@,$(CFLAGS) -B./,$(subst \
965 @multilib_dir@,$(MULTIDIR),$(subst \
966 @shlib_objs@,$(objects),$(subst \
967 @shlib_base_name@,libunwind,$(subst \
968 @shlib_slibdir_qual@,$(MULTIOSSUBDIR),$(SHLIBUNWIND_LINK))))))
970 endif
972 # Build the standard GCC startfiles and endfiles.
973 ALL_CRT_CFLAGS = $(CFLAGS) $(CRTSTUFF_CFLAGS) $(INCLUDES)
974 crt_compile = $(CC) $(ALL_CRT_CFLAGS) -o $@ $(compile_deps)
976 ifeq ($(CUSTOM_CRTSTUFF),)
977 # Compile two additional files that are linked with every program
978 # linked using GCC on systems using COFF or ELF, for the sake of C++
979 # constructors.
980 crtbegin$(objext): $(srcdir)/crtstuff.c
981 $(crt_compile) $(CRTSTUFF_T_CFLAGS) -c $< -DCRT_BEGIN
983 crtend$(objext): $(srcdir)/crtstuff.c
984 $(crt_compile) $(CRTSTUFF_T_CFLAGS) -c $< -DCRT_END
986 # These are versions of crtbegin and crtend for shared libraries.
987 crtbeginS$(objext): $(srcdir)/crtstuff.c
988 $(crt_compile) $(CRTSTUFF_T_CFLAGS_S) -c $< -DCRT_BEGIN -DCRTSTUFFS_O
990 crtendS$(objext): $(srcdir)/crtstuff.c
991 $(crt_compile) $(CRTSTUFF_T_CFLAGS_S) -c $< -DCRT_END -DCRTSTUFFS_O
993 # This is a version of crtbegin for -static links.
994 crtbeginT$(objext): $(srcdir)/crtstuff.c
995 $(crt_compile) $(CRTSTUFF_T_CFLAGS) -c $< -DCRT_BEGIN -DCRTSTUFFT_O
997 # crtoffloadbegin and crtoffloadend contain symbols, that mark the begin and
998 # the end of tables with addresses, required for offloading.
999 crtoffloadbegin$(objext): $(srcdir)/offloadstuff.c
1000 $(crt_compile) $(CRTSTUFF_T_CFLAGS) -c $< -DCRT_BEGIN
1002 crtoffloadend$(objext): $(srcdir)/offloadstuff.c
1003 $(crt_compile) $(CRTSTUFF_T_CFLAGS) -c $< -DCRT_END
1004 endif
1006 ifeq ($(enable_vtable_verify),yes)
1007 # These are used in vtable verification; see comments in source files for
1008 # more details.
1009 vtv_start$(objext): $(srcdir)/vtv_start.c
1010 $(crt_compile) $(CRTSTUFF_T_CFLAGS_S) -c $(srcdir)/vtv_start.c
1012 vtv_end$(objext): $(srcdir)/vtv_end.c
1013 $(crt_compile) $(CRTSTUFF_T_CFLAGS_S) -c $(srcdir)/vtv_end.c
1015 vtv_start_preinit$(objext): $(srcdir)/vtv_start_preinit.c
1016 $(crt_compile) $(CRTSTUFF_T_CFLAGS_S) -c $(srcdir)/vtv_start_preinit.c
1018 vtv_end_preinit$(objext): $(srcdir)/vtv_end_preinit.c
1019 $(crt_compile) $(CRTSTUFF_T_CFLAGS_S) -c $(srcdir)/vtv_end_preinit.c
1020 endif
1022 ifeq ($(CUSTOM_CRTIN),)
1023 # -x assembler-with-cpp is only needed on case-insensitive filesystem.
1024 crti$(objext): $(srcdir)/config/$(cpu_type)/crti.S
1025 $(crt_compile) -c -x assembler-with-cpp $<
1027 crtn$(objext): $(srcdir)/config/$(cpu_type)/crtn.S
1028 $(crt_compile) -c -x assembler-with-cpp $<
1029 endif
1031 # Build extra startfiles in the libgcc directory.
1032 .PHONY: libgcc-extra-parts
1033 libgcc-extra-parts: $(EXTRA_PARTS)
1035 # Early copyback; see "all" above for the rationale. The
1036 # early copy is necessary so that the gcc -B options find
1037 # the right startup files when linking shared libgcc.
1038 $(mkinstalldirs) $(gcc_objdir)$(MULTISUBDIR)
1039 parts="$(EXTRA_PARTS)"; \
1040 for file in $$parts; do \
1041 rm -f $(gcc_objdir)$(MULTISUBDIR)/$$file; \
1042 $(INSTALL_DATA) $$file $(gcc_objdir)$(MULTISUBDIR)/; \
1043 case $$file in \
1044 *.a) \
1045 $(RANLIB) $(gcc_objdir)$(MULTISUBDIR)/$$file ;; \
1046 esac; \
1047 done
1049 all: $(extra-parts)
1051 $(libgcc-objects) $(libgcc-s-objects) $(libgcc-eh-objects) \
1052 $(libgcov-objects) \
1053 $(libunwind-objects) $(libunwind-s-objects) \
1054 $(EXTRA_PARTS): libgcc_tm.h
1056 # Copy unwind.h to the place where gcc will look for it at build-time
1057 install-unwind_h-forbuild:
1058 dest=$(gcc_objdir)/include/tmp$$$$-unwind.h; \
1059 cp unwind.h $$dest; \
1060 chmod a+r $$dest; \
1061 sh $(srcdir)/../move-if-change $$dest $(gcc_objdir)/include/unwind.h
1063 # Copy unwind.h to the place where gcc will look at run-time, once installed
1065 # This is redundant with the internal copy above when using a regular toplevel
1066 # "install" target, because gcc's install will copy to the destination as well.
1068 # This is however useful for "install-no-fixincludes" case, when only the gcc
1069 # internal headers are copied by gcc's install.
1070 install-unwind_h:
1071 $(mkinstalldirs) $(DESTDIR)$(libsubdir)/include
1072 $(INSTALL_DATA) unwind.h $(DESTDIR)$(libsubdir)/include
1074 all: install-unwind_h-forbuild
1076 # Documentation targets (empty).
1077 .PHONY: info html dvi pdf install-info install-html install-pdf
1079 info:
1080 install-info:
1081 html:
1082 install-html:
1083 dvi:
1084 pdf:
1085 install-pdf:
1087 # Install rules. These do not depend on "all", so that they can be invoked
1088 # recursively from it.
1089 install-libunwind:
1090 $(mkinstalldirs) $(DESTDIR)$(inst_slibdir)
1092 # NOTE: Maybe this should go into $(inst_libdir), but this
1093 # is where the old mklibgcc.in put it.
1094 $(INSTALL_DATA) libunwind.a $(DESTDIR)$(inst_slibdir)/
1095 chmod 644 $(DESTDIR)$(inst_slibdir)/libunwind.a
1096 $(RANLIB) $(DESTDIR)$(inst_slibdir)/libunwind.a
1098 $(subst @multilib_dir@,$(MULTIDIR),$(subst \
1099 @shlib_base_name@,libunwind,$(subst \
1100 @shlib_slibdir_qual@,$(MULTIOSSUBDIR),$(SHLIBUNWIND_INSTALL))))
1102 install-shared:
1103 $(mkinstalldirs) $(DESTDIR)$(inst_libdir)
1105 $(INSTALL_DATA) libgcc_eh.a $(DESTDIR)$(inst_libdir)/
1106 chmod 644 $(DESTDIR)$(inst_libdir)/libgcc_eh.a
1107 $(RANLIB) $(DESTDIR)$(inst_libdir)/libgcc_eh.a
1109 $(subst @multilib_dir@,$(MULTIDIR),$(subst \
1110 @shlib_base_name@,libgcc_s,$(subst \
1111 @shlib_slibdir_qual@,$(MULTIOSSUBDIR),$(SHLIB_INSTALL))))
1113 install-leaf: $(install-shared) $(install-libunwind)
1114 $(mkinstalldirs) $(DESTDIR)$(inst_libdir)
1116 $(INSTALL_DATA) libgcc.a $(DESTDIR)$(inst_libdir)/
1117 chmod 644 $(DESTDIR)$(inst_libdir)/libgcc.a
1118 $(RANLIB) $(DESTDIR)$(inst_libdir)/libgcc.a
1119 $(INSTALL_DATA) libgcov.a $(DESTDIR)$(inst_libdir)/
1120 chmod 644 $(DESTDIR)$(inst_libdir)/libgcov.a
1121 $(RANLIB) $(DESTDIR)$(inst_libdir)/libgcov.a
1123 parts="$(INSTALL_PARTS)"; \
1124 for file in $$parts; do \
1125 rm -f $(DESTDIR)$(inst_libdir)/$$file; \
1126 $(INSTALL_DATA) $$file $(DESTDIR)$(inst_libdir)/; \
1127 case $$file in \
1128 *.a) \
1129 $(RANLIB) $(gcc_objdir)$(MULTISUBDIR)/$$file ;; \
1130 esac; \
1131 done
1133 install: install-leaf install-unwind_h
1134 @: $(MAKE) ; $(MULTIDO) $(FLAGS_TO_PASS) multi-do DO=install
1136 install-strip: install
1138 .PHONY: install install-shared install-libunwind install-strip
1139 .PHONY: install-unwind_h install-unwind_h-forbuild
1141 # Don't export variables to the environment, in order to not confuse
1142 # configure.
1143 .NOEXPORT:
1145 include $(srcdir)/empty.mk $(wildcard *.dep)