re PR target/33635 (Bootstrap broken on mips-sgi-irix6.5)
[official-gcc.git] / libgcc / Makefile.in
blob60feaff768e68e5c6c762a345660ba900119ba3a
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@
36 SHELL = @SHELL@
38 enable_shared = @enable_shared@
39 decimal_float = @decimal_float@
40 enable_decimal_float = @enable_decimal_float@
41 fixed_point = @fixed_point@
43 host_noncanonical = @host_noncanonical@
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.
47 EXTRA_PARTS = @extra_parts@
49 # Multilib support variables.
50 MULTISRCTOP =
51 MULTIBUILDTOP =
52 MULTIDIRS =
53 MULTISUBDIR =
54 MULTIDO = true
55 MULTICLEAN = true
57 INSTALL = @INSTALL@
58 INSTALL_PROGRAM = @INSTALL_PROGRAM@
59 INSTALL_DATA = @INSTALL_DATA@
60 mkinstalldirs = $(SHELL) $(libgcc_topdir)/mkinstalldirs
62 objext = .o
64 AR = @AR@
65 AR_FLAGS = rc
67 CC = @CC@
68 CFLAGS = @CFLAGS@
69 RANLIB = @RANLIB@
70 LN_S = @LN_S@
72 PWD_COMMAND = $${PWDCMD-pwd}
74 # Flags to pass to a recursive make.
75 FLAGS_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)"
96 # Dependencies for "all" are set later in the file.
97 all: 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.
102 $(MAKE) install DESTDIR=$(gcc_objdir) \
103 slibdir= libsubdir= MULTIOSDIR=$(MULTIDIR)
105 .PHONY: all-multi
106 all-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
111 .PHONY: check installcheck
112 check:
113 installcheck:
115 .PHONY: all clean
117 clean:
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
125 distclean: clean
126 @$(MULTICLEAN) multi-clean DO=distclean
127 -rm -f *~ Makefile config.cache config.status multilib.out
128 -rm -f config.log
129 maintainer-clean realclean: distclean
131 Makefile: $(srcdir)/Makefile.in config.status
132 CONFIG_FILES=Makefile CONFIG_HEADERS= $(SHELL) ./config.status
134 # Depending on Makefile makes sure that config.status has been re-run
135 # if needed. This prevents problems with parallel builds.
136 config.h: stamp-h ; @true
137 stamp-h: $(srcdir)/config.in config.status Makefile
138 CONFIG_FILES= CONFIG_HEADERS=config.h:$(srcdir)/config.in $(SHELL) ./config.status
140 config.status: $(srcdir)/configure
141 $(SHELL) ./config.status --recheck
143 include $(gcc_objdir)/libgcc.mvars
145 # Flags to pass to recursive makes.
147 AR_FOR_TARGET = $(AR)
148 AR_FLAGS_FOR_TARGET =
149 AR_CREATE_FOR_TARGET = $(AR_FOR_TARGET) $(AR_FLAGS_FOR_TARGET) rc
150 AR_EXTRACT_FOR_TARGET = $(AR_FOR_TARGET) $(AR_FLAGS_FOR_TARGET) x
151 AWK = @AWK@
152 GCC_FOR_TARGET = $(CC)
153 LIPO = @LIPO@
154 LIPO_FOR_TARGET = $(LIPO)
155 MACHMODE_H = machmode.h mode-classes.def insn-modes.h
156 NM = @NM@
157 NM_FOR_TARGET = $(NM)
158 RANLIB_FOR_TARGET = $(RANLIB)
159 STRIP = @STRIP@
160 STRIP_FOR_TARGET = $(STRIP)
162 # Directory in which the compiler finds libraries etc.
163 libsubdir = $(libdir)/gcc/$(host_noncanonical)/$(version)
164 # Used to install the shared libgcc.
165 slibdir = @slibdir@
167 export AR_FOR_TARGET
168 export AR_CREATE_FOR_TARGET
169 export AR_FLAGS_FOR_TARGET
170 export AR_EXTRACT_FOR_TARGET
171 export AWK
172 export DESTDIR
173 export GCC_FOR_TARGET
174 export INCLUDES
175 export INSTALL_DATA
176 export LIB1ASMSRC
177 export LIBGCC2_CFLAGS
178 export LIPO_FOR_TARGET
179 export MACHMODE_H
180 export NM_FOR_TARGET
181 export STRIP_FOR_TARGET
182 export RANLIB_FOR_TARGET
183 export libsubdir
184 export slibdir
186 version := $(shell $(CC) -dumpversion)
188 ifeq ($(decimal_float),yes)
189 ifeq ($(enable_decimal_float),bid)
190 DECNUMINC = -I$(srcdir)/config/libbid -DENABLE_DECIMAL_BID_FORMAT
191 else
192 DECNUMINC = -I$(srcdir)/../libdecnumber/$(enable_decimal_float) \
193 -I$(srcdir)/../libdecnumber \
194 -I$(MULTIBUILDTOP)../../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 # Build fixed-point support.
581 ifeq ($(fixed_point),yes)
583 # Generate permutations of function name and mode
584 fixed-labels := $(shell $(SHELL) $(srcdir)/gen-fixed.sh arith labels)
585 fixed-funcs := $(shell $(SHELL) $(srcdir)/gen-fixed.sh arith funcs)
586 fixed-modes := $(shell $(SHELL) $(srcdir)/gen-fixed.sh arith modes)
588 # Generate the rules for each arithmetic function
589 iter-items := $(fixed-funcs)
590 iter-labels := $(fixed-labels)
591 iter-from := $(fixed-modes)
592 iter-to := $(fixed-modes)
593 include $(srcdir)/empty.mk $(patsubst %,$(srcdir)/fixed-obj.mk,$(iter-items))
595 # Add arithmetic functions to list of objects to be built
596 libgcc-objects += $(patsubst %,%$(objext),$(fixed-funcs))
597 ifeq ($(enable_shared),yes)
598 libgcc-s-objects += $(patsubst %,%_s$(objext),$(fixed-funcs))
599 endif
601 # Convert from or to fractional
602 fixed-conv-funcs := $(shell $(SHELL) $(srcdir)/gen-fixed.sh conv funcs)
603 fixed-conv-labels := $(shell $(SHELL) $(srcdir)/gen-fixed.sh conv labels)
604 fixed-conv-from := $(shell $(SHELL) $(srcdir)/gen-fixed.sh conv from)
605 fixed-conv-to := $(shell $(SHELL) $(srcdir)/gen-fixed.sh conv to)
607 # Generate the make rules for each conversion function
608 iter-items := $(fixed-conv-funcs)
609 iter-labels := $(fixed-conv-labels)
610 iter-from := $(fixed-conv-from)
611 iter-to := $(fixed-conv-to)
612 include $(srcdir)/empty.mk $(patsubst %,$(srcdir)/fixed-obj.mk,$(iter-items))
614 # Add conversion functions to list of objects to be built
615 libgcc-objects += $(patsubst %,%$(objext),$(fixed-conv-funcs))
616 ifeq ($(enable_shared),yes)
617 libgcc-s-objects += $(patsubst %,%_s$(objext),$(fixed-conv-funcs))
618 endif
620 endif
622 # Build LIB2ADD and LIB2ADD_ST.
623 ifneq ($(filter-out %.c %.S %.asm,$(LIB2ADD) $(LIB2ADD_ST)),)
624 $(error Unsupported files in LIB2ADD or LIB2ADD_ST.)
625 endif
627 libgcc-objects += $(addsuffix $(objext),$(basename $(notdir $(LIB2ADD))))
628 libgcc-objects += $(addsuffix $(objext),$(basename $(notdir $(LIB2ADD_ST))))
630 c_flags :=
631 iter-items := $(LIB2ADD) $(LIB2ADD_ST)
632 include $(iterator)
634 ifeq ($(enable_shared),yes)
635 libgcc-s-objects += $(addsuffix _s$(objext),$(basename $(notdir $(LIB2ADD))))
636 endif
638 # Build LIB2ADDEH, LIB2ADDEHSTATIC, and LIB2ADDEHSHARED. If we don't have
639 # libgcc_eh.a, only LIB2ADDEH matters. If we do, only LIB2ADDEHSTATIC and
640 # LIB2ADDEHSHARED matter. (Usually all three are identical.)
642 c_flags := -fexceptions
644 ifeq ($(enable_shared),yes)
646 libgcc-eh-objects += $(addsuffix $(objext),$(basename $(notdir $(LIB2ADDEHSTATIC))))
647 libgcc-s-objects += $(addsuffix _s$(objext),$(basename $(notdir $(LIB2ADDEHSHARED))))
649 iter-items := $(sort $(LIB2ADDEHSTATIC) $(LIB2ADDEHSHARED))
650 include $(iterator)
652 else
653 # Not shared. LIB2ADDEH are added to libgcc.a.
655 libgcc-objects += $(addsuffix $(objext),$(basename $(notdir $(LIB2ADDEH))))
657 iter-items := $(LIB2ADDEH)
658 include $(iterator)
660 endif
662 # Build LIBUNWIND.
664 c_flags := -fexceptions
666 libunwind-objects += $(addsuffix $(objext),$(basename $(notdir $(LIBUNWIND))))
668 ifeq ($(enable_shared),yes)
669 libunwind-s-objects += $(addsuffix _s$(objext),$(basename $(notdir $(LIBUNWIND))))
670 endif
672 iter-items := $(LIBUNWIND)
673 include $(iterator)
675 # Build libgcov components.
676 libgcov-objects = $(patsubst %,%$(objext),$(LIBGCOV))
677 $(libgcov-objects): %$(objext): $(gcc_srcdir)/libgcov.c
678 $(gcc_compile) -DL$* -c $(gcc_srcdir)/libgcov.c
681 # Static libraries.
682 libgcc.a: $(libgcc-objects)
683 libgcov.a: $(libgcov-objects)
684 libunwind.a: $(libunwind-objects)
685 libgcc_eh.a: $(libgcc-eh-objects)
687 libgcc.a libgcov.a libunwind.a libgcc_eh.a:
688 -rm -f $@
690 objects="$(objects)"; \
691 if test -z "$$objects"; then \
692 echo 'int __libgcc_eh_dummy;' > eh_dummy.c; \
693 $(gcc_compile_bare) $(vis_hide) -c eh_dummy.c \
694 -o eh_dummy$(objext); \
695 objects=eh_dummy$(objext); \
696 fi; \
697 $(AR_CREATE_FOR_TARGET) $@ $$objects
699 $(RANLIB) $@
701 all: libgcc.a libgcov.a
703 ifneq ($(LIBUNWIND),)
704 all: libunwind.a
705 libgcc_s$(SHLIB_EXT): libunwind$(SHLIB_EXT)
706 endif
708 ifeq ($(enable_shared),yes)
709 all: libgcc_eh.a libgcc_s$(SHLIB_EXT)
710 ifneq ($(LIBUNWIND),)
711 all: libunwind$(SHLIB_EXT)
712 endif
713 endif
715 ifeq ($(enable_shared),yes)
717 # Map-file generation.
718 ifneq ($(SHLIB_MKMAP),)
719 libgcc.map: $(SHLIB_MKMAP) $(SHLIB_MAPFILES) $(libgcc-s-objects)
720 { $(NM) $(SHLIB_NM_FLAGS) $(libgcc-s-objects); echo %%; \
721 cat $(SHLIB_MAPFILES) \
722 | sed -e '/^[ ]*#/d' \
723 -e 's/^%\(if\|else\|elif\|endif\|define\)/#\1/' \
724 | $(gcc_compile_bare) -E -xassembler-with-cpp -; \
725 } | $(AWK) -f $(SHLIB_MKMAP) $(SHLIB_MKMAP_OPTS) > tmp-$@
726 mv tmp-$@ $@
727 libgcc_s$(SHLIB_EXT): libgcc.map
728 mapfile = libgcc.map
729 endif
731 libgcc_s$(SHLIB_EXT): $(libgcc-s-objects) $(extra-parts)
732 # @multilib_flags@ is still needed because this may use
733 # $(GCC_FOR_TARGET) and $(LIBGCC2_CFLAGS) directly.
734 # @multilib_dir@ is not really necessary, but sometimes it has
735 # more uses than just a directory name.
736 $(mkinstalldirs) $(MULTIDIR)
737 $(subst @multilib_flags@,$(CFLAGS) -B./,$(subst \
738 @multilib_dir@,$(MULTIDIR),$(subst \
739 @shlib_objs@,$(objects),$(subst \
740 @shlib_base_name@,libgcc_s,$(subst \
741 @shlib_map_file@,$(mapfile),$(subst \
742 @shlib_slibdir_qual@,$(MULTIOSSUBDIR),$(SHLIB_LINK)))))))
744 libunwind$(SHLIB_EXT): $(libunwind-s-objects) $(extra-parts)
745 # @multilib_flags@ is still needed because this may use
746 # $(GCC_FOR_TARGET) and $(LIBGCC2_CFLAGS) directly.
747 # @multilib_dir@ is not really necessary, but sometimes it has
748 # more uses than just a directory name.
749 $(mkinstalldirs) $(MULTIDIR)
750 $(subst @multilib_flags@,$(CFLAGS) -B./,$(subst \
751 @multilib_dir@,$(MULTIDIR),$(subst \
752 @shlib_objs@,$(objects),$(subst \
753 @shlib_base_name@,libunwind,$(subst \
754 @shlib_slibdir_qual@,$(MULTIOSSUBDIR),$(SHLIBUNWIND_LINK))))))
756 endif
758 # Build the standard GCC startfiles and endfiles.
759 ALL_CRT_CFLAGS = $(CFLAGS) $(CRTSTUFF_CFLAGS) $(INCLUDES)
760 crt_compile = $(CC) $(ALL_CRT_CFLAGS) -o $@ $(compile_deps)
762 ifeq ($(CUSTOM_CRTSTUFF),)
763 crtbegin$(objext): $(gcc_srcdir)/crtstuff.c
764 $(crt_compile) $(CRTSTUFF_T_CFLAGS) \
765 -c $(gcc_srcdir)/crtstuff.c -DCRT_BEGIN
767 crtend$(objext): $(gcc_srcdir)/crtstuff.c
768 $(crt_compile) $(CRTSTUFF_T_CFLAGS) \
769 -c $(gcc_srcdir)/crtstuff.c -DCRT_END
771 # These are versions of crtbegin and crtend for shared libraries.
772 crtbeginS$(objext): $(gcc_srcdir)/crtstuff.c
773 $(crt_compile) $(CRTSTUFF_T_CFLAGS_S) \
774 -c $(gcc_srcdir)/crtstuff.c -DCRT_BEGIN -DCRTSTUFFS_O
776 crtendS$(objext): $(gcc_srcdir)/crtstuff.c
777 $(crt_compile) $(CRTSTUFF_T_CFLAGS_S) \
778 -c $(gcc_srcdir)/crtstuff.c -DCRT_END -DCRTSTUFFS_O
780 # This is a version of crtbegin for -static links.
781 crtbeginT.o: $(gcc_srcdir)/crtstuff.c
782 $(crt_compile) $(CRTSTUFF_T_CFLAGS) \
783 -c $(gcc_srcdir)/crtstuff.c -DCRT_BEGIN -DCRTSTUFFT_O
784 endif
786 # Build extra startfiles in the libgcc directory.
787 .PHONY: libgcc-extra-parts
788 libgcc-extra-parts: $(EXTRA_PARTS)
789 ifneq ($(GCC_EXTRA_PARTS),)
790 ifneq ($(sort $(EXTRA_PARTS)),$(GCC_EXTRA_PARTS))
791 # If the gcc directory specifies which extra parts to
792 # build for this target, and the libgcc configuration also
793 # specifies, make sure they match. This can be removed
794 # when the gcc directory no longer holds libgcc configuration;
795 # it is useful when migrating a target.
796 @echo "Configuration mismatch!"
797 @echo "Extra parts from gcc directory: $(GCC_EXTRA_PARTS)"
798 @echo "Extra parts from libgcc: $(EXTRA_PARTS)"
799 exit 1
800 endif
801 endif
803 # Early copyback; see "all" above for the rationale. The
804 # early copy is necessary so that the gcc -B options find
805 # the right startup files when linking shared libgcc.
806 $(mkinstalldirs) $(gcc_objdir)$(MULTISUBDIR)
807 parts="$(EXTRA_PARTS)"; \
808 for file in $$parts; do \
809 rm -f $(gcc_objdir)$(MULTISUBDIR)/$$file; \
810 $(INSTALL_DATA) $$file $(gcc_objdir)$(MULTISUBDIR)/; \
811 done
813 # Build extra startfiles in the gcc directory, for unconverted
814 # targets.
815 .PHONY: gcc-extra-parts
816 gcc-extra-parts:
817 # Recursively invoke make in the GCC directory to build any
818 # startfiles (for now). We must do this just once, passing
819 # it all the GCC_EXTRA_PARTS as simultaneous goal targets,
820 # so that rules which cannot execute simultaneously are properly
821 # serialized. We indirect through T_TARGET in case any multilib
822 # directories contain an equals sign, to prevent make from
823 # interpreting any of the goals as variable assignments.
825 # We must use cd && make rather than make -C, or else the stage
826 # number will be embedded in debug information.
828 T=`$(PWD_COMMAND)`/ \
829 && cd $(gcc_objdir) \
830 && $(MAKE) GCC_FOR_TARGET="$(CC)" \
831 MULTILIB_CFLAGS="$(CFLAGS)" \
832 T=$$T \
833 T_TARGET="$(patsubst %,$${T}%,$(GCC_EXTRA_PARTS))" \
834 T_TARGET
836 # Early copyback; see "all" above for the rationale. The
837 # early copy is necessary so that the gcc -B options find
838 # the right startup files when linking shared libgcc.
839 $(mkinstalldirs) $(gcc_objdir)$(MULTISUBDIR)
840 parts="$(GCC_EXTRA_PARTS)"; \
841 for file in $$parts; do \
842 rm -f $(gcc_objdir)$(MULTISUBDIR)/$$file; \
843 $(INSTALL_DATA) $$file $(gcc_objdir)$(MULTISUBDIR)/; \
844 done
846 all: $(extra-parts)
848 # Documentation targets (empty).
849 .PHONY: info html dvi pdf install-info install-html install-pdf
851 info:
852 install-info:
853 html:
854 install-html:
855 dvi:
856 pdf:
857 install-pdf:
859 # Install rules. These do not depend on "all", so that they can be invoked
860 # recursively from it.
861 install-libunwind:
862 $(mkinstalldirs) $(DESTDIR)$(inst_slibdir)
864 # NOTE: Maybe this should go into $(inst_libdir), but this
865 # is where the old mklibgcc.in put it.
866 $(INSTALL_DATA) libunwind.a $(DESTDIR)$(inst_slibdir)/
867 chmod 644 $(DESTDIR)$(inst_slibdir)/libunwind.a
868 $(RANLIB) $(DESTDIR)$(inst_slibdir)/libunwind.a
870 $(subst @multilib_dir@,$(MULTIDIR),$(subst \
871 @shlib_base_name@,libunwind,$(subst \
872 @shlib_slibdir_qual@,$(MULTIOSSUBDIR),$(SHLIBUNWIND_INSTALL))))
874 install-shared:
875 $(mkinstalldirs) $(DESTDIR)$(inst_libdir)
877 $(INSTALL_DATA) libgcc_eh.a $(DESTDIR)$(inst_libdir)/
878 chmod 644 $(DESTDIR)$(inst_libdir)/libgcc_eh.a
879 $(RANLIB) $(DESTDIR)$(inst_libdir)/libgcc_eh.a
881 $(subst @multilib_dir@,$(MULTIDIR),$(subst \
882 @shlib_base_name@,libgcc_s,$(subst \
883 @shlib_slibdir_qual@,$(MULTIOSSUBDIR),$(SHLIB_INSTALL))))
885 install: $(install-shared) $(install-libunwind)
886 $(mkinstalldirs) $(DESTDIR)$(inst_libdir)
888 $(INSTALL_DATA) libgcc.a $(DESTDIR)$(inst_libdir)/
889 chmod 644 $(DESTDIR)$(inst_libdir)/libgcc.a
890 $(RANLIB) $(DESTDIR)$(inst_libdir)/libgcc.a
891 $(INSTALL_DATA) libgcov.a $(DESTDIR)$(inst_libdir)/
892 chmod 644 $(DESTDIR)$(inst_libdir)/libgcov.a
893 $(RANLIB) $(DESTDIR)$(inst_libdir)/libgcov.a
895 parts="$(INSTALL_PARTS)"; \
896 for file in $$parts; do \
897 rm -f $(DESTDIR)$(inst_libdir)/$$file; \
898 $(INSTALL_DATA) $$file $(DESTDIR)$(inst_libdir)/; \
899 done
901 @$(MULTIDO) $(FLAGS_TO_PASS) multi-do DO=install
903 .PHONY: install install-shared install-libunwind
905 # Don't export variables to the environment, in order to not confuse
906 # configure.
907 .NOEXPORT:
909 include $(srcdir)/empty.mk $(wildcard *.dep)
911 # TODO QUEUE:
912 # Garbage collect in gcc/:
913 # $(LIBGCC) settings in t-* are now unused
915 # Remove use of $(gcc_srcdir). Source files referenced using $(gcc_srcdir)
916 # should move into the libgcc directory.