df-scan.c (df_notes_rescan): Do nothing if the instruction does not yet have a basic...
[official-gcc.git] / libgcc / Makefile.in
blob77c5f1ebed8a73538375f4c98f097b7e5565913c
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 += decimal_globals decimal_data binarydecimal \
482 _isinfd32 _isinfd64 _isinfd128 bid64_noncomp bid128_noncomp \
483 bid128_fma bid_round bid_from_int convert_data \
484 bid64_add bid128_add bid64_div bid128_div \
485 bid64_mul bid128_mul bid64_compare bid128_compare \
486 bid128 bid32_to_bid64 bid32_to_bid128 bid64_to_bid128 \
487 bid64_to_int32 bid64_to_int64 \
488 bid64_to_uint32 bid64_to_uint64 \
489 bid128_to_int32 bid128_to_int64 \
490 bid128_to_uint32 bid128_to_uint64
491 else
492 dfp-filenames += decContext decNumber decExcept decRound decLibrary decDouble decPacked decQuad decSingle
493 endif
494 endif
496 dfp-objects = $(patsubst %,%$(objext),$(dfp-filenames))
497 ifeq ($(enable_decimal_float),bid)
498 $(dfp-objects): %$(objext): $(srcdir)/config/libbid/%.c
499 else
500 $(dfp-objects): %$(objext): $(srcdir)/../libdecnumber/%.c
501 endif
502 $(gcc_compile) -c $<
503 libgcc-objects += $(dfp-objects)
505 decbits-filenames =
506 ifneq ($(enable_decimal_float),bid)
507 ifneq ($(D32PBIT),)
508 decbits-filenames += decimal32
509 endif
511 ifneq ($(D64PBIT),)
512 decbits-filenames += decimal64
513 endif
515 ifneq ($(D128PBIT),)
516 decbits-filenames += decimal128
517 endif
518 endif
520 decbits-objects = $(patsubst %,%$(objext),$(decbits-filenames))
521 ifeq ($(enable_decimal_float),bid)
522 $(decbits-objects): %$(objext): $(srcdir)/config/libbid/%.c
523 else
524 $(decbits-objects): %$(objext): $(srcdir)/../libdecnumber/$(enable_decimal_float)/%.c
525 endif
526 $(gcc_compile) -c $<
527 libgcc-objects += $(decbits-objects)
529 # Next build individual support functions.
530 ifeq ($(enable_decimal_float),bid)
531 ifneq ($(D32PBIT),)
532 D32PBIT_FUNCS:=$(filter-out _plus_sd _minus_sd _conv_sd, $(D32PBIT_FUNCS))
533 endif
535 ifneq ($(D64PBIT),)
536 D64PBIT_FUNCS:=$(filter-out _plus_dd _minus_dd _conv_dd, $(D64PBIT_FUNCS))
537 endif
539 ifneq ($(D128PBIT),)
540 D128PBIT_FUNCS:=$(filter-out _plus_td _minus_td _conv_td, $(D128PBIT_FUNCS))
541 endif
542 endif
544 ifneq ($(D32PBIT),)
545 d32pbit-o = $(patsubst %,%$(objext),$(D32PBIT_FUNCS))
546 ifeq ($(enable_decimal_float),bid)
547 $(d32pbit-o): %$(objext): $(srcdir)/config/libbid/%.c
548 else
549 $(d32pbit-o): %$(objext): $(gcc_srcdir)/config/dfp-bit.c
550 endif
551 $(gcc_compile) -DFINE_GRAINED_LIBRARIES -DL$* -DWIDTH=32 -c $<
552 libgcc-objects += $(d32pbit-o)
553 endif
555 ifneq ($(D64PBIT),)
556 d64pbit-o = $(patsubst %,%$(objext),$(D64PBIT_FUNCS))
557 ifeq ($(enable_decimal_float),bid)
558 $(d64pbit-o): %$(objext): $(srcdir)/config/libbid/%.c
559 else
560 $(d64pbit-o): %$(objext): $(gcc_srcdir)/config/dfp-bit.c
561 endif
562 $(gcc_compile) -DFINE_GRAINED_LIBRARIES -DL$* -DWIDTH=64 -c $<
563 libgcc-objects += $(d64pbit-o)
564 endif
566 ifneq ($(D128PBIT),)
567 d128pbit-o = $(patsubst %,%$(objext),$(D128PBIT_FUNCS))
568 ifeq ($(enable_decimal_float),bid)
569 $(d128pbit-o): %$(objext): $(srcdir)/config/libbid/%.c
570 else
571 $(d128pbit-o): %$(objext): $(gcc_srcdir)/config/dfp-bit.c
572 endif
573 $(gcc_compile) -DFINE_GRAINED_LIBRARIES -DL$* -DWIDTH=128 -c $<
574 libgcc-objects += $(d128pbit-o)
575 endif
577 endif
579 # Build fixed-point support.
580 ifeq ($(fixed_point),yes)
582 # Generate permutations of function name and mode
583 fixed-labels := $(shell $(SHELL) $(srcdir)/gen-fixed.sh arith labels)
584 fixed-funcs := $(shell $(SHELL) $(srcdir)/gen-fixed.sh arith funcs)
585 fixed-modes := $(shell $(SHELL) $(srcdir)/gen-fixed.sh arith modes)
587 # Generate the rules for each arithmetic function
588 iter-items := $(fixed-funcs)
589 iter-labels := $(fixed-labels)
590 iter-from := $(fixed-modes)
591 iter-to := $(fixed-modes)
592 include $(srcdir)/empty.mk $(patsubst %,$(srcdir)/fixed-obj.mk,$(iter-items))
594 # Add arithmetic functions to list of objects to be built
595 libgcc-objects += $(patsubst %,%$(objext),$(fixed-funcs))
596 ifeq ($(enable_shared),yes)
597 libgcc-s-objects += $(patsubst %,%_s$(objext),$(fixed-funcs))
598 endif
600 # Convert from or to fractional
601 fixed-conv-funcs := $(shell $(SHELL) $(srcdir)/gen-fixed.sh conv funcs)
602 fixed-conv-labels := $(shell $(SHELL) $(srcdir)/gen-fixed.sh conv labels)
603 fixed-conv-from := $(shell $(SHELL) $(srcdir)/gen-fixed.sh conv from)
604 fixed-conv-to := $(shell $(SHELL) $(srcdir)/gen-fixed.sh conv to)
606 # Generate the make rules for each conversion function
607 iter-items := $(fixed-conv-funcs)
608 iter-labels := $(fixed-conv-labels)
609 iter-from := $(fixed-conv-from)
610 iter-to := $(fixed-conv-to)
611 include $(srcdir)/empty.mk $(patsubst %,$(srcdir)/fixed-obj.mk,$(iter-items))
613 # Add conversion functions to list of objects to be built
614 libgcc-objects += $(patsubst %,%$(objext),$(fixed-conv-funcs))
615 ifeq ($(enable_shared),yes)
616 libgcc-s-objects += $(patsubst %,%_s$(objext),$(fixed-conv-funcs))
617 endif
619 endif
621 # Build LIB2ADD and LIB2ADD_ST.
622 ifneq ($(filter-out %.c %.S %.asm,$(LIB2ADD) $(LIB2ADD_ST)),)
623 $(error Unsupported files in LIB2ADD or LIB2ADD_ST.)
624 endif
626 libgcc-objects += $(addsuffix $(objext),$(basename $(notdir $(LIB2ADD))))
627 libgcc-objects += $(addsuffix $(objext),$(basename $(notdir $(LIB2ADD_ST))))
629 c_flags :=
630 iter-items := $(LIB2ADD) $(LIB2ADD_ST)
631 include $(iterator)
633 ifeq ($(enable_shared),yes)
634 libgcc-s-objects += $(addsuffix _s$(objext),$(basename $(notdir $(LIB2ADD))))
635 endif
637 # Build LIB2ADDEH, LIB2ADDEHSTATIC, and LIB2ADDEHSHARED. If we don't have
638 # libgcc_eh.a, only LIB2ADDEH matters. If we do, only LIB2ADDEHSTATIC and
639 # LIB2ADDEHSHARED matter. (Usually all three are identical.)
641 c_flags := -fexceptions
643 ifeq ($(enable_shared),yes)
645 libgcc-eh-objects += $(addsuffix $(objext),$(basename $(notdir $(LIB2ADDEHSTATIC))))
646 libgcc-s-objects += $(addsuffix _s$(objext),$(basename $(notdir $(LIB2ADDEHSHARED))))
648 iter-items := $(sort $(LIB2ADDEHSTATIC) $(LIB2ADDEHSHARED))
649 include $(iterator)
651 else
652 # Not shared. LIB2ADDEH are added to libgcc.a.
654 libgcc-objects += $(addsuffix $(objext),$(basename $(notdir $(LIB2ADDEH))))
656 iter-items := $(LIB2ADDEH)
657 include $(iterator)
659 endif
661 # Build LIBUNWIND.
663 c_flags := -fexceptions
665 libunwind-objects += $(addsuffix $(objext),$(basename $(notdir $(LIBUNWIND))))
667 ifeq ($(enable_shared),yes)
668 libunwind-s-objects += $(addsuffix _s$(objext),$(basename $(notdir $(LIBUNWIND))))
669 endif
671 iter-items := $(LIBUNWIND)
672 include $(iterator)
674 # Build libgcov components.
675 libgcov-objects = $(patsubst %,%$(objext),$(LIBGCOV))
676 $(libgcov-objects): %$(objext): $(gcc_srcdir)/libgcov.c
677 $(gcc_compile) -DL$* -c $(gcc_srcdir)/libgcov.c
680 # Static libraries.
681 libgcc.a: $(libgcc-objects)
682 libgcov.a: $(libgcov-objects)
683 libunwind.a: $(libunwind-objects)
684 libgcc_eh.a: $(libgcc-eh-objects)
686 libgcc.a libgcov.a libunwind.a libgcc_eh.a:
687 -rm -f $@
689 objects="$(objects)"; \
690 if test -z "$$objects"; then \
691 echo 'int __libgcc_eh_dummy;' > eh_dummy.c; \
692 $(gcc_compile_bare) $(vis_hide) -c eh_dummy.c \
693 -o eh_dummy$(objext); \
694 objects=eh_dummy$(objext); \
695 fi; \
696 $(AR_CREATE_FOR_TARGET) $@ $$objects
698 $(RANLIB) $@
700 all: libgcc.a libgcov.a
702 ifneq ($(LIBUNWIND),)
703 all: libunwind.a
704 libgcc_s$(SHLIB_EXT): libunwind$(SHLIB_EXT)
705 endif
707 ifeq ($(enable_shared),yes)
708 all: libgcc_eh.a libgcc_s$(SHLIB_EXT)
709 ifneq ($(LIBUNWIND),)
710 all: libunwind$(SHLIB_EXT)
711 endif
712 endif
714 ifeq ($(enable_shared),yes)
716 # Map-file generation.
717 ifneq ($(SHLIB_MKMAP),)
718 libgcc.map: $(SHLIB_MKMAP) $(SHLIB_MAPFILES) $(libgcc-s-objects)
719 { $(NM) $(SHLIB_NM_FLAGS) $(libgcc-s-objects); echo %%; \
720 cat $(SHLIB_MAPFILES) \
721 | sed -e '/^[ ]*#/d' \
722 -e 's/^%\(if\|else\|elif\|endif\|define\)/#\1/' \
723 | $(gcc_compile_bare) -E -xassembler-with-cpp -; \
724 } | $(AWK) -f $(SHLIB_MKMAP) $(SHLIB_MKMAP_OPTS) > tmp-$@
725 mv tmp-$@ $@
726 libgcc_s$(SHLIB_EXT): libgcc.map
727 mapfile = libgcc.map
728 endif
730 libgcc_s$(SHLIB_EXT): $(libgcc-s-objects) $(extra-parts)
731 # @multilib_flags@ is still needed because this may use
732 # $(GCC_FOR_TARGET) and $(LIBGCC2_CFLAGS) directly.
733 # @multilib_dir@ is not really necessary, but sometimes it has
734 # more uses than just a directory name.
735 $(mkinstalldirs) $(MULTIDIR)
736 $(subst @multilib_flags@,$(CFLAGS) -B./,$(subst \
737 @multilib_dir@,$(MULTIDIR),$(subst \
738 @shlib_objs@,$(objects),$(subst \
739 @shlib_base_name@,libgcc_s,$(subst \
740 @shlib_map_file@,$(mapfile),$(subst \
741 @shlib_slibdir_qual@,$(MULTIOSSUBDIR),$(SHLIB_LINK)))))))
743 libunwind$(SHLIB_EXT): $(libunwind-s-objects) $(extra-parts)
744 # @multilib_flags@ is still needed because this may use
745 # $(GCC_FOR_TARGET) and $(LIBGCC2_CFLAGS) directly.
746 # @multilib_dir@ is not really necessary, but sometimes it has
747 # more uses than just a directory name.
748 $(mkinstalldirs) $(MULTIDIR)
749 $(subst @multilib_flags@,$(CFLAGS) -B./,$(subst \
750 @multilib_dir@,$(MULTIDIR),$(subst \
751 @shlib_objs@,$(objects),$(subst \
752 @shlib_base_name@,libunwind,$(subst \
753 @shlib_slibdir_qual@,$(MULTIOSSUBDIR),$(SHLIBUNWIND_LINK))))))
755 endif
757 # Build the standard GCC startfiles and endfiles.
758 ALL_CRT_CFLAGS = $(CFLAGS) $(CRTSTUFF_CFLAGS) $(INCLUDES)
759 crt_compile = $(CC) $(ALL_CRT_CFLAGS) -o $@ $(compile_deps)
761 ifeq ($(CUSTOM_CRTSTUFF),)
762 crtbegin$(objext): $(gcc_srcdir)/crtstuff.c
763 $(crt_compile) $(CRTSTUFF_T_CFLAGS) \
764 -c $(gcc_srcdir)/crtstuff.c -DCRT_BEGIN
766 crtend$(objext): $(gcc_srcdir)/crtstuff.c
767 $(crt_compile) $(CRTSTUFF_T_CFLAGS) \
768 -c $(gcc_srcdir)/crtstuff.c -DCRT_END
770 # These are versions of crtbegin and crtend for shared libraries.
771 crtbeginS$(objext): $(gcc_srcdir)/crtstuff.c
772 $(crt_compile) $(CRTSTUFF_T_CFLAGS_S) \
773 -c $(gcc_srcdir)/crtstuff.c -DCRT_BEGIN -DCRTSTUFFS_O
775 crtendS$(objext): $(gcc_srcdir)/crtstuff.c
776 $(crt_compile) $(CRTSTUFF_T_CFLAGS_S) \
777 -c $(gcc_srcdir)/crtstuff.c -DCRT_END -DCRTSTUFFS_O
779 # This is a version of crtbegin for -static links.
780 crtbeginT.o: $(gcc_srcdir)/crtstuff.c
781 $(crt_compile) $(CRTSTUFF_T_CFLAGS) \
782 -c $(gcc_srcdir)/crtstuff.c -DCRT_BEGIN -DCRTSTUFFT_O
783 endif
785 # Build extra startfiles in the libgcc directory.
786 .PHONY: libgcc-extra-parts
787 libgcc-extra-parts: $(EXTRA_PARTS)
788 ifneq ($(GCC_EXTRA_PARTS),)
789 ifneq ($(sort $(EXTRA_PARTS)),$(GCC_EXTRA_PARTS))
790 # If the gcc directory specifies which extra parts to
791 # build for this target, and the libgcc configuration also
792 # specifies, make sure they match. This can be removed
793 # when the gcc directory no longer holds libgcc configuration;
794 # it is useful when migrating a target.
795 @echo "Configuration mismatch!"
796 @echo "Extra parts from gcc directory: $(GCC_EXTRA_PARTS)"
797 @echo "Extra parts from libgcc: $(EXTRA_PARTS)"
798 exit 1
799 endif
800 endif
802 # Early copyback; see "all" above for the rationale. The
803 # early copy is necessary so that the gcc -B options find
804 # the right startup files when linking shared libgcc.
805 $(mkinstalldirs) $(gcc_objdir)$(MULTISUBDIR)
806 parts="$(EXTRA_PARTS)"; \
807 for file in $$parts; do \
808 rm -f $(gcc_objdir)$(MULTISUBDIR)/$$file; \
809 $(INSTALL_DATA) $$file $(gcc_objdir)$(MULTISUBDIR)/; \
810 done
812 # Build extra startfiles in the gcc directory, for unconverted
813 # targets.
814 .PHONY: gcc-extra-parts
815 gcc-extra-parts:
816 # Recursively invoke make in the GCC directory to build any
817 # startfiles (for now). We must do this just once, passing
818 # it all the GCC_EXTRA_PARTS as simultaneous goal targets,
819 # so that rules which cannot execute simultaneously are properly
820 # serialized. We indirect through T_TARGET in case any multilib
821 # directories contain an equals sign, to prevent make from
822 # interpreting any of the goals as variable assignments.
824 # We must use cd && make rather than make -C, or else the stage
825 # number will be embedded in debug information.
827 T=`$(PWD_COMMAND)`/ \
828 && cd $(gcc_objdir) \
829 && $(MAKE) GCC_FOR_TARGET="$(CC)" \
830 MULTILIB_CFLAGS="$(CFLAGS)" \
831 T=$$T \
832 T_TARGET="$(patsubst %,$${T}%,$(GCC_EXTRA_PARTS))" \
833 T_TARGET
835 # Early copyback; see "all" above for the rationale. The
836 # early copy is necessary so that the gcc -B options find
837 # the right startup files when linking shared libgcc.
838 $(mkinstalldirs) $(gcc_objdir)$(MULTISUBDIR)
839 parts="$(GCC_EXTRA_PARTS)"; \
840 for file in $$parts; do \
841 rm -f $(gcc_objdir)$(MULTISUBDIR)/$$file; \
842 $(INSTALL_DATA) $$file $(gcc_objdir)$(MULTISUBDIR)/; \
843 done
845 all: $(extra-parts)
847 # Documentation targets (empty).
848 .PHONY: info html dvi pdf install-info install-html install-pdf
850 info:
851 install-info:
852 html:
853 install-html:
854 dvi:
855 pdf:
856 install-pdf:
858 # Install rules. These do not depend on "all", so that they can be invoked
859 # recursively from it.
860 install-libunwind:
861 $(mkinstalldirs) $(DESTDIR)$(inst_slibdir)
863 # NOTE: Maybe this should go into $(inst_libdir), but this
864 # is where the old mklibgcc.in put it.
865 $(INSTALL_DATA) libunwind.a $(DESTDIR)$(inst_slibdir)/
866 chmod 644 $(DESTDIR)$(inst_slibdir)/libunwind.a
867 $(RANLIB) $(DESTDIR)$(inst_slibdir)/libunwind.a
869 $(subst @multilib_dir@,$(MULTIDIR),$(subst \
870 @shlib_base_name@,libunwind,$(subst \
871 @shlib_slibdir_qual@,$(MULTIOSSUBDIR),$(SHLIBUNWIND_INSTALL))))
873 install-shared:
874 $(mkinstalldirs) $(DESTDIR)$(inst_libdir)
876 $(INSTALL_DATA) libgcc_eh.a $(DESTDIR)$(inst_libdir)/
877 chmod 644 $(DESTDIR)$(inst_libdir)/libgcc_eh.a
878 $(RANLIB) $(DESTDIR)$(inst_libdir)/libgcc_eh.a
880 $(subst @multilib_dir@,$(MULTIDIR),$(subst \
881 @shlib_base_name@,libgcc_s,$(subst \
882 @shlib_slibdir_qual@,$(MULTIOSSUBDIR),$(SHLIB_INSTALL))))
884 install: $(install-shared) $(install-libunwind)
885 $(mkinstalldirs) $(DESTDIR)$(inst_libdir)
887 $(INSTALL_DATA) libgcc.a $(DESTDIR)$(inst_libdir)/
888 chmod 644 $(DESTDIR)$(inst_libdir)/libgcc.a
889 $(RANLIB) $(DESTDIR)$(inst_libdir)/libgcc.a
890 $(INSTALL_DATA) libgcov.a $(DESTDIR)$(inst_libdir)/
891 chmod 644 $(DESTDIR)$(inst_libdir)/libgcov.a
892 $(RANLIB) $(DESTDIR)$(inst_libdir)/libgcov.a
894 parts="$(INSTALL_PARTS)"; \
895 for file in $$parts; do \
896 rm -f $(DESTDIR)$(inst_libdir)/$$file; \
897 $(INSTALL_DATA) $$file $(DESTDIR)$(inst_libdir)/; \
898 done
900 @$(MULTIDO) $(FLAGS_TO_PASS) multi-do DO=install
902 .PHONY: install install-shared install-libunwind
904 # Don't export variables to the environment, in order to not confuse
905 # configure.
906 .NOEXPORT:
908 include $(srcdir)/empty.mk $(wildcard *.dep)
910 # TODO QUEUE:
911 # Garbage collect in gcc/:
912 # $(LIBGCC) settings in t-* are now unused
914 # Remove use of $(gcc_srcdir). Source files referenced using $(gcc_srcdir)
915 # should move into the libgcc directory.