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