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