]> git.ipfire.org Git - thirdparty/gcc.git/blame - libgcc/Makefile.in
configure.ac: Use the GCC_AC_ENABLE_DECIMAL_FLOAT macro.
[thirdparty/gcc.git] / libgcc / Makefile.in
CommitLineData
fa958513
DJ
1# Makefile.in
2
748086b7 3# Copyright (C) 2005, 2006, 2009 Free Software Foundation
fa958513
DJ
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
748086b7 9# Software Foundation; either version 3 of the License, or (at your option)
fa958513
DJ
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
748086b7
JJ
18# with GCC; see the file COPYING3. If not see
19# <http://www.gnu.org/licenses/>.
fa958513
DJ
20#
21
22libgcc_topdir = @libgcc_topdir@
14e8fc8b
PB
23host_subdir = @host_subdir@
24
fa958513 25gcc_srcdir = $(libgcc_topdir)/gcc
14e8fc8b 26gcc_objdir = $(MULTIBUILDTOP)../../$(host_subdir)/gcc
fa958513
DJ
27
28srcdir = @srcdir@
29
30prefix = @prefix@
31
32exec_prefix = @exec_prefix@
33libdir = @libdir@
89deeaff 34shlib_slibdir = @slibdir@
fa958513
DJ
35
36SHELL = @SHELL@
37
38enable_shared = @enable_shared@
39decimal_float = @decimal_float@
79b87c74 40enable_decimal_float = @enable_decimal_float@
8d2a9e0e 41fixed_point = @fixed_point@
fa958513
DJ
42
43host_noncanonical = @host_noncanonical@
44
45# List of extra object files that should be compiled for this target machine.
46# The rules for compiling them should be in the t-* file for the machine.
47EXTRA_PARTS = @extra_parts@
48
49# Multilib support variables.
50MULTISRCTOP =
51MULTIBUILDTOP =
52MULTIDIRS =
53MULTISUBDIR =
54MULTIDO = true
55MULTICLEAN = true
56
57INSTALL = @INSTALL@
58INSTALL_PROGRAM = @INSTALL_PROGRAM@
59INSTALL_DATA = @INSTALL_DATA@
60mkinstalldirs = $(SHELL) $(libgcc_topdir)/mkinstalldirs
61
62objext = .o
63
64AR = @AR@
65AR_FLAGS = rc
66
67CC = @CC@
68CFLAGS = @CFLAGS@
69RANLIB = @RANLIB@
fa958513 70LN_S = @LN_S@
fa958513
DJ
71
72PWD_COMMAND = $${PWDCMD-pwd}
73
74# Flags to pass to a recursive make.
75FLAGS_TO_PASS = \
76 "AR=$(AR)" \
77 "AR_FLAGS=$(AR_FLAGS)" \
78 "CC=$(CC)" \
79 "CFLAGS=$(CFLAGS)" \
80 "DESTDIR=$(DESTDIR)" \
81 "EXTRA_OFILES=$(EXTRA_OFILES)" \
82 "HDEFINES=$(HDEFINES)" \
83 "INSTALL=$(INSTALL)" \
84 "INSTALL_DATA=$(INSTALL_DATA)" \
85 "INSTALL_PROGRAM=$(INSTALL_PROGRAM)" \
86 "LDFLAGS=$(LDFLAGS)" \
87 "LOADLIBES=$(LOADLIBES)" \
88 "RANLIB=$(RANLIB)" \
89 "SHELL=$(SHELL)" \
90 "prefix=$(prefix)" \
91 "exec_prefix=$(exec_prefix)" \
92 "libdir=$(libdir)" \
93 "libsubdir=$(libsubdir)" \
94 "tooldir=$(tooldir)"
95
96# Dependencies for "all" are set later in the file.
97all: all-multi
98 # Now that we have built all the objects, we need to copy
99 # them back to the GCC directory. Too many things (other
100 # in-tree libraries, and DejaGNU) know about the layout
101 # of the build tree, for now.
edbf8b16 102 $(MAKE) install-leaf DESTDIR=$(gcc_objdir) \
fa958513
DJ
103 slibdir= libsubdir= MULTIOSDIR=$(MULTIDIR)
104
105.PHONY: all-multi
106all-multi:
107 # If this is the top-level multilib, build all the other
108 # multilibs.
109 @: $(MAKE) ; exec $(MULTIDO) $(FLAGS_TO_PASS) multi-do DO=all
110
111.PHONY: check installcheck
112check:
113installcheck:
114
115.PHONY: all clean
116
117clean:
118 -rm -f config.h stamp-h stmp-ldirs libgcc.map
119 -rm -f *$(objext)
120 -rm -f *.dep
121 -rm -f *.a
122 -rm -f libunwind$(SHLIB_EXT)
123 -rm -f libgcc_s*
124 @$(MULTICLEAN) multi-clean DO=clean
125distclean: clean
126 @$(MULTICLEAN) multi-clean DO=distclean
127 -rm -f *~ Makefile config.cache config.status multilib.out
128 -rm -f config.log
129maintainer-clean realclean: distclean
130
131Makefile: $(srcdir)/Makefile.in config.status
132 CONFIG_FILES=Makefile CONFIG_HEADERS= $(SHELL) ./config.status
133
134# Depending on Makefile makes sure that config.status has been re-run
135# if needed. This prevents problems with parallel builds.
136config.h: stamp-h ; @true
137stamp-h: $(srcdir)/config.in config.status Makefile
138 CONFIG_FILES= CONFIG_HEADERS=config.h:$(srcdir)/config.in $(SHELL) ./config.status
139
ff473280 140config.status: $(srcdir)/configure $(srcdir)/config.host
fa958513
DJ
141 $(SHELL) ./config.status --recheck
142
6efbd53f
RW
143AUTOCONF = autoconf
144configure_deps = \
145 $(srcdir)/../config/enable.m4 \
146 $(srcdir)/../config/tls.m4 \
147 $(srcdir)/../config/acx.m4 \
148 $(srcdir)/../config/no-executables.m4 \
149 $(srcdir)/../config/override.m4 \
3c39bca6 150 $(srcdir)/../config/dfp.m4 \
6efbd53f
RW
151
152$(srcdir)/configure: @MAINT@ $(srcdir)/configure.ac $(configure_deps)
153 cd $(srcdir) && $(AUTOCONF)
154
fa958513
DJ
155include $(gcc_objdir)/libgcc.mvars
156
157# Flags to pass to recursive makes.
158
159AR_FOR_TARGET = $(AR)
160AR_FLAGS_FOR_TARGET =
161AR_CREATE_FOR_TARGET = $(AR_FOR_TARGET) $(AR_FLAGS_FOR_TARGET) rc
162AR_EXTRACT_FOR_TARGET = $(AR_FOR_TARGET) $(AR_FLAGS_FOR_TARGET) x
163AWK = @AWK@
164GCC_FOR_TARGET = $(CC)
165LIPO = @LIPO@
166LIPO_FOR_TARGET = $(LIPO)
167MACHMODE_H = machmode.h mode-classes.def insn-modes.h
168NM = @NM@
169NM_FOR_TARGET = $(NM)
170RANLIB_FOR_TARGET = $(RANLIB)
171STRIP = @STRIP@
172STRIP_FOR_TARGET = $(STRIP)
173
174# Directory in which the compiler finds libraries etc.
175libsubdir = $(libdir)/gcc/$(host_noncanonical)/$(version)
176# Used to install the shared libgcc.
177slibdir = @slibdir@
178
179export AR_FOR_TARGET
180export AR_CREATE_FOR_TARGET
181export AR_FLAGS_FOR_TARGET
182export AR_EXTRACT_FOR_TARGET
183export AWK
184export DESTDIR
185export GCC_FOR_TARGET
186export INCLUDES
187export INSTALL_DATA
188export LIB1ASMSRC
189export LIBGCC2_CFLAGS
190export LIPO_FOR_TARGET
191export MACHMODE_H
192export NM_FOR_TARGET
193export STRIP_FOR_TARGET
194export RANLIB_FOR_TARGET
195export libsubdir
196export slibdir
197
79e6eaeb
DJ
198version := $(shell $(CC) -dumpversion)
199
79b87c74 200ifeq ($(decimal_float),yes)
200359e8
L
201ifeq ($(enable_decimal_float),bid)
202DECNUMINC = -I$(srcdir)/config/libbid -DENABLE_DECIMAL_BID_FORMAT
203else
79b87c74 204DECNUMINC = -I$(srcdir)/../libdecnumber/$(enable_decimal_float) \
bc6d4c3f 205 -I$(srcdir)/../libdecnumber
200359e8 206endif
79b87c74
MM
207else
208DECNUMINC =
209endif
fa958513
DJ
210
211# Specify the directories to be searched for header files.
212# Both . and srcdir are used, in that order,
213# so that *config.h will be found in the compilation
214# subdirectory rather than in the source directory.
215# -I$(@D) and -I$(srcdir)/$(@D) cause the subdirectory of the file
216# currently being compiled, in both source trees, to be examined as well.
217INCLUDES = -I. -I$(@D) -I$(gcc_objdir) \
218 -I$(srcdir) -I$(srcdir)/$(@D) -I$(srcdir)/../gcc \
219 -I$(srcdir)/../include $(DECNUMINC)
220
9891ec5f
DJ
221# Forcibly remove any profiling-related flags. There is no point
222# in supporting profiled bootstrap in this library.
223override CFLAGS := $(filter-out -fprofile-generate -fprofile-use,$(CFLAGS))
224
fa958513
DJ
225# CFLAGS first is not perfect; normally setting CFLAGS should override any
226# options in LIBGCC2_CFLAGS. But LIBGCC2_CFLAGS may contain -g0, and CFLAGS
227# will usually contain -g, so for the moment CFLAGS goes first. We must
228# include CFLAGS - that's where multilib options live.
6f461e76 229INTERNAL_CFLAGS = $(CFLAGS) $(LIBGCC2_CFLAGS) $(HOST_LIBGCC2_CFLAGS) \
368fabd5 230 $(INCLUDES) @set_have_cc_tls@ @set_use_emutls@
fa958513
DJ
231
232MULTIDIR := $(shell $(CC) $(CFLAGS) -print-multi-directory)
233MULTIOSDIR := $(shell $(CC) $(CFLAGS) -print-multi-os-directory)
234
235MULTIOSSUBDIR := $(shell if test $(MULTIOSDIR) != .; then echo /$(MULTIOSDIR); fi)
236inst_libdir = $(libsubdir)$(MULTISUBDIR)
237inst_slibdir = $(slibdir)$(MULTIOSSUBDIR)
238
239gcc_compile_bare = $(CC) $(INTERNAL_CFLAGS)
240compile_deps = -MT $@ -MD -MP -MF $(basename $@).dep
241gcc_compile = $(gcc_compile_bare) -o $@ $(compile_deps)
242gcc_s_compile = $(gcc_compile) -DSHARED
243
244objects = $(filter %$(objext),$^)
245
246# Collect any host-specific information from Makefile fragments.
247tmake_file = @tmake_file@
248include $(srcdir)/empty.mk $(tmake_file)
249
250# Only handle shared libraries if both:
251# - the user requested them
252# - we know how to build them
253ifeq ($(SHLIB_LINK),)
254 enable_shared := no
255endif
256
257ifeq ($(enable_shared),yes)
258 iterator = $(srcdir)/empty.mk $(patsubst %,$(srcdir)/shared-object.mk,$(iter-items))
259
260 install-shared = install-shared
261
262 ifneq ($(LIBUNWIND),)
263 install-libunwind = install-libunwind
264 endif
265
266# For -fvisibility=hidden. We need both a -fvisibility=hidden on
267# the command line, and a #define to prevent libgcc2.h etc from
268# overriding that with #pragmas.
269vis_hide = @vis_hide@
270
271ifneq (,$(vis_hide))
272
273# If we have -fvisibility=hidden, then we need to generate hide
274# lists for object files implemented in assembly.
275ASM_HIDDEN_OP = @asm_hidden_op@
276
277define gen-hide-list
278$(NM) -pg $< | \
c252db20
L
279 $(AWK) 'NF == 3 && $$2 !~ /^[UN]$$/ && $$3 !~ /.*_compat/ \
280 && $$3 !~ /.*@.*/ \
281 { print "\t$(ASM_HIDDEN_OP)", $$3 }' > $@T
fa958513
DJ
282mv -f $@T $@
283endef
284else
285gen-hide-list = echo > $@
286endif
287
288else
289# Not enable_shared.
290iterator = $(srcdir)/empty.mk $(patsubst %,$(srcdir)/static-object.mk,$(iter-items))
291vis_hide =
292gen-hide-list = echo > \$@
293endif
294
295ifneq ($(EXTRA_PARTS),)
296 extra-parts = libgcc-extra-parts
297 INSTALL_PARTS = $(EXTRA_PARTS)
298else
299ifneq ($(GCC_EXTRA_PARTS),)
300 extra-parts = gcc-extra-parts
301 INSTALL_PARTS = $(GCC_EXTRA_PARTS)
302endif
303endif
304
305# Library members defined in libgcc2.c.
306lib2funcs = _muldi3 _negdi2 _lshrdi3 _ashldi3 _ashrdi3 _cmpdi2 _ucmpdi2 \
307 _clear_cache _enable_execute_stack _trampoline __main _absvsi2 \
308 _absvdi2 _addvsi3 _addvdi3 _subvsi3 _subvdi3 _mulvsi3 _mulvdi3 \
309 _negvsi2 _negvdi2 _ctors _ffssi2 _ffsdi2 _clz _clzsi2 _clzdi2 \
310 _ctzsi2 _ctzdi2 _popcount_tab _popcountsi2 _popcountdi2 \
311 _paritysi2 _paritydi2 _powisf2 _powidf2 _powixf2 _powitf2 \
312 _mulsc3 _muldc3 _mulxc3 _multc3 _divsc3 _divdc3 _divxc3 \
313 _divtc3 _bswapsi2 _bswapdi2
314
315# The floating-point conversion routines that involve a single-word integer.
316# XX stands for the integer mode.
317swfloatfuncs = $(patsubst %,_fixuns%XX,sf df xf)
318
319# Likewise double-word routines.
320dwfloatfuncs = $(patsubst %,_fix%XX,sf df xf tf) \
321 $(patsubst %,_fixuns%XX,sf df xf tf) \
322 $(patsubst %,_floatXX%,sf df xf tf) \
323 $(patsubst %,_floatunXX%,sf df xf tf)
324
325ifeq ($(LIB2_SIDITI_CONV_FUNCS),)
326 lib2funcs += $(subst XX,si,$(swfloatfuncs))
327 lib2funcs += $(subst XX,di,$(dwfloatfuncs))
328endif
329
330# These might cause a divide overflow trap and so are compiled with
331# unwinder info.
332LIB2_DIVMOD_FUNCS = _divdi3 _moddi3 _udivdi3 _umoddi3 _udiv_w_sdiv _udivmoddi4
333
334# Remove any objects from lib2funcs and LIB2_DIVMOD_FUNCS that are
335# defined as optimized assembly code in LIB1ASMFUNCS or as C code
336# in LIB2FUNCS_EXCLUDE.
337lib2funcs := $(filter-out $(LIB2FUNCS_EXCLUDE) $(LIB1ASMFUNCS),$(lib2funcs))
338LIB2_DIVMOD_FUNCS := $(filter-out $(LIB2FUNCS_EXCLUDE) $(LIB1ASMFUNCS), \
339 $(LIB2_DIVMOD_FUNCS))
340
341# Build "libgcc1" (assembly) components.
342ifeq ($(enable_shared),yes)
343
344lib1asmfuncs-o = $(patsubst %,%$(objext),$(LIB1ASMFUNCS))
345$(lib1asmfuncs-o): %$(objext): $(gcc_srcdir)/config/$(LIB1ASMSRC) %.vis
346 $(gcc_compile) -DL$* -xassembler-with-cpp \
347 -c $(gcc_srcdir)/config/$(LIB1ASMSRC) -include $*.vis
348$(patsubst %,%.vis,$(LIB1ASMFUNCS)): %.vis: %_s$(objext)
349 $(gen-hide-list)
350libgcc-objects += $(lib1asmfuncs-o)
351
352lib1asmfuncs-s-o = $(patsubst %,%_s$(objext),$(LIB1ASMFUNCS))
353$(lib1asmfuncs-s-o): %_s$(objext): $(gcc_srcdir)/config/$(LIB1ASMSRC)
354 $(gcc_s_compile) -DL$* -xassembler-with-cpp \
355 -c $(gcc_srcdir)/config/$(LIB1ASMSRC)
356libgcc-s-objects += $(lib1asmfuncs-s-o)
357
358else
359
360lib1asmfuncs-o = $(patsubst %,%$(objext),$(LIB1ASMFUNCS))
361$(lib1asmfuncs-o): %$(objext): $(gcc_srcdir)/config/$(LIB1ASMSRC)
362 $(gcc_compile) -DL$* -xassembler-with-cpp \
363 -c $(gcc_srcdir)/config/$(LIB1ASMSRC)
364libgcc-objects += $(lib1asmfuncs-o)
365
366endif
367
368# Build lib2funcs. For the static library also include LIB2FUNCS_ST.
369lib2funcs-o = $(patsubst %,%$(objext),$(lib2funcs) $(LIB2FUNCS_ST))
370$(lib2funcs-o): %$(objext): $(gcc_srcdir)/libgcc2.c
371 $(gcc_compile) -DL$* -c $(gcc_srcdir)/libgcc2.c \
372 $(vis_hide)
373libgcc-objects += $(lib2funcs-o)
374
375ifeq ($(enable_shared),yes)
376lib2funcs-s-o = $(patsubst %,%_s$(objext),$(lib2funcs))
377$(lib2funcs-s-o): %_s$(objext): $(gcc_srcdir)/libgcc2.c
378 $(gcc_s_compile) -DL$* -c $(gcc_srcdir)/libgcc2.c
379libgcc-s-objects += $(lib2funcs-s-o)
380endif
381
382ifneq ($(LIB2_SIDITI_CONV_FUNCS),)
383# Build libgcc2.c for each conversion function, with a specific
384# L<func> definition and LIBGCC2_UNITS_PER_WORD setting. The DImode
385# functions are built with a wordsize of 4; the TImode functions are
386# built with the same labels, but a wordsize of 8.
387
388sifuncs = $(subst XX,si,$(swfloatfuncs))
389difuncs = $(subst XX,di,$(dwfloatfuncs))
390tifuncs = $(subst XX,ti,$(dwfloatfuncs))
391
392iter-items := $(sifuncs) $(difuncs) $(tifuncs)
393iter-labels := $(sifuncs) $(difuncs) $(difuncs)
394iter-sizes := $(patsubst %,4,$(sifuncs) $(difuncs)) $(patsubst %,8,$(tifuncs))
395
396include $(srcdir)/empty.mk $(patsubst %,$(srcdir)/siditi-object.mk,$(iter-items))
397
398libgcc-objects += $(patsubst %,%$(objext),$(sifuncs) $(difuncs) $(tifuncs))
399ifeq ($(enable_shared),yes)
400libgcc-s-objects += $(patsubst %,%_s$(objext),$(sifuncs) $(difuncs) $(tifuncs))
401endif
402endif
403
404# Build LIB2_DIVMOD_FUNCS.
405lib2-divmod-o = $(patsubst %,%$(objext),$(LIB2_DIVMOD_FUNCS))
406$(lib2-divmod-o): %$(objext): $(gcc_srcdir)/libgcc2.c
407 $(gcc_compile) -DL$* -c $(gcc_srcdir)/libgcc2.c \
408 -fexceptions -fnon-call-exceptions $(vis_hide)
409libgcc-objects += $(lib2-divmod-o)
410
411ifeq ($(enable_shared),yes)
412lib2-divmod-s-o = $(patsubst %,%_s$(objext),$(LIB2_DIVMOD_FUNCS))
413$(lib2-divmod-s-o): %_s$(objext): $(gcc_srcdir)/libgcc2.c
414 $(gcc_s_compile) -DL$* -c $(gcc_srcdir)/libgcc2.c \
415 -fexceptions -fnon-call-exceptions
416libgcc-s-objects += $(lib2-divmod-s-o)
417endif
418
419# $(FPBIT) et al. are pathnames relative to the GCC build
420# directory; the supporting files are made by the GCC
421# Makefile.
422# FIXME: Soon we will be able to move this logic into this directory.
423
424ifneq ($(fpbit-in-libgcc),yes)
425FPBIT:=$(if $(FPBIT),$(gcc_objdir)/$(FPBIT),)
426DPBIT:=$(if $(DPBIT),$(gcc_objdir)/$(DPBIT),)
427TPBIT:=$(if $(TPBIT),$(gcc_objdir)/$(TPBIT),)
428endif
429
430ifeq ($(TPBIT),)
431# _sf_to_tf and _df_to_tf require tp-bit.c being compiled in.
432FPBIT_FUNCS := $(filter-out _sf_to_tf,$(FPBIT_FUNCS))
433DPBIT_FUNCS := $(filter-out _df_to_tf,$(DPBIT_FUNCS))
434endif
435
436# Build FPBIT.
437ifneq ($(FPBIT),)
438fpbit-o = $(patsubst %,%$(objext),$(FPBIT_FUNCS))
439$(fpbit-o): %$(objext): $(FPBIT)
440 $(gcc_compile) -DFINE_GRAINED_LIBRARIES -DL$* -c $(FPBIT) $(vis_hide)
441libgcc-objects += $(fpbit-o)
442
443ifeq ($(enable_shared),yes)
444fpbit-s-o = $(patsubst %,%_s$(objext),$(FPBIT_FUNCS))
445$(fpbit-s-o): %_s$(objext): $(FPBIT)
446 $(gcc_s_compile) -DFINE_GRAINED_LIBRARIES -DL$* -c $(FPBIT)
447libgcc-s-objects += $(fpbit-s-o)
448endif
449endif
450
451# Build DPBIT.
452ifneq ($(DPBIT),)
453dpbit-o = $(patsubst %,%$(objext),$(DPBIT_FUNCS))
454$(dpbit-o): %$(objext): $(DPBIT)
455 $(gcc_compile) -DFINE_GRAINED_LIBRARIES -DL$* -c $(DPBIT) $(vis_hide)
456libgcc-objects += $(dpbit-o)
457
458ifeq ($(enable_shared),yes)
459dpbit-s-o = $(patsubst %,%_s$(objext),$(DPBIT_FUNCS))
460$(dpbit-s-o): %_s$(objext): $(DPBIT)
461 $(gcc_s_compile) -DFINE_GRAINED_LIBRARIES -DL$* -c $(DPBIT)
462libgcc-s-objects += $(dpbit-s-o)
463endif
464endif
465
466# Build TPBIT.
467ifneq ($(TPBIT),)
468tpbit-o = $(patsubst %,%$(objext),$(TPBIT_FUNCS))
469$(tpbit-o): %$(objext): $(TPBIT)
470 $(gcc_compile) -DFINE_GRAINED_LIBRARIES -DL$* -c $(TPBIT) $(vis_hide)
471libgcc-objects += $(tpbit-o)
472
473ifeq ($(enable_shared),yes)
474tpbit-s-o = $(patsubst %,%_s$(objext),$(TPBIT_FUNCS))
475$(tpbit-s-o): %_s$(objext): $(TPBIT)
476 $(gcc_s_compile) -DFINE_GRAINED_LIBRARIES -DL$* -c $(TPBIT)
477libgcc-s-objects += $(tpbit-s-o)
478endif
479endif
480
481# Build decimal floating point support.
482ifeq ($(decimal_float),yes)
483
484# If $DFP_ENABLE is set, then we want all data type sizes.
485ifneq ($(DFP_ENABLE),)
486D32PBIT = 1
487D64PBIT = 1
488D128PBIT = 1
489endif
490
200359e8 491dfp-filenames =
fa958513 492ifneq ($(D32PBIT)$(D64PBIT)$(D128PBIT),)
200359e8 493ifeq ($(enable_decimal_float),bid)
b2a00c89
L
494dfp-filenames += bid_decimal_globals bid_decimal_data \
495 bid_binarydecimal bid_convert_data \
496 _isinfd32 _isinfd64 _isinfd128 bid64_noncomp \
497 bid128_noncomp bid128_fma bid_round bid_from_int \
200359e8
L
498 bid64_add bid128_add bid64_div bid128_div \
499 bid64_mul bid128_mul bid64_compare bid128_compare \
500 bid128 bid32_to_bid64 bid32_to_bid128 bid64_to_bid128 \
501 bid64_to_int32 bid64_to_int64 \
502 bid64_to_uint32 bid64_to_uint64 \
503 bid128_to_int32 bid128_to_int64 \
504 bid128_to_uint32 bid128_to_uint64
505else
2533577f 506dfp-filenames += decContext decNumber decExcept decRound decLibrary decDouble decPacked decQuad decSingle
200359e8 507endif
fa958513
DJ
508endif
509
200359e8
L
510dfp-objects = $(patsubst %,%$(objext),$(dfp-filenames))
511ifeq ($(enable_decimal_float),bid)
512$(dfp-objects): %$(objext): $(srcdir)/config/libbid/%.c
513else
514$(dfp-objects): %$(objext): $(srcdir)/../libdecnumber/%.c
515endif
79b87c74 516 $(gcc_compile) -c $<
200359e8 517libgcc-objects += $(dfp-objects)
79b87c74
MM
518
519decbits-filenames =
200359e8 520ifneq ($(enable_decimal_float),bid)
fa958513 521ifneq ($(D32PBIT),)
79b87c74 522decbits-filenames += decimal32
fa958513
DJ
523endif
524
525ifneq ($(D64PBIT),)
79b87c74 526decbits-filenames += decimal64
fa958513
DJ
527endif
528
529ifneq ($(D128PBIT),)
79b87c74 530decbits-filenames += decimal128
fa958513 531endif
79b87c74
MM
532endif
533
534decbits-objects = $(patsubst %,%$(objext),$(decbits-filenames))
200359e8
L
535ifeq ($(enable_decimal_float),bid)
536$(decbits-objects): %$(objext): $(srcdir)/config/libbid/%.c
537else
79b87c74 538$(decbits-objects): %$(objext): $(srcdir)/../libdecnumber/$(enable_decimal_float)/%.c
200359e8 539endif
fa958513 540 $(gcc_compile) -c $<
79b87c74 541libgcc-objects += $(decbits-objects)
fa958513
DJ
542
543# Next build individual support functions.
200359e8
L
544ifeq ($(enable_decimal_float),bid)
545ifneq ($(D32PBIT),)
546D32PBIT_FUNCS:=$(filter-out _plus_sd _minus_sd _conv_sd, $(D32PBIT_FUNCS))
547endif
548
549ifneq ($(D64PBIT),)
550D64PBIT_FUNCS:=$(filter-out _plus_dd _minus_dd _conv_dd, $(D64PBIT_FUNCS))
551endif
552
553ifneq ($(D128PBIT),)
554D128PBIT_FUNCS:=$(filter-out _plus_td _minus_td _conv_td, $(D128PBIT_FUNCS))
555endif
556endif
557
fa958513
DJ
558ifneq ($(D32PBIT),)
559d32pbit-o = $(patsubst %,%$(objext),$(D32PBIT_FUNCS))
200359e8
L
560ifeq ($(enable_decimal_float),bid)
561$(d32pbit-o): %$(objext): $(srcdir)/config/libbid/%.c
562else
fa958513 563$(d32pbit-o): %$(objext): $(gcc_srcdir)/config/dfp-bit.c
200359e8 564endif
fa958513
DJ
565 $(gcc_compile) -DFINE_GRAINED_LIBRARIES -DL$* -DWIDTH=32 -c $<
566libgcc-objects += $(d32pbit-o)
567endif
568
569ifneq ($(D64PBIT),)
570d64pbit-o = $(patsubst %,%$(objext),$(D64PBIT_FUNCS))
200359e8
L
571ifeq ($(enable_decimal_float),bid)
572$(d64pbit-o): %$(objext): $(srcdir)/config/libbid/%.c
573else
fa958513 574$(d64pbit-o): %$(objext): $(gcc_srcdir)/config/dfp-bit.c
200359e8 575endif
fa958513
DJ
576 $(gcc_compile) -DFINE_GRAINED_LIBRARIES -DL$* -DWIDTH=64 -c $<
577libgcc-objects += $(d64pbit-o)
578endif
579
580ifneq ($(D128PBIT),)
581d128pbit-o = $(patsubst %,%$(objext),$(D128PBIT_FUNCS))
200359e8
L
582ifeq ($(enable_decimal_float),bid)
583$(d128pbit-o): %$(objext): $(srcdir)/config/libbid/%.c
584else
fa958513 585$(d128pbit-o): %$(objext): $(gcc_srcdir)/config/dfp-bit.c
200359e8 586endif
fa958513
DJ
587 $(gcc_compile) -DFINE_GRAINED_LIBRARIES -DL$* -DWIDTH=128 -c $<
588libgcc-objects += $(d128pbit-o)
589endif
590
591endif
592
f92518d7
RS
593ifeq ($(LIBGCC_SYNC),yes)
594libgcc-sync-size-funcs := $(foreach op, add sub or and xor nand, \
595 sync_fetch_and_$(op) \
596 sync_$(op)_and_fetch) \
597 sync_bool_compare_and_swap \
598 sync_val_compare_and_swap \
599 sync_lock_test_and_set
600
601libgcc-sync-size-funcs := $(foreach prefix, $(libgcc-sync-size-funcs), \
602 $(foreach suffix, 1 2 4 8 16, \
603 $(prefix)_$(suffix)))
604
605libgcc-sync-size-funcs-o = $(patsubst %,%$(objext),$(libgcc-sync-size-funcs))
606$(libgcc-sync-size-funcs-o): %$(objext): $(gcc_srcdir)/config/sync.c
607 $(gcc_compile) $(LIBGCC_SYNC_CFLAGS) \
608 -DFN=`echo "$*" | sed 's/_[^_]*$$//'` \
609 -DSIZE=`echo "$*" | sed 's/.*_//'` \
610 -c $(gcc_srcdir)/config/sync.c $(vis_hide)
611libgcc-objects += $(libgcc-sync-size-funcs-o)
612
613libgcc-sync-funcs := sync_synchronize
614
615libgcc-sync-funcs-o = $(patsubst %,%$(objext),$(libgcc-sync-funcs))
616$(libgcc-sync-funcs-o): %$(objext): $(gcc_srcdir)/config/sync.c
617 $(gcc_compile) $(LIBGCC_SYNC_CFLAGS) \
618 -DL$* \
619 -c $(gcc_srcdir)/config/sync.c $(vis_hide)
620libgcc-objects += $(libgcc-sync-funcs-o)
621
622ifeq ($(enable_shared),yes)
623libgcc-sync-size-funcs-s-o = $(patsubst %,%_s$(objext), \
624 $(libgcc-sync-size-funcs))
625$(libgcc-sync-size-funcs-s-o): %_s$(objext): $(gcc_srcdir)/config/sync.c
626 $(gcc_s_compile) $(LIBGCC_SYNC_CFLAGS) \
627 -DFN=`echo "$*" | sed 's/_[^_]*$$//'` \
628 -DSIZE=`echo "$*" | sed 's/.*_//'` \
629 -c $(gcc_srcdir)/config/sync.c
630libgcc-s-objects += $(libgcc-sync-size-funcs-s-o)
631
632libgcc-sync-funcs-s-o = $(patsubst %,%_s$(objext),$(libgcc-sync-funcs))
633$(libgcc-sync-funcs-s-o): %_s$(objext): $(gcc_srcdir)/config/sync.c
634 $(gcc_s_compile) $(LIBGCC_SYNC_CFLAGS) \
635 -DL$* \
636 -c $(gcc_srcdir)/config/sync.c
637libgcc-s-objects += $(libgcc-sync-funcs-s-o)
638endif
639endif
640
8d2a9e0e
CF
641# Build fixed-point support.
642ifeq ($(fixed_point),yes)
643
644# Generate permutations of function name and mode
645fixed-labels := $(shell $(SHELL) $(srcdir)/gen-fixed.sh arith labels)
646fixed-funcs := $(shell $(SHELL) $(srcdir)/gen-fixed.sh arith funcs)
647fixed-modes := $(shell $(SHELL) $(srcdir)/gen-fixed.sh arith modes)
648
649# Generate the rules for each arithmetic function
650iter-items := $(fixed-funcs)
651iter-labels := $(fixed-labels)
652iter-from := $(fixed-modes)
653iter-to := $(fixed-modes)
654include $(srcdir)/empty.mk $(patsubst %,$(srcdir)/fixed-obj.mk,$(iter-items))
655
656# Add arithmetic functions to list of objects to be built
657libgcc-objects += $(patsubst %,%$(objext),$(fixed-funcs))
658ifeq ($(enable_shared),yes)
659libgcc-s-objects += $(patsubst %,%_s$(objext),$(fixed-funcs))
660endif
661
662# Convert from or to fractional
663fixed-conv-funcs := $(shell $(SHELL) $(srcdir)/gen-fixed.sh conv funcs)
664fixed-conv-labels := $(shell $(SHELL) $(srcdir)/gen-fixed.sh conv labels)
665fixed-conv-from := $(shell $(SHELL) $(srcdir)/gen-fixed.sh conv from)
666fixed-conv-to := $(shell $(SHELL) $(srcdir)/gen-fixed.sh conv to)
667
668# Generate the make rules for each conversion function
669iter-items := $(fixed-conv-funcs)
670iter-labels := $(fixed-conv-labels)
671iter-from := $(fixed-conv-from)
672iter-to := $(fixed-conv-to)
673include $(srcdir)/empty.mk $(patsubst %,$(srcdir)/fixed-obj.mk,$(iter-items))
674
675# Add conversion functions to list of objects to be built
676libgcc-objects += $(patsubst %,%$(objext),$(fixed-conv-funcs))
677ifeq ($(enable_shared),yes)
678libgcc-s-objects += $(patsubst %,%_s$(objext),$(fixed-conv-funcs))
679endif
680
681endif
682
fa958513
DJ
683# Build LIB2ADD and LIB2ADD_ST.
684ifneq ($(filter-out %.c %.S %.asm,$(LIB2ADD) $(LIB2ADD_ST)),)
685$(error Unsupported files in LIB2ADD or LIB2ADD_ST.)
686endif
687
688libgcc-objects += $(addsuffix $(objext),$(basename $(notdir $(LIB2ADD))))
689libgcc-objects += $(addsuffix $(objext),$(basename $(notdir $(LIB2ADD_ST))))
690
691c_flags :=
692iter-items := $(LIB2ADD) $(LIB2ADD_ST)
693include $(iterator)
694
695ifeq ($(enable_shared),yes)
696libgcc-s-objects += $(addsuffix _s$(objext),$(basename $(notdir $(LIB2ADD))))
697endif
698
699# Build LIB2ADDEH, LIB2ADDEHSTATIC, and LIB2ADDEHSHARED. If we don't have
700# libgcc_eh.a, only LIB2ADDEH matters. If we do, only LIB2ADDEHSTATIC and
701# LIB2ADDEHSHARED matter. (Usually all three are identical.)
702
703c_flags := -fexceptions
704
705ifeq ($(enable_shared),yes)
706
707libgcc-eh-objects += $(addsuffix $(objext),$(basename $(notdir $(LIB2ADDEHSTATIC))))
708libgcc-s-objects += $(addsuffix _s$(objext),$(basename $(notdir $(LIB2ADDEHSHARED))))
709
710iter-items := $(sort $(LIB2ADDEHSTATIC) $(LIB2ADDEHSHARED))
711include $(iterator)
712
713else
714# Not shared. LIB2ADDEH are added to libgcc.a.
715
716libgcc-objects += $(addsuffix $(objext),$(basename $(notdir $(LIB2ADDEH))))
717
718iter-items := $(LIB2ADDEH)
719include $(iterator)
720
721endif
722
723# Build LIBUNWIND.
724
725c_flags := -fexceptions
726
727libunwind-objects += $(addsuffix $(objext),$(basename $(notdir $(LIBUNWIND))))
728
729ifeq ($(enable_shared),yes)
730libunwind-s-objects += $(addsuffix _s$(objext),$(basename $(notdir $(LIBUNWIND))))
731endif
732
733iter-items := $(LIBUNWIND)
734include $(iterator)
735
736# Build libgcov components.
737libgcov-objects = $(patsubst %,%$(objext),$(LIBGCOV))
738$(libgcov-objects): %$(objext): $(gcc_srcdir)/libgcov.c
739 $(gcc_compile) -DL$* -c $(gcc_srcdir)/libgcov.c
740
741
742# Static libraries.
743libgcc.a: $(libgcc-objects)
744libgcov.a: $(libgcov-objects)
745libunwind.a: $(libunwind-objects)
746libgcc_eh.a: $(libgcc-eh-objects)
747
748libgcc.a libgcov.a libunwind.a libgcc_eh.a:
749 -rm -f $@
750
751 objects="$(objects)"; \
752 if test -z "$$objects"; then \
753 echo 'int __libgcc_eh_dummy;' > eh_dummy.c; \
754 $(gcc_compile_bare) $(vis_hide) -c eh_dummy.c \
755 -o eh_dummy$(objext); \
756 objects=eh_dummy$(objext); \
757 fi; \
758 $(AR_CREATE_FOR_TARGET) $@ $$objects
759
760 $(RANLIB) $@
761
762all: libgcc.a libgcov.a
763
764ifneq ($(LIBUNWIND),)
765all: libunwind.a
cd5c2357 766libgcc_s$(SHLIB_EXT): libunwind$(SHLIB_EXT)
fa958513
DJ
767endif
768
769ifeq ($(enable_shared),yes)
770all: libgcc_eh.a libgcc_s$(SHLIB_EXT)
771ifneq ($(LIBUNWIND),)
772all: libunwind$(SHLIB_EXT)
773endif
774endif
775
776ifeq ($(enable_shared),yes)
777
778# Map-file generation.
779ifneq ($(SHLIB_MKMAP),)
780libgcc.map: $(SHLIB_MKMAP) $(SHLIB_MAPFILES) $(libgcc-s-objects)
781 { $(NM) $(SHLIB_NM_FLAGS) $(libgcc-s-objects); echo %%; \
782 cat $(SHLIB_MAPFILES) \
783 | sed -e '/^[ ]*#/d' \
784 -e 's/^%\(if\|else\|elif\|endif\|define\)/#\1/' \
785 | $(gcc_compile_bare) -E -xassembler-with-cpp -; \
786 } | $(AWK) -f $(SHLIB_MKMAP) $(SHLIB_MKMAP_OPTS) > tmp-$@
787 mv tmp-$@ $@
788libgcc_s$(SHLIB_EXT): libgcc.map
789mapfile = libgcc.map
790endif
791
792libgcc_s$(SHLIB_EXT): $(libgcc-s-objects) $(extra-parts)
793 # @multilib_flags@ is still needed because this may use
794 # $(GCC_FOR_TARGET) and $(LIBGCC2_CFLAGS) directly.
795 # @multilib_dir@ is not really necessary, but sometimes it has
796 # more uses than just a directory name.
797 $(mkinstalldirs) $(MULTIDIR)
cd5c2357 798 $(subst @multilib_flags@,$(CFLAGS) -B./,$(subst \
fa958513
DJ
799 @multilib_dir@,$(MULTIDIR),$(subst \
800 @shlib_objs@,$(objects),$(subst \
801 @shlib_base_name@,libgcc_s,$(subst \
802 @shlib_map_file@,$(mapfile),$(subst \
89deeaff
EK
803 @shlib_slibdir_qual@,$(MULTIOSSUBDIR),$(subst \
804 @shlib_slibdir@,$(shlib_slibdir),$(SHLIB_LINK))))))))
fa958513
DJ
805
806libunwind$(SHLIB_EXT): $(libunwind-s-objects) $(extra-parts)
807 # @multilib_flags@ is still needed because this may use
808 # $(GCC_FOR_TARGET) and $(LIBGCC2_CFLAGS) directly.
809 # @multilib_dir@ is not really necessary, but sometimes it has
810 # more uses than just a directory name.
811 $(mkinstalldirs) $(MULTIDIR)
cd5c2357 812 $(subst @multilib_flags@,$(CFLAGS) -B./,$(subst \
fa958513
DJ
813 @multilib_dir@,$(MULTIDIR),$(subst \
814 @shlib_objs@,$(objects),$(subst \
815 @shlib_base_name@,libunwind,$(subst \
816 @shlib_slibdir_qual@,$(MULTIOSSUBDIR),$(SHLIBUNWIND_LINK))))))
817
818endif
819
820# Build the standard GCC startfiles and endfiles.
821ALL_CRT_CFLAGS = $(CFLAGS) $(CRTSTUFF_CFLAGS) $(INCLUDES)
822crt_compile = $(CC) $(ALL_CRT_CFLAGS) -o $@ $(compile_deps)
823
824ifeq ($(CUSTOM_CRTSTUFF),)
825crtbegin$(objext): $(gcc_srcdir)/crtstuff.c
826 $(crt_compile) $(CRTSTUFF_T_CFLAGS) \
827 -c $(gcc_srcdir)/crtstuff.c -DCRT_BEGIN
828
829crtend$(objext): $(gcc_srcdir)/crtstuff.c
830 $(crt_compile) $(CRTSTUFF_T_CFLAGS) \
831 -c $(gcc_srcdir)/crtstuff.c -DCRT_END
832
833# These are versions of crtbegin and crtend for shared libraries.
834crtbeginS$(objext): $(gcc_srcdir)/crtstuff.c
835 $(crt_compile) $(CRTSTUFF_T_CFLAGS_S) \
836 -c $(gcc_srcdir)/crtstuff.c -DCRT_BEGIN -DCRTSTUFFS_O
837
838crtendS$(objext): $(gcc_srcdir)/crtstuff.c
839 $(crt_compile) $(CRTSTUFF_T_CFLAGS_S) \
840 -c $(gcc_srcdir)/crtstuff.c -DCRT_END -DCRTSTUFFS_O
841
842# This is a version of crtbegin for -static links.
843crtbeginT.o: $(gcc_srcdir)/crtstuff.c
844 $(crt_compile) $(CRTSTUFF_T_CFLAGS) \
845 -c $(gcc_srcdir)/crtstuff.c -DCRT_BEGIN -DCRTSTUFFT_O
846endif
847
848# Build extra startfiles in the libgcc directory.
849.PHONY: libgcc-extra-parts
850libgcc-extra-parts: $(EXTRA_PARTS)
851ifneq ($(GCC_EXTRA_PARTS),)
852ifneq ($(sort $(EXTRA_PARTS)),$(GCC_EXTRA_PARTS))
853 # If the gcc directory specifies which extra parts to
854 # build for this target, and the libgcc configuration also
855 # specifies, make sure they match. This can be removed
856 # when the gcc directory no longer holds libgcc configuration;
857 # it is useful when migrating a target.
858 @echo "Configuration mismatch!"
859 @echo "Extra parts from gcc directory: $(GCC_EXTRA_PARTS)"
860 @echo "Extra parts from libgcc: $(EXTRA_PARTS)"
861 exit 1
862endif
863endif
864
865 # Early copyback; see "all" above for the rationale. The
866 # early copy is necessary so that the gcc -B options find
867 # the right startup files when linking shared libgcc.
868 $(mkinstalldirs) $(gcc_objdir)$(MULTISUBDIR)
869 parts="$(EXTRA_PARTS)"; \
870 for file in $$parts; do \
871 rm -f $(gcc_objdir)$(MULTISUBDIR)/$$file; \
872 $(INSTALL_DATA) $$file $(gcc_objdir)$(MULTISUBDIR)/; \
873 done
874
875# Build extra startfiles in the gcc directory, for unconverted
876# targets.
877.PHONY: gcc-extra-parts
878gcc-extra-parts:
879 # Recursively invoke make in the GCC directory to build any
880 # startfiles (for now). We must do this just once, passing
881 # it all the GCC_EXTRA_PARTS as simultaneous goal targets,
882 # so that rules which cannot execute simultaneously are properly
883 # serialized. We indirect through T_TARGET in case any multilib
884 # directories contain an equals sign, to prevent make from
885 # interpreting any of the goals as variable assignments.
886
887 # We must use cd && make rather than make -C, or else the stage
888 # number will be embedded in debug information.
889
890 T=`$(PWD_COMMAND)`/ \
891 && cd $(gcc_objdir) \
892 && $(MAKE) GCC_FOR_TARGET="$(CC)" \
893 MULTILIB_CFLAGS="$(CFLAGS)" \
894 T=$$T \
895 T_TARGET="$(patsubst %,$${T}%,$(GCC_EXTRA_PARTS))" \
896 T_TARGET
897
898 # Early copyback; see "all" above for the rationale. The
899 # early copy is necessary so that the gcc -B options find
900 # the right startup files when linking shared libgcc.
901 $(mkinstalldirs) $(gcc_objdir)$(MULTISUBDIR)
902 parts="$(GCC_EXTRA_PARTS)"; \
903 for file in $$parts; do \
904 rm -f $(gcc_objdir)$(MULTISUBDIR)/$$file; \
905 $(INSTALL_DATA) $$file $(gcc_objdir)$(MULTISUBDIR)/; \
906 done
907
908all: $(extra-parts)
909
e0a9456a 910# Documentation targets (empty).
e8bb4597 911.PHONY: info html dvi pdf install-info install-html install-pdf
b0088af7 912
e0a9456a 913info:
e8bb4597 914install-info:
e0a9456a 915html:
ac84c172 916install-html:
e0a9456a 917dvi:
e0a9456a 918pdf:
ac84c172 919install-pdf:
e0a9456a 920
fa958513
DJ
921# Install rules. These do not depend on "all", so that they can be invoked
922# recursively from it.
923install-libunwind:
924 $(mkinstalldirs) $(DESTDIR)$(inst_slibdir)
925
926 # NOTE: Maybe this should go into $(inst_libdir), but this
927 # is where the old mklibgcc.in put it.
928 $(INSTALL_DATA) libunwind.a $(DESTDIR)$(inst_slibdir)/
929 chmod 644 $(DESTDIR)$(inst_slibdir)/libunwind.a
930 $(RANLIB) $(DESTDIR)$(inst_slibdir)/libunwind.a
931
932 $(subst @multilib_dir@,$(MULTIDIR),$(subst \
933 @shlib_base_name@,libunwind,$(subst \
934 @shlib_slibdir_qual@,$(MULTIOSSUBDIR),$(SHLIBUNWIND_INSTALL))))
935
936install-shared:
937 $(mkinstalldirs) $(DESTDIR)$(inst_libdir)
938
939 $(INSTALL_DATA) libgcc_eh.a $(DESTDIR)$(inst_libdir)/
940 chmod 644 $(DESTDIR)$(inst_libdir)/libgcc_eh.a
941 $(RANLIB) $(DESTDIR)$(inst_libdir)/libgcc_eh.a
942
943 $(subst @multilib_dir@,$(MULTIDIR),$(subst \
944 @shlib_base_name@,libgcc_s,$(subst \
945 @shlib_slibdir_qual@,$(MULTIOSSUBDIR),$(SHLIB_INSTALL))))
946
edbf8b16 947install-leaf: $(install-shared) $(install-libunwind)
fa958513
DJ
948 $(mkinstalldirs) $(DESTDIR)$(inst_libdir)
949
950 $(INSTALL_DATA) libgcc.a $(DESTDIR)$(inst_libdir)/
951 chmod 644 $(DESTDIR)$(inst_libdir)/libgcc.a
952 $(RANLIB) $(DESTDIR)$(inst_libdir)/libgcc.a
953 $(INSTALL_DATA) libgcov.a $(DESTDIR)$(inst_libdir)/
954 chmod 644 $(DESTDIR)$(inst_libdir)/libgcov.a
955 $(RANLIB) $(DESTDIR)$(inst_libdir)/libgcov.a
956
957 parts="$(INSTALL_PARTS)"; \
958 for file in $$parts; do \
959 rm -f $(DESTDIR)$(inst_libdir)/$$file; \
960 $(INSTALL_DATA) $$file $(DESTDIR)$(inst_libdir)/; \
961 done
962
edbf8b16 963install: install-leaf
ef74edbd 964 @: $(MAKE) ; $(MULTIDO) $(FLAGS_TO_PASS) multi-do DO=install
97af925b 965
fa958513
DJ
966.PHONY: install install-shared install-libunwind
967
968# Don't export variables to the environment, in order to not confuse
969# configure.
970.NOEXPORT:
971
972include $(srcdir)/empty.mk $(wildcard *.dep)
973
974# TODO QUEUE:
975# Garbage collect in gcc/:
976# $(LIBGCC) settings in t-* are now unused
977#
978# Remove use of $(gcc_srcdir). Source files referenced using $(gcc_srcdir)
979# should move into the libgcc directory.
980