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