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