Daily bump.
[official-gcc.git] / libgcc / Makefile.in
blobcbca5532f2e68574f04d1e25cd577b72a4760de4
1 # Makefile.in
3 # Copyright (C) 2005, 2006, 2009 Free Software Foundation
5 # This file is part of GCC.
7 # GCC is free software; you can redistribute it and/or modify it under the
8 # terms of the GNU Library General Public License as published by the Free
9 # Software Foundation; either version 3 of the License, or (at your option)
10 # any later version.
12 # GCC is distributed in the hope that it will be useful, but WITHOUT ANY
13 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
14 # FOR A PARTICULAR PURPOSE. See the GNU General Public License for
15 # more details.
17 # You should have received a copy of the GNU General Public License along
18 # with GCC; see the file COPYING3. If not see
19 # <http://www.gnu.org/licenses/>.
22 libgcc_topdir = @libgcc_topdir@
23 host_subdir = @host_subdir@
25 gcc_srcdir = $(libgcc_topdir)/gcc
26 gcc_objdir = $(MULTIBUILDTOP)../../$(host_subdir)/gcc
28 srcdir = @srcdir@
30 prefix = @prefix@
32 exec_prefix = @exec_prefix@
33 libdir = @libdir@
34 shlib_slibdir = @slibdir@
36 SHELL = @SHELL@
38 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-leaf 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 $(srcdir)/config.host
141 $(SHELL) ./config.status --recheck
143 AUTOCONF = autoconf
144 configure_deps = \
145 $(srcdir)/../config/enable.m4 \
146 $(srcdir)/../config/tls.m4 \
147 $(srcdir)/../config/acx.m4 \
148 $(srcdir)/../config/no-executables.m4 \
149 $(srcdir)/../config/override.m4 \
150 $(srcdir)/../config/dfp.m4 \
152 $(srcdir)/configure: @MAINT@ $(srcdir)/configure.ac $(configure_deps)
153 cd $(srcdir) && $(AUTOCONF)
155 include $(gcc_objdir)/libgcc.mvars
157 # Flags to pass to recursive makes.
159 AR_FOR_TARGET = $(AR)
160 AR_FLAGS_FOR_TARGET =
161 AR_CREATE_FOR_TARGET = $(AR_FOR_TARGET) $(AR_FLAGS_FOR_TARGET) rc
162 AR_EXTRACT_FOR_TARGET = $(AR_FOR_TARGET) $(AR_FLAGS_FOR_TARGET) x
163 AWK = @AWK@
164 GCC_FOR_TARGET = $(CC)
165 LIPO = @LIPO@
166 LIPO_FOR_TARGET = $(LIPO)
167 MACHMODE_H = machmode.h mode-classes.def insn-modes.h
168 NM = @NM@
169 NM_FOR_TARGET = $(NM)
170 RANLIB_FOR_TARGET = $(RANLIB)
171 STRIP = @STRIP@
172 STRIP_FOR_TARGET = $(STRIP)
174 # Directory in which the compiler finds libraries etc.
175 libsubdir = $(libdir)/gcc/$(host_noncanonical)/$(version)
176 # Used to install the shared libgcc.
177 slibdir = @slibdir@
179 export AR_FOR_TARGET
180 export AR_CREATE_FOR_TARGET
181 export AR_FLAGS_FOR_TARGET
182 export AR_EXTRACT_FOR_TARGET
183 export AWK
184 export DESTDIR
185 export GCC_FOR_TARGET
186 export INCLUDES
187 export INSTALL_DATA
188 export LIB1ASMSRC
189 export LIBGCC2_CFLAGS
190 export LIPO_FOR_TARGET
191 export MACHMODE_H
192 export NM_FOR_TARGET
193 export STRIP_FOR_TARGET
194 export RANLIB_FOR_TARGET
195 export libsubdir
196 export slibdir
198 version := $(shell $(CC) -dumpversion)
200 ifeq ($(decimal_float),yes)
201 ifeq ($(enable_decimal_float),bid)
202 DECNUMINC = -I$(srcdir)/config/libbid -DENABLE_DECIMAL_BID_FORMAT
203 else
204 DECNUMINC = -I$(srcdir)/../libdecnumber/$(enable_decimal_float) \
205 -I$(srcdir)/../libdecnumber
206 endif
207 else
208 DECNUMINC =
209 endif
211 # Specify the directories to be searched for header files.
212 # Both . and srcdir are used, in that order,
213 # so that *config.h will be found in the compilation
214 # subdirectory rather than in the source directory.
215 # -I$(@D) and -I$(srcdir)/$(@D) cause the subdirectory of the file
216 # currently being compiled, in both source trees, to be examined as well.
217 INCLUDES = -I. -I$(@D) -I$(gcc_objdir) \
218 -I$(srcdir) -I$(srcdir)/$(@D) -I$(srcdir)/../gcc \
219 -I$(srcdir)/../include $(DECNUMINC)
221 # Forcibly remove any profiling-related flags. There is no point
222 # in supporting profiled bootstrap in this library.
223 override CFLAGS := $(filter-out -fprofile-generate -fprofile-use,$(CFLAGS))
225 # CFLAGS first is not perfect; normally setting CFLAGS should override any
226 # options in LIBGCC2_CFLAGS. But LIBGCC2_CFLAGS may contain -g0, and CFLAGS
227 # will usually contain -g, so for the moment CFLAGS goes first. We must
228 # include CFLAGS - that's where multilib options live.
229 INTERNAL_CFLAGS = $(CFLAGS) $(LIBGCC2_CFLAGS) $(HOST_LIBGCC2_CFLAGS) \
230 $(INCLUDES) @set_have_cc_tls@ @set_use_emutls@
232 MULTIDIR := $(shell $(CC) $(CFLAGS) -print-multi-directory)
233 MULTIOSDIR := $(shell $(CC) $(CFLAGS) -print-multi-os-directory)
235 MULTIOSSUBDIR := $(shell if test $(MULTIOSDIR) != .; then echo /$(MULTIOSDIR); fi)
236 inst_libdir = $(libsubdir)$(MULTISUBDIR)
237 inst_slibdir = $(slibdir)$(MULTIOSSUBDIR)
239 gcc_compile_bare = $(CC) $(INTERNAL_CFLAGS)
240 compile_deps = -MT $@ -MD -MP -MF $(basename $@).dep
241 gcc_compile = $(gcc_compile_bare) -o $@ $(compile_deps)
242 gcc_s_compile = $(gcc_compile) -DSHARED
244 objects = $(filter %$(objext),$^)
246 # Collect any host-specific information from Makefile fragments.
247 tmake_file = @tmake_file@
248 include $(srcdir)/empty.mk $(tmake_file)
250 # Only handle shared libraries if both:
251 # - the user requested them
252 # - we know how to build them
253 ifeq ($(SHLIB_LINK),)
254 enable_shared := no
255 endif
257 ifeq ($(enable_shared),yes)
258 iterator = $(srcdir)/empty.mk $(patsubst %,$(srcdir)/shared-object.mk,$(iter-items))
260 install-shared = install-shared
262 ifneq ($(LIBUNWIND),)
263 install-libunwind = install-libunwind
264 endif
266 # For -fvisibility=hidden. We need both a -fvisibility=hidden on
267 # the command line, and a #define to prevent libgcc2.h etc from
268 # overriding that with #pragmas.
269 vis_hide = @vis_hide@
271 ifneq (,$(vis_hide))
273 # If we have -fvisibility=hidden, then we need to generate hide
274 # lists for object files implemented in assembly.
275 ASM_HIDDEN_OP = @asm_hidden_op@
277 define gen-hide-list
278 $(NM) -pg $< | \
279 $(AWK) 'NF == 3 && $$2 !~ /^[UN]$$/ && $$3 !~ /.*_compat/ \
280 && $$3 !~ /.*@.*/ \
281 { print "\t$(ASM_HIDDEN_OP)", $$3 }' > $@T
282 mv -f $@T $@
283 endef
284 else
285 gen-hide-list = echo > $@
286 endif
288 else
289 # Not enable_shared.
290 iterator = $(srcdir)/empty.mk $(patsubst %,$(srcdir)/static-object.mk,$(iter-items))
291 vis_hide =
292 gen-hide-list = echo > \$@
293 endif
295 ifneq ($(EXTRA_PARTS),)
296 extra-parts = libgcc-extra-parts
297 INSTALL_PARTS = $(EXTRA_PARTS)
298 else
299 ifneq ($(GCC_EXTRA_PARTS),)
300 extra-parts = gcc-extra-parts
301 INSTALL_PARTS = $(GCC_EXTRA_PARTS)
302 endif
303 endif
305 # Library members defined in libgcc2.c.
306 lib2funcs = _muldi3 _negdi2 _lshrdi3 _ashldi3 _ashrdi3 _cmpdi2 _ucmpdi2 \
307 _clear_cache _enable_execute_stack _trampoline __main _absvsi2 \
308 _absvdi2 _addvsi3 _addvdi3 _subvsi3 _subvdi3 _mulvsi3 _mulvdi3 \
309 _negvsi2 _negvdi2 _ctors _ffssi2 _ffsdi2 _clz _clzsi2 _clzdi2 \
310 _ctzsi2 _ctzdi2 _popcount_tab _popcountsi2 _popcountdi2 \
311 _paritysi2 _paritydi2 _powisf2 _powidf2 _powixf2 _powitf2 \
312 _mulsc3 _muldc3 _mulxc3 _multc3 _divsc3 _divdc3 _divxc3 \
313 _divtc3 _bswapsi2 _bswapdi2
315 # The floating-point conversion routines that involve a single-word integer.
316 # XX stands for the integer mode.
317 swfloatfuncs = $(patsubst %,_fixuns%XX,sf df xf)
319 # Likewise double-word routines.
320 dwfloatfuncs = $(patsubst %,_fix%XX,sf df xf tf) \
321 $(patsubst %,_fixuns%XX,sf df xf tf) \
322 $(patsubst %,_floatXX%,sf df xf tf) \
323 $(patsubst %,_floatunXX%,sf df xf tf)
325 ifeq ($(LIB2_SIDITI_CONV_FUNCS),)
326 lib2funcs += $(subst XX,si,$(swfloatfuncs))
327 lib2funcs += $(subst XX,di,$(dwfloatfuncs))
328 endif
330 # These might cause a divide overflow trap and so are compiled with
331 # unwinder info.
332 LIB2_DIVMOD_FUNCS = _divdi3 _moddi3 _udivdi3 _umoddi3 _udiv_w_sdiv _udivmoddi4
334 # Remove any objects from lib2funcs and LIB2_DIVMOD_FUNCS that are
335 # defined as optimized assembly code in LIB1ASMFUNCS or as C code
336 # in LIB2FUNCS_EXCLUDE.
337 lib2funcs := $(filter-out $(LIB2FUNCS_EXCLUDE) $(LIB1ASMFUNCS),$(lib2funcs))
338 LIB2_DIVMOD_FUNCS := $(filter-out $(LIB2FUNCS_EXCLUDE) $(LIB1ASMFUNCS), \
339 $(LIB2_DIVMOD_FUNCS))
341 # Build "libgcc1" (assembly) components.
342 ifeq ($(enable_shared),yes)
344 lib1asmfuncs-o = $(patsubst %,%$(objext),$(LIB1ASMFUNCS))
345 $(lib1asmfuncs-o): %$(objext): $(gcc_srcdir)/config/$(LIB1ASMSRC) %.vis
346 $(gcc_compile) -DL$* -xassembler-with-cpp \
347 -c $(gcc_srcdir)/config/$(LIB1ASMSRC) -include $*.vis
348 $(patsubst %,%.vis,$(LIB1ASMFUNCS)): %.vis: %_s$(objext)
349 $(gen-hide-list)
350 libgcc-objects += $(lib1asmfuncs-o)
352 lib1asmfuncs-s-o = $(patsubst %,%_s$(objext),$(LIB1ASMFUNCS))
353 $(lib1asmfuncs-s-o): %_s$(objext): $(gcc_srcdir)/config/$(LIB1ASMSRC)
354 $(gcc_s_compile) -DL$* -xassembler-with-cpp \
355 -c $(gcc_srcdir)/config/$(LIB1ASMSRC)
356 libgcc-s-objects += $(lib1asmfuncs-s-o)
358 else
360 lib1asmfuncs-o = $(patsubst %,%$(objext),$(LIB1ASMFUNCS))
361 $(lib1asmfuncs-o): %$(objext): $(gcc_srcdir)/config/$(LIB1ASMSRC)
362 $(gcc_compile) -DL$* -xassembler-with-cpp \
363 -c $(gcc_srcdir)/config/$(LIB1ASMSRC)
364 libgcc-objects += $(lib1asmfuncs-o)
366 endif
368 # Build lib2funcs. For the static library also include LIB2FUNCS_ST.
369 lib2funcs-o = $(patsubst %,%$(objext),$(lib2funcs) $(LIB2FUNCS_ST))
370 $(lib2funcs-o): %$(objext): $(gcc_srcdir)/libgcc2.c
371 $(gcc_compile) -DL$* -c $(gcc_srcdir)/libgcc2.c \
372 $(vis_hide)
373 libgcc-objects += $(lib2funcs-o)
375 ifeq ($(enable_shared),yes)
376 lib2funcs-s-o = $(patsubst %,%_s$(objext),$(lib2funcs))
377 $(lib2funcs-s-o): %_s$(objext): $(gcc_srcdir)/libgcc2.c
378 $(gcc_s_compile) -DL$* -c $(gcc_srcdir)/libgcc2.c
379 libgcc-s-objects += $(lib2funcs-s-o)
380 endif
382 ifneq ($(LIB2_SIDITI_CONV_FUNCS),)
383 # Build libgcc2.c for each conversion function, with a specific
384 # L<func> definition and LIBGCC2_UNITS_PER_WORD setting. The DImode
385 # functions are built with a wordsize of 4; the TImode functions are
386 # built with the same labels, but a wordsize of 8.
388 sifuncs := $(filter-out $(LIB2FUNCS_EXCLUDE),$(subst XX,si,$(swfloatfuncs)))
389 difuncs := $(filter-out $(LIB2FUNCS_EXCLUDE),$(subst XX,di,$(dwfloatfuncs)))
390 tifuncs := $(filter-out $(LIB2FUNCS_EXCLUDE),$(subst XX,ti,$(dwfloatfuncs)))
392 iter-items := $(sifuncs) $(difuncs) $(tifuncs)
393 iter-labels := $(sifuncs) $(difuncs) $(difuncs)
394 iter-sizes := $(patsubst %,4,$(sifuncs) $(difuncs)) $(patsubst %,8,$(tifuncs))
396 include $(srcdir)/empty.mk $(patsubst %,$(srcdir)/siditi-object.mk,$(iter-items))
398 libgcc-objects += $(patsubst %,%$(objext),$(sifuncs) $(difuncs) $(tifuncs))
399 ifeq ($(enable_shared),yes)
400 libgcc-s-objects += $(patsubst %,%_s$(objext),$(sifuncs) $(difuncs) $(tifuncs))
401 endif
402 endif
404 # Build LIB2_DIVMOD_FUNCS.
405 lib2-divmod-o = $(patsubst %,%$(objext),$(LIB2_DIVMOD_FUNCS))
406 $(lib2-divmod-o): %$(objext): $(gcc_srcdir)/libgcc2.c
407 $(gcc_compile) -DL$* -c $(gcc_srcdir)/libgcc2.c \
408 -fexceptions -fnon-call-exceptions $(vis_hide)
409 libgcc-objects += $(lib2-divmod-o)
411 ifeq ($(enable_shared),yes)
412 lib2-divmod-s-o = $(patsubst %,%_s$(objext),$(LIB2_DIVMOD_FUNCS))
413 $(lib2-divmod-s-o): %_s$(objext): $(gcc_srcdir)/libgcc2.c
414 $(gcc_s_compile) -DL$* -c $(gcc_srcdir)/libgcc2.c \
415 -fexceptions -fnon-call-exceptions
416 libgcc-s-objects += $(lib2-divmod-s-o)
417 endif
419 # $(FPBIT) et al. are pathnames relative to the GCC build
420 # directory; the supporting files are made by the GCC
421 # Makefile.
422 # FIXME: Soon we will be able to move this logic into this directory.
424 ifneq ($(fpbit-in-libgcc),yes)
425 FPBIT:=$(if $(FPBIT),$(gcc_objdir)/$(FPBIT),)
426 DPBIT:=$(if $(DPBIT),$(gcc_objdir)/$(DPBIT),)
427 TPBIT:=$(if $(TPBIT),$(gcc_objdir)/$(TPBIT),)
428 endif
430 ifeq ($(TPBIT),)
431 # _sf_to_tf and _df_to_tf require tp-bit.c being compiled in.
432 FPBIT_FUNCS := $(filter-out _sf_to_tf,$(FPBIT_FUNCS))
433 DPBIT_FUNCS := $(filter-out _df_to_tf,$(DPBIT_FUNCS))
434 endif
436 # Build FPBIT.
437 ifneq ($(FPBIT),)
438 fpbit-o = $(patsubst %,%$(objext),$(FPBIT_FUNCS))
439 $(fpbit-o): %$(objext): $(FPBIT)
440 $(gcc_compile) -DFINE_GRAINED_LIBRARIES -DL$* -c $(FPBIT) $(vis_hide)
441 libgcc-objects += $(fpbit-o)
443 ifeq ($(enable_shared),yes)
444 fpbit-s-o = $(patsubst %,%_s$(objext),$(FPBIT_FUNCS))
445 $(fpbit-s-o): %_s$(objext): $(FPBIT)
446 $(gcc_s_compile) -DFINE_GRAINED_LIBRARIES -DL$* -c $(FPBIT)
447 libgcc-s-objects += $(fpbit-s-o)
448 endif
449 endif
451 # Build DPBIT.
452 ifneq ($(DPBIT),)
453 dpbit-o = $(patsubst %,%$(objext),$(DPBIT_FUNCS))
454 $(dpbit-o): %$(objext): $(DPBIT)
455 $(gcc_compile) -DFINE_GRAINED_LIBRARIES -DL$* -c $(DPBIT) $(vis_hide)
456 libgcc-objects += $(dpbit-o)
458 ifeq ($(enable_shared),yes)
459 dpbit-s-o = $(patsubst %,%_s$(objext),$(DPBIT_FUNCS))
460 $(dpbit-s-o): %_s$(objext): $(DPBIT)
461 $(gcc_s_compile) -DFINE_GRAINED_LIBRARIES -DL$* -c $(DPBIT)
462 libgcc-s-objects += $(dpbit-s-o)
463 endif
464 endif
466 # Build TPBIT.
467 ifneq ($(TPBIT),)
468 tpbit-o = $(patsubst %,%$(objext),$(TPBIT_FUNCS))
469 $(tpbit-o): %$(objext): $(TPBIT)
470 $(gcc_compile) -DFINE_GRAINED_LIBRARIES -DL$* -c $(TPBIT) $(vis_hide)
471 libgcc-objects += $(tpbit-o)
473 ifeq ($(enable_shared),yes)
474 tpbit-s-o = $(patsubst %,%_s$(objext),$(TPBIT_FUNCS))
475 $(tpbit-s-o): %_s$(objext): $(TPBIT)
476 $(gcc_s_compile) -DFINE_GRAINED_LIBRARIES -DL$* -c $(TPBIT)
477 libgcc-s-objects += $(tpbit-s-o)
478 endif
479 endif
481 # Build decimal floating point support.
482 ifeq ($(decimal_float),yes)
484 # If $DFP_ENABLE is set, then we want all data type sizes.
485 ifneq ($(DFP_ENABLE),)
486 D32PBIT = 1
487 D64PBIT = 1
488 D128PBIT = 1
489 endif
491 dfp-filenames =
492 ifneq ($(D32PBIT)$(D64PBIT)$(D128PBIT),)
493 ifeq ($(enable_decimal_float),bid)
494 dfp-filenames += bid_decimal_globals bid_decimal_data \
495 bid_binarydecimal bid_convert_data \
496 _isinfd32 _isinfd64 _isinfd128 bid64_noncomp \
497 bid128_noncomp bid128_fma bid_round bid_from_int \
498 bid64_add bid128_add bid64_div bid128_div \
499 bid64_mul bid128_mul bid64_compare bid128_compare \
500 bid128 bid32_to_bid64 bid32_to_bid128 bid64_to_bid128 \
501 bid64_to_int32 bid64_to_int64 \
502 bid64_to_uint32 bid64_to_uint64 \
503 bid128_to_int32 bid128_to_int64 \
504 bid128_to_uint32 bid128_to_uint64
505 else
506 dfp-filenames += decContext decNumber decExcept decRound decLibrary decDouble decPacked decQuad decSingle
507 endif
508 endif
510 dfp-objects = $(patsubst %,%$(objext),$(dfp-filenames))
511 ifeq ($(enable_decimal_float),bid)
512 $(dfp-objects): %$(objext): $(srcdir)/config/libbid/%.c
513 else
514 $(dfp-objects): %$(objext): $(srcdir)/../libdecnumber/%.c
515 endif
516 $(gcc_compile) -c $<
517 libgcc-objects += $(dfp-objects)
519 decbits-filenames =
520 ifneq ($(enable_decimal_float),bid)
521 ifneq ($(D32PBIT),)
522 decbits-filenames += decimal32
523 endif
525 ifneq ($(D64PBIT),)
526 decbits-filenames += decimal64
527 endif
529 ifneq ($(D128PBIT),)
530 decbits-filenames += decimal128
531 endif
532 endif
534 decbits-objects = $(patsubst %,%$(objext),$(decbits-filenames))
535 ifeq ($(enable_decimal_float),bid)
536 $(decbits-objects): %$(objext): $(srcdir)/config/libbid/%.c
537 else
538 $(decbits-objects): %$(objext): $(srcdir)/../libdecnumber/$(enable_decimal_float)/%.c
539 endif
540 $(gcc_compile) -c $<
541 libgcc-objects += $(decbits-objects)
543 # Next build individual support functions.
544 ifeq ($(enable_decimal_float),bid)
545 ifneq ($(D32PBIT),)
546 D32PBIT_FUNCS:=$(filter-out _plus_sd _minus_sd _conv_sd, $(D32PBIT_FUNCS))
547 endif
549 ifneq ($(D64PBIT),)
550 D64PBIT_FUNCS:=$(filter-out _plus_dd _minus_dd _conv_dd, $(D64PBIT_FUNCS))
551 endif
553 ifneq ($(D128PBIT),)
554 D128PBIT_FUNCS:=$(filter-out _plus_td _minus_td _conv_td, $(D128PBIT_FUNCS))
555 endif
556 endif
558 ifneq ($(D32PBIT),)
559 d32pbit-o = $(patsubst %,%$(objext),$(D32PBIT_FUNCS))
560 ifeq ($(enable_decimal_float),bid)
561 $(d32pbit-o): %$(objext): $(srcdir)/config/libbid/%.c
562 else
563 $(d32pbit-o): %$(objext): $(gcc_srcdir)/config/dfp-bit.c
564 endif
565 $(gcc_compile) -DFINE_GRAINED_LIBRARIES -DL$* -DWIDTH=32 -c $<
566 libgcc-objects += $(d32pbit-o)
567 endif
569 ifneq ($(D64PBIT),)
570 d64pbit-o = $(patsubst %,%$(objext),$(D64PBIT_FUNCS))
571 ifeq ($(enable_decimal_float),bid)
572 $(d64pbit-o): %$(objext): $(srcdir)/config/libbid/%.c
573 else
574 $(d64pbit-o): %$(objext): $(gcc_srcdir)/config/dfp-bit.c
575 endif
576 $(gcc_compile) -DFINE_GRAINED_LIBRARIES -DL$* -DWIDTH=64 -c $<
577 libgcc-objects += $(d64pbit-o)
578 endif
580 ifneq ($(D128PBIT),)
581 d128pbit-o = $(patsubst %,%$(objext),$(D128PBIT_FUNCS))
582 ifeq ($(enable_decimal_float),bid)
583 $(d128pbit-o): %$(objext): $(srcdir)/config/libbid/%.c
584 else
585 $(d128pbit-o): %$(objext): $(gcc_srcdir)/config/dfp-bit.c
586 endif
587 $(gcc_compile) -DFINE_GRAINED_LIBRARIES -DL$* -DWIDTH=128 -c $<
588 libgcc-objects += $(d128pbit-o)
589 endif
591 endif
593 ifeq ($(LIBGCC_SYNC),yes)
594 libgcc-sync-size-funcs := $(foreach op, add sub or and xor nand, \
595 sync_fetch_and_$(op) \
596 sync_$(op)_and_fetch) \
597 sync_bool_compare_and_swap \
598 sync_val_compare_and_swap \
599 sync_lock_test_and_set
601 libgcc-sync-size-funcs := $(foreach prefix, $(libgcc-sync-size-funcs), \
602 $(foreach suffix, 1 2 4 8 16, \
603 $(prefix)_$(suffix)))
605 libgcc-sync-size-funcs-o = $(patsubst %,%$(objext),$(libgcc-sync-size-funcs))
606 $(libgcc-sync-size-funcs-o): %$(objext): $(gcc_srcdir)/config/sync.c
607 $(gcc_compile) $(LIBGCC_SYNC_CFLAGS) \
608 -DFN=`echo "$*" | sed 's/_[^_]*$$//'` \
609 -DSIZE=`echo "$*" | sed 's/.*_//'` \
610 -c $(gcc_srcdir)/config/sync.c $(vis_hide)
611 libgcc-objects += $(libgcc-sync-size-funcs-o)
613 libgcc-sync-funcs := sync_synchronize
615 libgcc-sync-funcs-o = $(patsubst %,%$(objext),$(libgcc-sync-funcs))
616 $(libgcc-sync-funcs-o): %$(objext): $(gcc_srcdir)/config/sync.c
617 $(gcc_compile) $(LIBGCC_SYNC_CFLAGS) \
618 -DL$* \
619 -c $(gcc_srcdir)/config/sync.c $(vis_hide)
620 libgcc-objects += $(libgcc-sync-funcs-o)
622 ifeq ($(enable_shared),yes)
623 libgcc-sync-size-funcs-s-o = $(patsubst %,%_s$(objext), \
624 $(libgcc-sync-size-funcs))
625 $(libgcc-sync-size-funcs-s-o): %_s$(objext): $(gcc_srcdir)/config/sync.c
626 $(gcc_s_compile) $(LIBGCC_SYNC_CFLAGS) \
627 -DFN=`echo "$*" | sed 's/_[^_]*$$//'` \
628 -DSIZE=`echo "$*" | sed 's/.*_//'` \
629 -c $(gcc_srcdir)/config/sync.c
630 libgcc-s-objects += $(libgcc-sync-size-funcs-s-o)
632 libgcc-sync-funcs-s-o = $(patsubst %,%_s$(objext),$(libgcc-sync-funcs))
633 $(libgcc-sync-funcs-s-o): %_s$(objext): $(gcc_srcdir)/config/sync.c
634 $(gcc_s_compile) $(LIBGCC_SYNC_CFLAGS) \
635 -DL$* \
636 -c $(gcc_srcdir)/config/sync.c
637 libgcc-s-objects += $(libgcc-sync-funcs-s-o)
638 endif
639 endif
641 # Build fixed-point support.
642 ifeq ($(fixed_point),yes)
644 # Generate permutations of function name and mode
645 fixed-labels := $(shell $(SHELL) $(srcdir)/gen-fixed.sh arith labels)
646 fixed-funcs := $(shell $(SHELL) $(srcdir)/gen-fixed.sh arith funcs)
647 fixed-modes := $(shell $(SHELL) $(srcdir)/gen-fixed.sh arith modes)
649 # Generate the rules for each arithmetic function
650 iter-items := $(fixed-funcs)
651 iter-labels := $(fixed-labels)
652 iter-from := $(fixed-modes)
653 iter-to := $(fixed-modes)
654 include $(srcdir)/empty.mk $(patsubst %,$(srcdir)/fixed-obj.mk,$(iter-items))
656 # Add arithmetic functions to list of objects to be built
657 libgcc-objects += $(patsubst %,%$(objext),$(fixed-funcs))
658 ifeq ($(enable_shared),yes)
659 libgcc-s-objects += $(patsubst %,%_s$(objext),$(fixed-funcs))
660 endif
662 # Convert from or to fractional
663 fixed-conv-funcs := $(shell $(SHELL) $(srcdir)/gen-fixed.sh conv funcs)
664 fixed-conv-labels := $(shell $(SHELL) $(srcdir)/gen-fixed.sh conv labels)
665 fixed-conv-from := $(shell $(SHELL) $(srcdir)/gen-fixed.sh conv from)
666 fixed-conv-to := $(shell $(SHELL) $(srcdir)/gen-fixed.sh conv to)
668 # Generate the make rules for each conversion function
669 iter-items := $(fixed-conv-funcs)
670 iter-labels := $(fixed-conv-labels)
671 iter-from := $(fixed-conv-from)
672 iter-to := $(fixed-conv-to)
673 include $(srcdir)/empty.mk $(patsubst %,$(srcdir)/fixed-obj.mk,$(iter-items))
675 # Add conversion functions to list of objects to be built
676 libgcc-objects += $(patsubst %,%$(objext),$(fixed-conv-funcs))
677 ifeq ($(enable_shared),yes)
678 libgcc-s-objects += $(patsubst %,%_s$(objext),$(fixed-conv-funcs))
679 endif
681 endif
683 # Build LIB2ADD and LIB2ADD_ST.
684 ifneq ($(filter-out %.c %.S %.asm,$(LIB2ADD) $(LIB2ADD_ST)),)
685 $(error Unsupported files in LIB2ADD or LIB2ADD_ST.)
686 endif
688 libgcc-objects += $(addsuffix $(objext),$(basename $(notdir $(LIB2ADD))))
689 libgcc-objects += $(addsuffix $(objext),$(basename $(notdir $(LIB2ADD_ST))))
691 c_flags :=
692 iter-items := $(LIB2ADD) $(LIB2ADD_ST)
693 include $(iterator)
695 ifeq ($(enable_shared),yes)
696 libgcc-s-objects += $(addsuffix _s$(objext),$(basename $(notdir $(LIB2ADD))))
697 endif
699 # Build LIB2ADDEH, LIB2ADDEHSTATIC, and LIB2ADDEHSHARED. If we don't have
700 # libgcc_eh.a, only LIB2ADDEH matters. If we do, only LIB2ADDEHSTATIC and
701 # LIB2ADDEHSHARED matter. (Usually all three are identical.)
703 c_flags := -fexceptions
705 ifeq ($(enable_shared),yes)
707 libgcc-eh-objects += $(addsuffix $(objext),$(basename $(notdir $(LIB2ADDEHSTATIC))))
708 libgcc-s-objects += $(addsuffix _s$(objext),$(basename $(notdir $(LIB2ADDEHSHARED))))
710 iter-items := $(sort $(LIB2ADDEHSTATIC) $(LIB2ADDEHSHARED))
711 include $(iterator)
713 else
714 # Not shared. LIB2ADDEH are added to libgcc.a.
716 libgcc-objects += $(addsuffix $(objext),$(basename $(notdir $(LIB2ADDEH))))
718 iter-items := $(LIB2ADDEH)
719 include $(iterator)
721 endif
723 # Build LIBUNWIND.
725 c_flags := -fexceptions
727 libunwind-objects += $(addsuffix $(objext),$(basename $(notdir $(LIBUNWIND))))
729 ifeq ($(enable_shared),yes)
730 libunwind-s-objects += $(addsuffix _s$(objext),$(basename $(notdir $(LIBUNWIND))))
731 endif
733 iter-items := $(LIBUNWIND)
734 include $(iterator)
736 # Build libgcov components.
737 libgcov-objects = $(patsubst %,%$(objext),$(LIBGCOV))
738 $(libgcov-objects): %$(objext): $(gcc_srcdir)/libgcov.c
739 $(gcc_compile) -DL$* -c $(gcc_srcdir)/libgcov.c
742 # Static libraries.
743 libgcc.a: $(libgcc-objects)
744 libgcov.a: $(libgcov-objects)
745 libunwind.a: $(libunwind-objects)
746 libgcc_eh.a: $(libgcc-eh-objects)
748 libgcc.a libgcov.a libunwind.a libgcc_eh.a:
749 -rm -f $@
751 objects="$(objects)"; \
752 if test -z "$$objects"; then \
753 echo 'int __libgcc_eh_dummy;' > eh_dummy.c; \
754 $(gcc_compile_bare) $(vis_hide) -c eh_dummy.c \
755 -o eh_dummy$(objext); \
756 objects=eh_dummy$(objext); \
757 fi; \
758 $(AR_CREATE_FOR_TARGET) $@ $$objects
760 $(RANLIB) $@
762 all: libgcc.a libgcov.a
764 ifneq ($(LIBUNWIND),)
765 all: libunwind.a
766 libgcc_s$(SHLIB_EXT): libunwind$(SHLIB_EXT)
767 endif
769 ifeq ($(enable_shared),yes)
770 all: libgcc_eh.a libgcc_s$(SHLIB_EXT)
771 ifneq ($(LIBUNWIND),)
772 all: libunwind$(SHLIB_EXT)
773 endif
774 endif
776 ifeq ($(enable_shared),yes)
778 # Map-file generation.
779 ifneq ($(SHLIB_MKMAP),)
780 libgcc.map: $(SHLIB_MKMAP) $(SHLIB_MAPFILES) $(libgcc-s-objects)
781 { $(NM) $(SHLIB_NM_FLAGS) $(libgcc-s-objects); echo %%; \
782 cat $(SHLIB_MAPFILES) \
783 | sed -e '/^[ ]*#/d' \
784 -e 's/^%\(if\|else\|elif\|endif\|define\)/#\1/' \
785 | $(gcc_compile_bare) -E -xassembler-with-cpp -; \
786 } | $(AWK) -f $(SHLIB_MKMAP) $(SHLIB_MKMAP_OPTS) > tmp-$@
787 mv tmp-$@ $@
788 libgcc_s$(SHLIB_EXT): libgcc.map
789 mapfile = libgcc.map
790 endif
792 libgcc_s$(SHLIB_EXT): $(libgcc-s-objects) $(extra-parts)
793 # @multilib_flags@ is still needed because this may use
794 # $(GCC_FOR_TARGET) and $(LIBGCC2_CFLAGS) directly.
795 # @multilib_dir@ is not really necessary, but sometimes it has
796 # more uses than just a directory name.
797 $(mkinstalldirs) $(MULTIDIR)
798 $(subst @multilib_flags@,$(CFLAGS) -B./,$(subst \
799 @multilib_dir@,$(MULTIDIR),$(subst \
800 @shlib_objs@,$(objects),$(subst \
801 @shlib_base_name@,libgcc_s,$(subst \
802 @shlib_map_file@,$(mapfile),$(subst \
803 @shlib_slibdir_qual@,$(MULTIOSSUBDIR),$(subst \
804 @shlib_slibdir@,$(shlib_slibdir),$(SHLIB_LINK))))))))
806 libunwind$(SHLIB_EXT): $(libunwind-s-objects) $(extra-parts)
807 # @multilib_flags@ is still needed because this may use
808 # $(GCC_FOR_TARGET) and $(LIBGCC2_CFLAGS) directly.
809 # @multilib_dir@ is not really necessary, but sometimes it has
810 # more uses than just a directory name.
811 $(mkinstalldirs) $(MULTIDIR)
812 $(subst @multilib_flags@,$(CFLAGS) -B./,$(subst \
813 @multilib_dir@,$(MULTIDIR),$(subst \
814 @shlib_objs@,$(objects),$(subst \
815 @shlib_base_name@,libunwind,$(subst \
816 @shlib_slibdir_qual@,$(MULTIOSSUBDIR),$(SHLIBUNWIND_LINK))))))
818 endif
820 # Build the standard GCC startfiles and endfiles.
821 ALL_CRT_CFLAGS = $(CFLAGS) $(CRTSTUFF_CFLAGS) $(INCLUDES)
822 crt_compile = $(CC) $(ALL_CRT_CFLAGS) -o $@ $(compile_deps)
824 ifeq ($(CUSTOM_CRTSTUFF),)
825 crtbegin$(objext): $(gcc_srcdir)/crtstuff.c
826 $(crt_compile) $(CRTSTUFF_T_CFLAGS) \
827 -c $(gcc_srcdir)/crtstuff.c -DCRT_BEGIN
829 crtend$(objext): $(gcc_srcdir)/crtstuff.c
830 $(crt_compile) $(CRTSTUFF_T_CFLAGS) \
831 -c $(gcc_srcdir)/crtstuff.c -DCRT_END
833 # These are versions of crtbegin and crtend for shared libraries.
834 crtbeginS$(objext): $(gcc_srcdir)/crtstuff.c
835 $(crt_compile) $(CRTSTUFF_T_CFLAGS_S) \
836 -c $(gcc_srcdir)/crtstuff.c -DCRT_BEGIN -DCRTSTUFFS_O
838 crtendS$(objext): $(gcc_srcdir)/crtstuff.c
839 $(crt_compile) $(CRTSTUFF_T_CFLAGS_S) \
840 -c $(gcc_srcdir)/crtstuff.c -DCRT_END -DCRTSTUFFS_O
842 # This is a version of crtbegin for -static links.
843 crtbeginT.o: $(gcc_srcdir)/crtstuff.c
844 $(crt_compile) $(CRTSTUFF_T_CFLAGS) \
845 -c $(gcc_srcdir)/crtstuff.c -DCRT_BEGIN -DCRTSTUFFT_O
846 endif
848 # Build extra startfiles in the libgcc directory.
849 .PHONY: libgcc-extra-parts
850 libgcc-extra-parts: $(EXTRA_PARTS)
851 ifneq ($(GCC_EXTRA_PARTS),)
852 ifneq ($(sort $(EXTRA_PARTS)),$(GCC_EXTRA_PARTS))
853 # If the gcc directory specifies which extra parts to
854 # build for this target, and the libgcc configuration also
855 # specifies, make sure they match. This can be removed
856 # when the gcc directory no longer holds libgcc configuration;
857 # it is useful when migrating a target.
858 @echo "Configuration mismatch!"
859 @echo "Extra parts from gcc directory: $(GCC_EXTRA_PARTS)"
860 @echo "Extra parts from libgcc: $(EXTRA_PARTS)"
861 exit 1
862 endif
863 endif
865 # Early copyback; see "all" above for the rationale. The
866 # early copy is necessary so that the gcc -B options find
867 # the right startup files when linking shared libgcc.
868 $(mkinstalldirs) $(gcc_objdir)$(MULTISUBDIR)
869 parts="$(EXTRA_PARTS)"; \
870 for file in $$parts; do \
871 rm -f $(gcc_objdir)$(MULTISUBDIR)/$$file; \
872 $(INSTALL_DATA) $$file $(gcc_objdir)$(MULTISUBDIR)/; \
873 done
875 # Build extra startfiles in the gcc directory, for unconverted
876 # targets.
877 .PHONY: gcc-extra-parts
878 gcc-extra-parts:
879 # Recursively invoke make in the GCC directory to build any
880 # startfiles (for now). We must do this just once, passing
881 # it all the GCC_EXTRA_PARTS as simultaneous goal targets,
882 # so that rules which cannot execute simultaneously are properly
883 # serialized. We indirect through T_TARGET in case any multilib
884 # directories contain an equals sign, to prevent make from
885 # interpreting any of the goals as variable assignments.
887 # We must use cd && make rather than make -C, or else the stage
888 # number will be embedded in debug information.
890 T=`$(PWD_COMMAND)`/ \
891 && cd $(gcc_objdir) \
892 && $(MAKE) GCC_FOR_TARGET="$(CC)" \
893 MULTILIB_CFLAGS="$(CFLAGS)" \
894 T=$$T \
895 T_TARGET="$(patsubst %,$${T}%,$(GCC_EXTRA_PARTS))" \
896 T_TARGET
898 # Early copyback; see "all" above for the rationale. The
899 # early copy is necessary so that the gcc -B options find
900 # the right startup files when linking shared libgcc.
901 $(mkinstalldirs) $(gcc_objdir)$(MULTISUBDIR)
902 parts="$(GCC_EXTRA_PARTS)"; \
903 for file in $$parts; do \
904 rm -f $(gcc_objdir)$(MULTISUBDIR)/$$file; \
905 $(INSTALL_DATA) $$file $(gcc_objdir)$(MULTISUBDIR)/; \
906 done
908 all: $(extra-parts)
910 # Documentation targets (empty).
911 .PHONY: info html dvi pdf install-info install-html install-pdf
913 info:
914 install-info:
915 html:
916 install-html:
917 dvi:
918 pdf:
919 install-pdf:
921 # Install rules. These do not depend on "all", so that they can be invoked
922 # recursively from it.
923 install-libunwind:
924 $(mkinstalldirs) $(DESTDIR)$(inst_slibdir)
926 # NOTE: Maybe this should go into $(inst_libdir), but this
927 # is where the old mklibgcc.in put it.
928 $(INSTALL_DATA) libunwind.a $(DESTDIR)$(inst_slibdir)/
929 chmod 644 $(DESTDIR)$(inst_slibdir)/libunwind.a
930 $(RANLIB) $(DESTDIR)$(inst_slibdir)/libunwind.a
932 $(subst @multilib_dir@,$(MULTIDIR),$(subst \
933 @shlib_base_name@,libunwind,$(subst \
934 @shlib_slibdir_qual@,$(MULTIOSSUBDIR),$(SHLIBUNWIND_INSTALL))))
936 install-shared:
937 $(mkinstalldirs) $(DESTDIR)$(inst_libdir)
939 $(INSTALL_DATA) libgcc_eh.a $(DESTDIR)$(inst_libdir)/
940 chmod 644 $(DESTDIR)$(inst_libdir)/libgcc_eh.a
941 $(RANLIB) $(DESTDIR)$(inst_libdir)/libgcc_eh.a
943 $(subst @multilib_dir@,$(MULTIDIR),$(subst \
944 @shlib_base_name@,libgcc_s,$(subst \
945 @shlib_slibdir_qual@,$(MULTIOSSUBDIR),$(SHLIB_INSTALL))))
947 install-leaf: $(install-shared) $(install-libunwind)
948 $(mkinstalldirs) $(DESTDIR)$(inst_libdir)
950 $(INSTALL_DATA) libgcc.a $(DESTDIR)$(inst_libdir)/
951 chmod 644 $(DESTDIR)$(inst_libdir)/libgcc.a
952 $(RANLIB) $(DESTDIR)$(inst_libdir)/libgcc.a
953 $(INSTALL_DATA) libgcov.a $(DESTDIR)$(inst_libdir)/
954 chmod 644 $(DESTDIR)$(inst_libdir)/libgcov.a
955 $(RANLIB) $(DESTDIR)$(inst_libdir)/libgcov.a
957 parts="$(INSTALL_PARTS)"; \
958 for file in $$parts; do \
959 rm -f $(DESTDIR)$(inst_libdir)/$$file; \
960 $(INSTALL_DATA) $$file $(DESTDIR)$(inst_libdir)/; \
961 done
963 install: install-leaf
964 @: $(MAKE) ; $(MULTIDO) $(FLAGS_TO_PASS) multi-do DO=install
966 .PHONY: install install-shared install-libunwind
968 # Don't export variables to the environment, in order to not confuse
969 # configure.
970 .NOEXPORT:
972 include $(srcdir)/empty.mk $(wildcard *.dep)
974 # TODO QUEUE:
975 # Garbage collect in gcc/:
976 # $(LIBGCC) settings in t-* are now unused
978 # Remove use of $(gcc_srcdir). Source files referenced using $(gcc_srcdir)
979 # should move into the libgcc directory.