cmpd.c (__mspabi_cmpf): Add prototype.
[platform/upstream/gcc.git] / libgcc / Makefile.in
1 # Makefile.in
2
3 # Copyright (C) 2005-2016 Free Software Foundation, Inc.
4 #
5 # This file is part of GCC.
6 #
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.
11 #
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.
16 #
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/>.
20 #
21
22 libgcc_topdir = @libgcc_topdir@
23 host_subdir = @host_subdir@
24
25 gcc_objdir = $(MULTIBUILDTOP)../../$(host_subdir)/gcc
26
27 srcdir = @srcdir@
28
29 prefix = @prefix@
30
31 exec_prefix = @exec_prefix@
32 libdir = @libdir@
33 shlib_slibdir = @slibdir@
34
35 SHELL = @SHELL@
36
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@
46
47 host_noncanonical = @host_noncanonical@
48 real_host_noncanonical = @real_host_noncanonical@
49 target_noncanonical = @target_noncanonical@
50
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@
54
55 FORCE_EXPLICIT_EH_REGISTRY = @force_explicit_eh_registry@
56
57 extra-parts = libgcc-extra-parts
58
59 # Multilib support variables.
60 MULTISRCTOP =
61 MULTIBUILDTOP =
62 MULTIDIRS =
63 MULTISUBDIR =
64 MULTIDO = true
65 MULTICLEAN = true
66
67 INSTALL = @INSTALL@
68 INSTALL_PROGRAM = @INSTALL_PROGRAM@
69 INSTALL_DATA = @INSTALL_DATA@
70 mkinstalldirs = $(SHELL) $(libgcc_topdir)/mkinstalldirs
71 INSTALL_PARTS = $(EXTRA_PARTS)
72
73 objext = .o
74
75 AR = @AR@
76 AR_FLAGS = rc
77
78 CC = @CC@
79 CFLAGS = @CFLAGS@
80 RANLIB = @RANLIB@
81 LN_S = @LN_S@
82
83 PWD_COMMAND = $${PWDCMD-pwd}
84
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)"
106
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)
115
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
121
122 .PHONY: check installcheck
123 check:
124 installcheck:
125
126 .PHONY: all clean
127
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
144
145 Makefile: $(srcdir)/Makefile.in config.status
146         CONFIG_FILES=Makefile CONFIG_HEADERS= $(SHELL) ./config.status
147
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
153
154 config.status: $(srcdir)/configure $(srcdir)/config.host
155         $(SHELL) ./config.status --recheck
156
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 \
165
166 $(srcdir)/configure: @MAINT@ $(srcdir)/configure.ac $(configure_deps)
167         cd $(srcdir) && $(AUTOCONF)
168
169 include $(gcc_objdir)/libgcc.mvars
170
171 # Flags to pass to recursive makes.
172
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)
187
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@
195
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
216
217 version := $(shell cat $(srcdir)/../gcc/BASE-VER)
218
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
229
230 # Options to use when compiling libgcc2.a.
231 #
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)
237
238 # Additional options to use when compiling libgcc2.a.
239 # Some targets override this to -isystem include
240 LIBGCC2_INCLUDES =
241
242 # Additional target-dependent options for compiling libgcc2.a.
243 HOST_LIBGCC2_CFLAGS =
244
245 PICFLAG = @PICFLAG@
246
247 # Defined in libgcc2.c, included only in the static library.
248 LIB2FUNCS_ST = _eprintf __gcc_bcmp
249
250 # List of functions not to build from libgcc2.c.
251 LIB2FUNCS_EXCLUDE =
252
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
256
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 = 
260
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 =
264
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)
274
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))
278
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@
285
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)
292
293 # Extra flags to use when compiling crt{begin,end}.o.
294 CRTSTUFF_T_CFLAGS =
295
296 MULTIDIR := $(shell $(CC) $(CFLAGS) -print-multi-directory)
297 MULTIOSDIR := $(shell $(CC) $(CFLAGS) -print-multi-os-directory)
298
299 MULTIOSSUBDIR := $(shell if test $(MULTIOSDIR) != .; then echo /$(MULTIOSDIR); fi)
300 inst_libdir = $(libsubdir)$(MULTISUBDIR)
301 inst_slibdir = $(slibdir)$(MULTIOSSUBDIR)
302
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
307
308 objects = $(filter %$(objext),$^)
309
310 # Collect any host-specific information from Makefile fragments.
311
312 LIBGCC_VER_GNU_PREFIX = __
313 LIBGCC_VER_FIXEDPOINT_GNU_PREFIX = __
314 LIBGCC_VER_SYMBOLS_PREFIX =
315
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
320
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
325
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
330
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)
336
337 # nm flags to list global symbols in libgcc object files.
338 SHLIB_NM_FLAGS = -pg
339
340 # Don't build libunwind by default.
341 LIBUNWIND =
342 SHLIBUNWIND_LINK =
343 SHLIBUNWIND_INSTALL =
344
345 tmake_file = @tmake_file@
346 include $(srcdir)/empty.mk $(tmake_file)
347
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 > $@
357
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
364
365 ifeq ($(enable_shared),yes)
366   iterator = $(srcdir)/empty.mk $(patsubst %,$(srcdir)/shared-object.mk,$(iter-items))
367
368   install-shared = install-shared
369
370   ifneq ($(LIBUNWIND),)
371     install-libunwind = install-libunwind
372   endif
373 endif
374
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@
379
380 ifneq (,$(vis_hide))
381
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@
385
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
396
397 ifneq ($(enable_shared),yes)
398 iterator = $(srcdir)/empty.mk $(patsubst %,$(srcdir)/static-object.mk,$(iter-items))
399 endif
400
401 LIB2ADD += enable-execute-stack.c
402
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
409
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
419
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)
423
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)
429
430 ifeq ($(LIB2_SIDITI_CONV_FUNCS),)
431   lib2funcs += $(subst XX,si,$(swfloatfuncs))
432   lib2funcs += $(subst XX,di,$(dwfloatfuncs))
433 endif
434
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
438
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))
445
446 # Build "libgcc1" (assembly) components.
447
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)
454
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)
459
460 libgcc-s-objects += $(lib1asmfuncs-s-o)
461
462 endif
463
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)
469
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
476
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.
482
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)))
486
487 iter-items := $(sifuncs) $(difuncs) $(tifuncs)
488 iter-labels := $(sifuncs) $(difuncs) $(difuncs)
489 iter-sizes := $(patsubst %,4,$(sifuncs) $(difuncs)) $(patsubst %,8,$(tifuncs))
490
491 include $(srcdir)/empty.mk $(patsubst %,$(srcdir)/siditi-object.mk,$(iter-items))
492
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
498
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
504
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)
511
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
519
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
525
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))
529
530 fpbit-src := $(srcdir)/fp-bit.c
531
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)
538
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
546
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)
553
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
561
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)
568
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
576
577 # Build decimal floating point support.
578 ifeq ($(decimal_float),yes)
579
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
586
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
605
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)
614
615 decbits-filenames =
616 ifneq ($(enable_decimal_float),bid)
617 ifneq ($(D32PBIT),)
618 decbits-filenames += decimal32
619 endif
620
621 ifneq ($(D64PBIT),)
622 decbits-filenames += decimal64
623 endif
624
625 ifneq ($(D128PBIT),)
626 decbits-filenames += decimal128
627 endif
628 endif
629
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)
638
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
647
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
655
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
663
664 ifeq ($(enable_decimal_float),bid)
665 ifneq ($(D32PBIT),)
666 D32PBIT_FUNCS:=$(filter-out _plus_sd _minus_sd _conv_sd, $(D32PBIT_FUNCS))
667 endif
668
669 ifneq ($(D64PBIT),)
670 D64PBIT_FUNCS:=$(filter-out _plus_dd _minus_dd _conv_dd, $(D64PBIT_FUNCS))
671 endif
672
673 ifneq ($(D128PBIT),)
674 D128PBIT_FUNCS:=$(filter-out _plus_td _minus_td _conv_td, $(D128PBIT_FUNCS))
675 endif
676 endif
677
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
688
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
699
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
710
711 endif
712
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
720
721 libgcc-sync-size-funcs := $(foreach prefix, $(libgcc-sync-size-funcs), \
722                             $(foreach suffix, 1 2 4 8 16, \
723                               $(prefix)_$(suffix)))
724
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)
732
733 libgcc-sync-funcs := sync_synchronize
734
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)
741
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)
751
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
760
761 # Build fixed-point support.
762 ifeq ($(fixed_point),yes)
763
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)
768
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))
775
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
781
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)
787
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))
794
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
800
801 endif
802
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
807
808 libgcc-objects += $(addsuffix $(objext),$(basename $(notdir $(LIB2ADD))))
809 libgcc-objects += $(addsuffix $(objext),$(basename $(notdir $(LIB2ADD_ST))))
810
811 c_flags :=
812 iter-items := $(LIB2ADD) $(LIB2ADD_ST)
813 include $(iterator)
814
815 ifeq ($(enable_shared),yes)
816 libgcc-s-objects += $(addsuffix _s$(objext),$(basename $(notdir $(LIB2ADD))))
817 endif
818
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.)
822
823 c_flags := -fexceptions
824
825 ifeq ($(enable_shared),yes)
826
827 libgcc-eh-objects += $(addsuffix $(objext),$(basename $(notdir $(LIB2ADDEHSTATIC))))
828 libgcc-s-objects += $(addsuffix _s$(objext),$(basename $(notdir $(LIB2ADDEHSHARED))))
829
830 iter-items := $(sort $(LIB2ADDEHSTATIC) $(LIB2ADDEHSHARED))
831 include $(iterator)
832
833 else
834 # Not shared.  LIB2ADDEH are added to libgcc.a.
835
836 libgcc-objects += $(addsuffix $(objext),$(basename $(notdir $(LIB2ADDEH))))
837
838 iter-items := $(LIB2ADDEH)
839 include $(iterator)
840
841 endif
842
843 # Build LIBUNWIND. Use -fno-exceptions so that the unwind library does
844 # not generate calls to __gcc_personality_v0.
845
846 c_flags := -fno-exceptions
847
848 libunwind-objects += $(addsuffix $(objext),$(basename $(notdir $(LIBUNWIND))))
849
850 ifeq ($(enable_shared),yes)
851 libunwind-s-objects += $(addsuffix _s$(objext),$(basename $(notdir $(LIBUNWIND))))
852 endif
853
854 iter-items := $(LIBUNWIND)
855 include $(iterator)
856
857 # Build libgcov components.
858
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
870
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)
877
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
887
888
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)
894
895 libgcc.a libgcov.a libunwind.a libgcc_eh.a:
896         -rm -f $@
897
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
906
907         $(RANLIB) $@
908
909 all: libgcc.a libgcov.a
910
911 ifneq ($(LIBUNWIND),)
912 all: libunwind.a
913 endif
914
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
921
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
939
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' < $< > $@
943
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))))))))
957
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))))))
969
970 endif
971
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)
975
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
982
983 crtend$(objext): $(srcdir)/crtstuff.c
984         $(crt_compile) $(CRTSTUFF_T_CFLAGS) -c $< -DCRT_END
985
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
989
990 crtendS$(objext): $(srcdir)/crtstuff.c
991         $(crt_compile) $(CRTSTUFF_T_CFLAGS_S) -c $< -DCRT_END -DCRTSTUFFS_O
992
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
996
997 # crtoffloadbegin and crtoffloadend contain symbols, that mark the begin and
998 # the end of tables with addresses, required for offloading.  crtoffloadtable
999 # contains the array with addresses of those symbols.
1000 crtoffloadbegin$(objext): $(srcdir)/offloadstuff.c
1001         $(crt_compile) $(CRTSTUFF_T_CFLAGS) -c $< -DCRT_BEGIN
1002
1003 crtoffloadend$(objext): $(srcdir)/offloadstuff.c
1004         $(crt_compile) $(CRTSTUFF_T_CFLAGS) -c $< -DCRT_END
1005
1006 crtoffloadtable$(objext): $(srcdir)/offloadstuff.c
1007         $(crt_compile) $(CRTSTUFF_T_CFLAGS) -c $< -DCRT_TABLE
1008 endif
1009
1010 ifeq ($(enable_vtable_verify),yes)
1011 # These are used in vtable verification; see comments in source files for
1012 # more details.
1013
1014 # Override -finhibit-size-directive to avoid mismatch between libgcc and libvtv
1015 # compilations.
1016 VTV_CFLAGS = $(CRTSTUFF_T_CFLAGS_S) -fno-inhibit-size-directive
1017
1018 vtv_start$(objext): $(srcdir)/vtv_start.c
1019         $(crt_compile) $(VTV_CFLAGS) -c $(srcdir)/vtv_start.c
1020
1021 vtv_end$(objext): $(srcdir)/vtv_end.c
1022         $(crt_compile) $(VTV_CFLAGS) -c $(srcdir)/vtv_end.c
1023
1024 vtv_start_preinit$(objext): $(srcdir)/vtv_start_preinit.c
1025         $(crt_compile) $(VTV_CFLAGS) -c $(srcdir)/vtv_start_preinit.c
1026
1027 vtv_end_preinit$(objext): $(srcdir)/vtv_end_preinit.c
1028         $(crt_compile) $(VTV_CFLAGS) -c $(srcdir)/vtv_end_preinit.c
1029 endif
1030
1031 ifeq ($(CUSTOM_CRTIN),)
1032 # -x assembler-with-cpp is only needed on case-insensitive filesystem.
1033 crti$(objext): $(srcdir)/config/$(cpu_type)/crti.S
1034         $(crt_compile) -c -x assembler-with-cpp $<
1035
1036 crtn$(objext): $(srcdir)/config/$(cpu_type)/crtn.S
1037         $(crt_compile) -c -x assembler-with-cpp $<
1038 endif
1039
1040 # Build extra startfiles in the libgcc directory.
1041 .PHONY: libgcc-extra-parts
1042 libgcc-extra-parts: $(EXTRA_PARTS)
1043
1044         # Early copyback; see "all" above for the rationale.  The
1045         # early copy is necessary so that the gcc -B options find
1046         # the right startup files when linking shared libgcc.
1047         $(mkinstalldirs) $(gcc_objdir)$(MULTISUBDIR)
1048         parts="$(EXTRA_PARTS)";                                 \
1049         for file in $$parts; do                                 \
1050           rm -f $(gcc_objdir)$(MULTISUBDIR)/$$file;             \
1051           $(INSTALL_DATA) $$file $(gcc_objdir)$(MULTISUBDIR)/;  \
1052           case $$file in                                        \
1053             *.a)                                                \
1054               $(RANLIB) $(gcc_objdir)$(MULTISUBDIR)/$$file ;;   \
1055           esac;                                                 \
1056         done
1057
1058 all: $(extra-parts)
1059
1060 $(libgcc-objects) $(libgcc-s-objects) $(libgcc-eh-objects) \
1061         $(libgcov-objects) \
1062         $(libunwind-objects) $(libunwind-s-objects) \
1063         $(EXTRA_PARTS): libgcc_tm.h
1064
1065 # Copy unwind.h to the place where gcc will look for it at build-time
1066 install-unwind_h-forbuild:
1067         dest=$(gcc_objdir)/include/tmp$$$$-unwind.h; \
1068         cp unwind.h $$dest; \
1069         chmod a+r $$dest; \
1070         sh $(srcdir)/../move-if-change $$dest $(gcc_objdir)/include/unwind.h
1071
1072 # Copy unwind.h to the place where gcc will look at run-time, once installed
1073 #
1074 # This is redundant with the internal copy above when using a regular toplevel
1075 # "install" target, because gcc's install will copy to the destination as well.
1076 #
1077 # This is however useful for "install-no-fixincludes" case, when only the gcc
1078 # internal headers are copied by gcc's install.
1079 install-unwind_h:
1080         $(mkinstalldirs) $(DESTDIR)$(libsubdir)/include
1081         $(INSTALL_DATA) unwind.h $(DESTDIR)$(libsubdir)/include
1082
1083 all: install-unwind_h-forbuild
1084
1085 # Documentation targets (empty).
1086 .PHONY: info html dvi pdf install-info install-html install-pdf
1087
1088 info:
1089 install-info:
1090 html:
1091 install-html:
1092 dvi:
1093 pdf:
1094 install-pdf:
1095
1096 # Install rules.  These do not depend on "all", so that they can be invoked
1097 # recursively from it.
1098 install-libunwind:
1099         $(mkinstalldirs) $(DESTDIR)$(inst_slibdir)
1100
1101         # NOTE: Maybe this should go into $(inst_libdir), but this
1102         # is where the old mklibgcc.in put it.
1103         $(INSTALL_DATA) libunwind.a $(DESTDIR)$(inst_slibdir)/
1104         chmod 644 $(DESTDIR)$(inst_slibdir)/libunwind.a
1105         $(RANLIB) $(DESTDIR)$(inst_slibdir)/libunwind.a
1106
1107         $(subst @multilib_dir@,$(MULTIDIR),$(subst \
1108                 @shlib_base_name@,libunwind,$(subst \
1109                 @shlib_slibdir_qual@,$(MULTIOSSUBDIR),$(SHLIBUNWIND_INSTALL))))
1110
1111 install-shared:
1112         $(mkinstalldirs) $(DESTDIR)$(inst_libdir)
1113
1114         $(INSTALL_DATA) libgcc_eh.a $(DESTDIR)$(inst_libdir)/
1115         chmod 644 $(DESTDIR)$(inst_libdir)/libgcc_eh.a
1116         $(RANLIB) $(DESTDIR)$(inst_libdir)/libgcc_eh.a
1117
1118         $(subst @multilib_dir@,$(MULTIDIR),$(subst \
1119                 @shlib_base_name@,libgcc_s,$(subst \
1120                 @shlib_slibdir_qual@,$(MULTIOSSUBDIR),$(SHLIB_INSTALL))))
1121
1122 install-leaf: $(install-shared) $(install-libunwind)
1123         $(mkinstalldirs) $(DESTDIR)$(inst_libdir)
1124
1125         $(INSTALL_DATA) libgcc.a $(DESTDIR)$(inst_libdir)/
1126         chmod 644 $(DESTDIR)$(inst_libdir)/libgcc.a
1127         $(RANLIB) $(DESTDIR)$(inst_libdir)/libgcc.a
1128         $(INSTALL_DATA) libgcov.a $(DESTDIR)$(inst_libdir)/
1129         chmod 644 $(DESTDIR)$(inst_libdir)/libgcov.a
1130         $(RANLIB) $(DESTDIR)$(inst_libdir)/libgcov.a
1131
1132         parts="$(INSTALL_PARTS)";                               \
1133         for file in $$parts; do                                 \
1134           rm -f $(DESTDIR)$(inst_libdir)/$$file;                \
1135           $(INSTALL_DATA) $$file $(DESTDIR)$(inst_libdir)/;     \
1136           case $$file in                                        \
1137             *.a)                                                \
1138               $(RANLIB) $(gcc_objdir)$(MULTISUBDIR)/$$file ;;   \
1139           esac;                                                 \
1140         done
1141
1142 install: install-leaf install-unwind_h
1143         @: $(MAKE) ; $(MULTIDO) $(FLAGS_TO_PASS) multi-do DO=install
1144
1145 install-strip: install
1146
1147 .PHONY: install install-shared install-libunwind install-strip
1148 .PHONY: install-unwind_h install-unwind_h-forbuild
1149
1150 # Don't export variables to the environment, in order to not confuse
1151 # configure.
1152 .NOEXPORT:
1153
1154 include $(srcdir)/empty.mk $(wildcard *.dep)