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