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