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