]> git.ipfire.org Git - thirdparty/gcc.git/blob - libgcc/Makefile.in
Optimize powerpc*-*-linux* e500 hardfp/soft-fp use.
[thirdparty/gcc.git] / libgcc / Makefile.in
1 # Makefile.in
2
3 # Copyright (C) 2005-2014 Free Software Foundation, Inc.
4 #
5 # This file is part of GCC.
6 #
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.
11 #
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.
16 #
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/>.
20 #
21
22 libgcc_topdir = @libgcc_topdir@
23 host_subdir = @host_subdir@
24
25 gcc_objdir = $(MULTIBUILDTOP)../../$(host_subdir)/gcc
26
27 srcdir = @srcdir@
28
29 prefix = @prefix@
30
31 exec_prefix = @exec_prefix@
32 libdir = @libdir@
33 shlib_slibdir = @slibdir@
34
35 SHELL = @SHELL@
36
37 cpu_type = @cpu_type@
38 enable_shared = @enable_shared@
39 double_type_size = @double_type_size@
40 long_double_type_size = @long_double_type_size@
41 decimal_float = @decimal_float@
42 enable_vtable_verify = @enable_vtable_verify@
43 enable_decimal_float = @enable_decimal_float@
44 fixed_point = @fixed_point@
45
46 host_noncanonical = @host_noncanonical@
47 target_noncanonical = @target_noncanonical@
48
49 # List of extra object files that should be compiled for this target machine.
50 # The rules for compiling them should be in the t-* file for the machine.
51 EXTRA_PARTS = @extra_parts@
52
53 FORCE_EXPLICIT_EH_REGISTRY = @force_explicit_eh_registry@
54
55 extra-parts = libgcc-extra-parts
56
57 # Multilib support variables.
58 MULTISRCTOP =
59 MULTIBUILDTOP =
60 MULTIDIRS =
61 MULTISUBDIR =
62 MULTIDO = true
63 MULTICLEAN = true
64
65 INSTALL = @INSTALL@
66 INSTALL_PROGRAM = @INSTALL_PROGRAM@
67 INSTALL_DATA = @INSTALL_DATA@
68 mkinstalldirs = $(SHELL) $(libgcc_topdir)/mkinstalldirs
69 INSTALL_PARTS = $(EXTRA_PARTS)
70
71 objext = .o
72
73 AR = @AR@
74 AR_FLAGS = rc
75
76 CC = @CC@
77 CFLAGS = @CFLAGS@
78 RANLIB = @RANLIB@
79 LN_S = @LN_S@
80
81 PWD_COMMAND = $${PWDCMD-pwd}
82
83 # Flags to pass to a recursive make.
84 FLAGS_TO_PASS = \
85 "AR=$(AR)" \
86 "AR_FLAGS=$(AR_FLAGS)" \
87 "CC=$(CC)" \
88 "CFLAGS=$(CFLAGS)" \
89 "DESTDIR=$(DESTDIR)" \
90 "EXTRA_OFILES=$(EXTRA_OFILES)" \
91 "HDEFINES=$(HDEFINES)" \
92 "INSTALL=$(INSTALL)" \
93 "INSTALL_DATA=$(INSTALL_DATA)" \
94 "INSTALL_PROGRAM=$(INSTALL_PROGRAM)" \
95 "LDFLAGS=$(LDFLAGS)" \
96 "LOADLIBES=$(LOADLIBES)" \
97 "RANLIB=$(RANLIB)" \
98 "SHELL=$(SHELL)" \
99 "prefix=$(prefix)" \
100 "exec_prefix=$(exec_prefix)" \
101 "libdir=$(libdir)" \
102 "libsubdir=$(libsubdir)" \
103 "tooldir=$(tooldir)"
104
105 # Dependencies for "all" are set later in the file.
106 all: all-multi
107 # Now that we have built all the objects, we need to copy
108 # them back to the GCC directory. Too many things (other
109 # in-tree libraries, and DejaGNU) know about the layout
110 # of the build tree, for now.
111 $(MAKE) install-leaf DESTDIR=$(gcc_objdir) \
112 slibdir= libsubdir= MULTIOSDIR=$(MULTIDIR)
113
114 .PHONY: all-multi
115 all-multi:
116 # If this is the top-level multilib, build all the other
117 # multilibs.
118 @: $(MAKE) ; exec $(MULTIDO) $(FLAGS_TO_PASS) multi-do DO=all
119
120 .PHONY: check installcheck
121 check:
122 installcheck:
123
124 .PHONY: all clean
125
126 clean:
127 -rm -f libgcc_tm.h libgcc.map
128 -rm -f libgcc_tm.stamp stmp-ldirs
129 -rm -f *$(objext)
130 -rm -f *.dep
131 -rm -f *.a
132 -rm -f libunwind$(SHLIB_EXT)
133 -rm -f libgcc_s*
134 @$(MULTICLEAN) multi-clean DO=clean
135 distclean: clean
136 @$(MULTICLEAN) multi-clean DO=distclean
137 -rm -f auto-target.h
138 -rm -f stamp-h
139 -rm -f *~ Makefile config.cache config.status multilib.out
140 -rm -f config.log
141 maintainer-clean realclean: distclean
142
143 Makefile: $(srcdir)/Makefile.in config.status
144 CONFIG_FILES=Makefile CONFIG_HEADERS= $(SHELL) ./config.status
145
146 # Depending on Makefile makes sure that config.status has been re-run
147 # if needed. This prevents problems with parallel builds.
148 auto-target.h: stamp-h ; @true
149 stamp-h: $(srcdir)/config.in config.status Makefile
150 CONFIG_FILES= CONFIG_HEADERS=auto-target.h:$(srcdir)/config.in $(SHELL) ./config.status
151
152 config.status: $(srcdir)/configure $(srcdir)/config.host
153 $(SHELL) ./config.status --recheck
154
155 AUTOCONF = autoconf
156 configure_deps = \
157 $(srcdir)/../config/enable.m4 \
158 $(srcdir)/../config/tls.m4 \
159 $(srcdir)/../config/acx.m4 \
160 $(srcdir)/../config/no-executables.m4 \
161 $(srcdir)/../config/override.m4 \
162 $(srcdir)/../config/dfp.m4 \
163
164 $(srcdir)/configure: @MAINT@ $(srcdir)/configure.ac $(configure_deps)
165 cd $(srcdir) && $(AUTOCONF)
166
167 include $(gcc_objdir)/libgcc.mvars
168
169 # Flags to pass to recursive makes.
170
171 AR_FOR_TARGET = $(AR)
172 AR_FLAGS_FOR_TARGET =
173 AR_CREATE_FOR_TARGET = $(AR_FOR_TARGET) $(AR_FLAGS_FOR_TARGET) rc
174 AR_EXTRACT_FOR_TARGET = $(AR_FOR_TARGET) $(AR_FLAGS_FOR_TARGET) x
175 AWK = @AWK@
176 GCC_FOR_TARGET = $(CC)
177 LIPO = @LIPO@
178 LIPO_FOR_TARGET = $(LIPO)
179 MACHMODE_H = machmode.h mode-classes.def insn-modes.h
180 NM = @NM@
181 NM_FOR_TARGET = $(NM)
182 RANLIB_FOR_TARGET = $(RANLIB)
183 STRIP = @STRIP@
184 STRIP_FOR_TARGET = $(STRIP)
185
186 # Directory in which the compiler finds libraries etc.
187 libsubdir = $(libdir)/gcc/$(host_noncanonical)/$(version)
188 # Used to install the shared libgcc.
189 slibdir = @slibdir@
190 # Maybe used for DLLs on Windows targets.
191 toolexecdir = @toolexecdir@
192 toolexeclibdir = @toolexeclibdir@
193
194 export AR_FOR_TARGET
195 export AR_CREATE_FOR_TARGET
196 export AR_FLAGS_FOR_TARGET
197 export AR_EXTRACT_FOR_TARGET
198 export AWK
199 export DESTDIR
200 export GCC_FOR_TARGET
201 export INCLUDES
202 export INSTALL_DATA
203 export LIB1ASMSRC
204 export LIBGCC2_CFLAGS
205 export LIPO_FOR_TARGET
206 export MACHMODE_H
207 export NM_FOR_TARGET
208 export STRIP_FOR_TARGET
209 export RANLIB_FOR_TARGET
210 export libsubdir
211 export slibdir
212 export toolexecdir
213 export toolexeclibdir
214
215 version := $(shell cat $(srcdir)/../gcc/BASE-VER)
216
217 ifeq ($(decimal_float),yes)
218 ifeq ($(enable_decimal_float),bid)
219 DECNUMINC = -I$(srcdir)/config/libbid -DENABLE_DECIMAL_BID_FORMAT
220 else
221 DECNUMINC = -I$(srcdir)/../libdecnumber/$(enable_decimal_float) \
222 -I$(srcdir)/../libdecnumber
223 endif
224 else
225 DECNUMINC =
226 endif
227
228 # Options to use when compiling libgcc2.a.
229 #
230 LIBGCC2_DEBUG_CFLAGS = -g
231 LIBGCC2_CFLAGS = -O2 $(LIBGCC2_INCLUDES) $(GCC_CFLAGS) $(HOST_LIBGCC2_CFLAGS) \
232 $(LIBGCC2_DEBUG_CFLAGS) -DIN_LIBGCC2 \
233 -fbuilding-libgcc -fno-stack-protector \
234 $(INHIBIT_LIBC_CFLAGS)
235
236 # Additional options to use when compiling libgcc2.a.
237 # Some targets override this to -isystem include
238 LIBGCC2_INCLUDES =
239
240 # Additional target-dependent options for compiling libgcc2.a.
241 HOST_LIBGCC2_CFLAGS =
242
243 PICFLAG = @PICFLAG@
244
245 # Defined in libgcc2.c, included only in the static library.
246 LIB2FUNCS_ST = _eprintf __gcc_bcmp
247
248 # List of functions not to build from libgcc2.c.
249 LIB2FUNCS_EXCLUDE =
250
251 # These might cause a divide overflow trap and so are compiled with
252 # unwinder info.
253 LIB2_DIVMOD_FUNCS = _divdi3 _moddi3 _udivdi3 _umoddi3 _udiv_w_sdiv _udivmoddi4
254
255 # List of extra C and assembler files to add to static and shared libgcc2.
256 # Assembler files should have names ending in `.S'.
257 LIB2ADD =
258
259 # List of extra C and assembler files to add to static libgcc2.
260 # Assembler files should have names ending in `.S'.
261 LIB2ADD_ST =
262
263 # Specify the directories to be searched for header files.
264 # Both . and srcdir are used, in that order,
265 # so that *config.h will be found in the compilation
266 # subdirectory rather than in the source directory.
267 # -I$(@D) and -I$(srcdir)/$(@D) cause the subdirectory of the file
268 # currently being compiled, in both source trees, to be examined as well.
269 INCLUDES = -I. -I$(@D) -I$(gcc_objdir) \
270 -I$(srcdir) -I$(srcdir)/$(@D) -I$(srcdir)/../gcc \
271 -I$(srcdir)/../include $(DECNUMINC)
272
273 # Forcibly remove any profiling-related flags. There is no point
274 # in supporting profiled bootstrap in this library.
275 override CFLAGS := $(filter-out -fprofile-generate -fprofile-use,$(CFLAGS))
276
277 # CFLAGS first is not perfect; normally setting CFLAGS should override any
278 # options in LIBGCC2_CFLAGS. But LIBGCC2_CFLAGS may contain -g0, and CFLAGS
279 # will usually contain -g, so for the moment CFLAGS goes first. We must
280 # include CFLAGS - that's where multilib options live.
281 INTERNAL_CFLAGS = $(CFLAGS) $(LIBGCC2_CFLAGS) $(HOST_LIBGCC2_CFLAGS) \
282 $(INCLUDES) @set_have_cc_tls@ @set_use_emutls@
283
284 # Options to use when compiling crtbegin/end.
285 CRTSTUFF_CFLAGS = -O2 $(GCC_CFLAGS) $(INCLUDES) $(MULTILIB_CFLAGS) -g0 \
286 -finhibit-size-directive -fno-inline -fno-exceptions \
287 -fno-zero-initialized-in-bss -fno-toplevel-reorder -fno-tree-vectorize \
288 -fbuilding-libgcc -fno-stack-protector $(FORCE_EXPLICIT_EH_REGISTRY) \
289 $(INHIBIT_LIBC_CFLAGS)
290
291 # Extra flags to use when compiling crt{begin,end}.o.
292 CRTSTUFF_T_CFLAGS =
293
294 MULTIDIR := $(shell $(CC) $(CFLAGS) -print-multi-directory)
295 MULTIOSDIR := $(shell $(CC) $(CFLAGS) -print-multi-os-directory)
296
297 MULTIOSSUBDIR := $(shell if test $(MULTIOSDIR) != .; then echo /$(MULTIOSDIR); fi)
298 inst_libdir = $(libsubdir)$(MULTISUBDIR)
299 inst_slibdir = $(slibdir)$(MULTIOSSUBDIR)
300
301 gcc_compile_bare = $(CC) $(INTERNAL_CFLAGS)
302 compile_deps = -MT $@ -MD -MP -MF $(basename $@).dep
303 gcc_compile = $(gcc_compile_bare) -o $@ $(compile_deps)
304 gcc_s_compile = $(gcc_compile) -DSHARED
305
306 objects = $(filter %$(objext),$^)
307
308 # Collect any host-specific information from Makefile fragments.
309
310 LIBGCC_VER_GNU_PREFIX = __
311 LIBGCC_VER_FIXEDPOINT_GNU_PREFIX = __
312 LIBGCC_VER_SYMBOLS_PREFIX =
313
314 FPBIT_FUNCS = _pack_sf _unpack_sf _addsub_sf _mul_sf _div_sf \
315 _fpcmp_parts_sf _compare_sf _eq_sf _ne_sf _gt_sf _ge_sf \
316 _lt_sf _le_sf _unord_sf _si_to_sf _sf_to_si _negate_sf _make_sf \
317 _sf_to_df _sf_to_tf _thenan_sf _sf_to_usi _usi_to_sf
318
319 DPBIT_FUNCS = _pack_df _unpack_df _addsub_df _mul_df _div_df \
320 _fpcmp_parts_df _compare_df _eq_df _ne_df _gt_df _ge_df \
321 _lt_df _le_df _unord_df _si_to_df _df_to_si _negate_df _make_df \
322 _df_to_sf _df_to_tf _thenan_df _df_to_usi _usi_to_df
323
324 TPBIT_FUNCS = _pack_tf _unpack_tf _addsub_tf _mul_tf _div_tf \
325 _fpcmp_parts_tf _compare_tf _eq_tf _ne_tf _gt_tf _ge_tf \
326 _lt_tf _le_tf _unord_tf _si_to_tf _tf_to_si _negate_tf _make_tf \
327 _tf_to_df _tf_to_sf _thenan_tf _tf_to_usi _usi_to_tf
328
329 # Additional sources to handle exceptions; overridden by targets as needed.
330 LIB2ADDEH = $(srcdir)/unwind-dw2.c $(srcdir)/unwind-dw2-fde.c \
331 $(srcdir)/unwind-sjlj.c $(srcdir)/unwind-c.c
332 LIB2ADDEHSTATIC = $(LIB2ADDEH)
333 LIB2ADDEHSHARED = $(LIB2ADDEH)
334
335 # nm flags to list global symbols in libgcc object files.
336 SHLIB_NM_FLAGS = -pg
337
338 # Don't build libunwind by default.
339 LIBUNWIND =
340 SHLIBUNWIND_LINK =
341 SHLIBUNWIND_INSTALL =
342
343 tmake_file = @tmake_file@
344 include $(srcdir)/empty.mk $(tmake_file)
345
346 # Collect target defines and headers from config.host.
347 libgcc_tm_defines = @tm_defines@
348 libgcc_tm_file = @tm_file@
349 libgcc_tm.h: libgcc_tm.stamp; @true
350 libgcc_tm.stamp:
351 DEFINES='$(libgcc_tm_defines)' HEADERS='$(libgcc_tm_file)' \
352 $(srcdir)/mkheader.sh > tmp-libgcc_tm.h
353 $(SHELL) $(srcdir)/../move-if-change tmp-libgcc_tm.h libgcc_tm.h
354 echo timestamp > $@
355
356 # Only handle shared libraries if both:
357 # - the user requested them
358 # - we know how to build them
359 ifeq ($(SHLIB_LINK),)
360 enable_shared := no
361 endif
362
363 ifeq ($(enable_shared),yes)
364 iterator = $(srcdir)/empty.mk $(patsubst %,$(srcdir)/shared-object.mk,$(iter-items))
365
366 install-shared = install-shared
367
368 ifneq ($(LIBUNWIND),)
369 install-libunwind = install-libunwind
370 endif
371 endif
372
373 # For -fvisibility=hidden. We need both a -fvisibility=hidden on
374 # the command line, and a #define to prevent libgcc2.h etc from
375 # overriding that with #pragmas.
376 vis_hide = @vis_hide@
377
378 ifneq (,$(vis_hide))
379
380 # If we have -fvisibility=hidden, then we need to generate hide
381 # lists for object files implemented in assembly.
382 ASM_HIDDEN_OP = @asm_hidden_op@
383
384 define gen-hide-list
385 $(NM) -pg $< | \
386 $(AWK) 'NF == 3 && $$2 !~ /^[UN]$$/ && $$3 !~ /.*_compat/ \
387 && $$3 !~ /.*@.*/ \
388 { print "\t$(ASM_HIDDEN_OP)", $$3 }' > $@T
389 mv -f $@T $@
390 endef
391 else
392 gen-hide-list = echo > $@
393 endif
394
395 ifneq ($(enable_shared),yes)
396 iterator = $(srcdir)/empty.mk $(patsubst %,$(srcdir)/static-object.mk,$(iter-items))
397 endif
398
399 LIB2ADD += enable-execute-stack.c
400
401 # While emutls.c has nothing to do with EH, it is in LIB2ADDEH*
402 # instead of LIB2ADD because that's the way to be sure on some targets
403 # (e.g. *-*-darwin*) only one copy of it is linked.
404 LIB2ADDEH += $(srcdir)/emutls.c
405 LIB2ADDEHSTATIC += $(srcdir)/emutls.c
406 LIB2ADDEHSHARED += $(srcdir)/emutls.c
407
408 # Library members defined in libgcc2.c.
409 lib2funcs = _muldi3 _negdi2 _lshrdi3 _ashldi3 _ashrdi3 _cmpdi2 _ucmpdi2 \
410 _clear_cache _trampoline __main _absvsi2 \
411 _absvdi2 _addvsi3 _addvdi3 _subvsi3 _subvdi3 _mulvsi3 _mulvdi3 \
412 _negvsi2 _negvdi2 _ctors _ffssi2 _ffsdi2 _clz _clzsi2 _clzdi2 \
413 _ctzsi2 _ctzdi2 _popcount_tab _popcountsi2 _popcountdi2 \
414 _paritysi2 _paritydi2 _powisf2 _powidf2 _powixf2 _powitf2 \
415 _mulsc3 _muldc3 _mulxc3 _multc3 _divsc3 _divdc3 _divxc3 \
416 _divtc3 _bswapsi2 _bswapdi2 _clrsbsi2 _clrsbdi2
417
418 # The floating-point conversion routines that involve a single-word integer.
419 # XX stands for the integer mode.
420 swfloatfuncs = $(patsubst %,_fixuns%XX,sf df xf)
421
422 # Likewise double-word routines.
423 dwfloatfuncs = $(patsubst %,_fix%XX,sf df xf tf) \
424 $(patsubst %,_fixuns%XX,sf df xf tf) \
425 $(patsubst %,_floatXX%,sf df xf tf) \
426 $(patsubst %,_floatunXX%,sf df xf tf)
427
428 ifeq ($(LIB2_SIDITI_CONV_FUNCS),)
429 lib2funcs += $(subst XX,si,$(swfloatfuncs))
430 lib2funcs += $(subst XX,di,$(dwfloatfuncs))
431 endif
432
433 # These might cause a divide overflow trap and so are compiled with
434 # unwinder info.
435 LIB2_DIVMOD_FUNCS = _divdi3 _moddi3 _udivdi3 _umoddi3 _udiv_w_sdiv _udivmoddi4
436
437 # Remove any objects from lib2funcs and LIB2_DIVMOD_FUNCS that are
438 # defined as optimized assembly code in LIB1ASMFUNCS or as C code
439 # in LIB2FUNCS_EXCLUDE.
440 lib2funcs := $(filter-out $(LIB2FUNCS_EXCLUDE) $(LIB1ASMFUNCS),$(lib2funcs))
441 LIB2_DIVMOD_FUNCS := $(filter-out $(LIB2FUNCS_EXCLUDE) $(LIB1ASMFUNCS), \
442 $(LIB2_DIVMOD_FUNCS))
443
444 # Build "libgcc1" (assembly) components.
445
446 lib1asmfuncs-o = $(patsubst %,%$(objext),$(LIB1ASMFUNCS))
447 $(lib1asmfuncs-o): %$(objext): $(srcdir)/config/$(LIB1ASMSRC) %.vis
448 $(gcc_compile) -DL$* -xassembler-with-cpp -c $< -include $*.vis
449 $(patsubst %,%.vis,$(LIB1ASMFUNCS)): %.vis: %_s$(objext)
450 $(gen-hide-list)
451 libgcc-objects += $(lib1asmfuncs-o)
452
453 lib1asmfuncs-s-o = $(patsubst %,%_s$(objext),$(LIB1ASMFUNCS))
454 $(lib1asmfuncs-s-o): %_s$(objext): $(srcdir)/config/$(LIB1ASMSRC)
455 $(gcc_s_compile) -DL$* -xassembler-with-cpp -c $<
456 ifeq ($(enable_shared),yes)
457
458 libgcc-s-objects += $(lib1asmfuncs-s-o)
459
460 endif
461
462 # Build lib2funcs. For the static library also include LIB2FUNCS_ST.
463 lib2funcs-o = $(patsubst %,%$(objext),$(lib2funcs) $(LIB2FUNCS_ST))
464 $(lib2funcs-o): %$(objext): $(srcdir)/libgcc2.c
465 $(gcc_compile) -DL$* -c $< $(vis_hide)
466 libgcc-objects += $(lib2funcs-o)
467
468 ifeq ($(enable_shared),yes)
469 lib2funcs-s-o = $(patsubst %,%_s$(objext),$(lib2funcs))
470 $(lib2funcs-s-o): %_s$(objext): $(srcdir)/libgcc2.c
471 $(gcc_s_compile) -DL$* -c $<
472 libgcc-s-objects += $(lib2funcs-s-o)
473 endif
474
475 ifneq ($(LIB2_SIDITI_CONV_FUNCS),)
476 # Build libgcc2.c for each conversion function, with a specific
477 # L<func> definition and LIBGCC2_UNITS_PER_WORD setting. The DImode
478 # functions are built with a wordsize of 4; the TImode functions are
479 # built with the same labels, but a wordsize of 8.
480
481 sifuncs := $(filter-out $(LIB2FUNCS_EXCLUDE),$(subst XX,si,$(swfloatfuncs)))
482 difuncs := $(filter-out $(LIB2FUNCS_EXCLUDE),$(subst XX,di,$(dwfloatfuncs)))
483 tifuncs := $(filter-out $(LIB2FUNCS_EXCLUDE),$(subst XX,ti,$(dwfloatfuncs)))
484
485 iter-items := $(sifuncs) $(difuncs) $(tifuncs)
486 iter-labels := $(sifuncs) $(difuncs) $(difuncs)
487 iter-sizes := $(patsubst %,4,$(sifuncs) $(difuncs)) $(patsubst %,8,$(tifuncs))
488
489 include $(srcdir)/empty.mk $(patsubst %,$(srcdir)/siditi-object.mk,$(iter-items))
490
491 libgcc-objects += $(patsubst %,%$(objext),$(sifuncs) $(difuncs) $(tifuncs))
492 ifeq ($(enable_shared),yes)
493 libgcc-s-objects += $(patsubst %,%_s$(objext),$(sifuncs) $(difuncs) $(tifuncs))
494 endif
495 endif
496
497 ifeq ($(LIB2_DIVMOD_EXCEPTION_FLAGS),)
498 # Provide default flags for compiling divmod functions, if they haven't been
499 # set already by a target-specific Makefile fragment.
500 LIB2_DIVMOD_EXCEPTION_FLAGS := -fexceptions -fnon-call-exceptions
501 endif
502
503 # Build LIB2_DIVMOD_FUNCS.
504 lib2-divmod-o = $(patsubst %,%$(objext),$(LIB2_DIVMOD_FUNCS))
505 $(lib2-divmod-o): %$(objext): $(srcdir)/libgcc2.c
506 $(gcc_compile) -DL$* -c $< \
507 $(LIB2_DIVMOD_EXCEPTION_FLAGS) $(vis_hide)
508 libgcc-objects += $(lib2-divmod-o)
509
510 ifeq ($(enable_shared),yes)
511 lib2-divmod-s-o = $(patsubst %,%_s$(objext),$(LIB2_DIVMOD_FUNCS))
512 $(lib2-divmod-s-o): %_s$(objext): $(srcdir)/libgcc2.c
513 $(gcc_s_compile) -DL$* -c $< \
514 $(LIB2_DIVMOD_EXCEPTION_FLAGS)
515 libgcc-s-objects += $(lib2-divmod-s-o)
516 endif
517
518 ifeq ($(TPBIT),)
519 # _sf_to_tf and _df_to_tf require tp-bit.c being compiled in.
520 FPBIT_FUNCS := $(filter-out _sf_to_tf,$(FPBIT_FUNCS))
521 DPBIT_FUNCS := $(filter-out _df_to_tf,$(DPBIT_FUNCS))
522 endif
523
524 FPBIT_FUNCS := $(filter-out $(LIB2FUNCS_EXCLUDE),$(FPBIT_FUNCS))
525 DPBIT_FUNCS := $(filter-out $(LIB2FUNCS_EXCLUDE),$(DPBIT_FUNCS))
526 TPBIT_FUNCS := $(filter-out $(LIB2FUNCS_EXCLUDE),$(TPBIT_FUNCS))
527
528 fpbit-src := $(srcdir)/fp-bit.c
529
530 # Build FPBIT.
531 ifneq ($(FPBIT),)
532 fpbit-o = $(patsubst %,%$(objext),$(FPBIT_FUNCS))
533 $(fpbit-o): %$(objext): $(fpbit-src)
534 $(gcc_compile) -DFINE_GRAINED_LIBRARIES -DL$* -DFLOAT $(FPBIT_CFLAGS) -c $< $(vis_hide)
535 libgcc-objects += $(fpbit-o)
536
537 ifeq ($(enable_shared),yes)
538 fpbit-s-o = $(patsubst %,%_s$(objext),$(FPBIT_FUNCS))
539 $(fpbit-s-o): %_s$(objext): $(fpbit-src)
540 $(gcc_s_compile) -DFINE_GRAINED_LIBRARIES -DL$* -DFLOAT $(FPBIT_CFLAGS) -c $<
541 libgcc-s-objects += $(fpbit-s-o)
542 endif
543 endif
544
545 # Build DPBIT.
546 ifneq ($(DPBIT),)
547 dpbit-o = $(patsubst %,%$(objext),$(DPBIT_FUNCS))
548 $(dpbit-o): %$(objext): $(fpbit-src)
549 $(gcc_compile) -DFINE_GRAINED_LIBRARIES -DL$* $(DPBIT_CFLAGS) -c $< $(vis_hide)
550 libgcc-objects += $(dpbit-o)
551
552 ifeq ($(enable_shared),yes)
553 dpbit-s-o = $(patsubst %,%_s$(objext),$(DPBIT_FUNCS))
554 $(dpbit-s-o): %_s$(objext): $(fpbit-src)
555 $(gcc_s_compile) -DFINE_GRAINED_LIBRARIES -DL$* $(DPBIT_CFLAGS) -c $<
556 libgcc-s-objects += $(dpbit-s-o)
557 endif
558 endif
559
560 # Build TPBIT.
561 ifneq ($(TPBIT),)
562 tpbit-o = $(patsubst %,%$(objext),$(TPBIT_FUNCS))
563 $(tpbit-o): %$(objext): $(fpbit-src)
564 $(gcc_compile) -DFINE_GRAINED_LIBRARIES -DL$* -DTFLOAT $(TPBIT_CFLAGS) -c $< $(vis_hide)
565 libgcc-objects += $(tpbit-o)
566
567 ifeq ($(enable_shared),yes)
568 tpbit-s-o = $(patsubst %,%_s$(objext),$(TPBIT_FUNCS))
569 $(tpbit-s-o): %_s$(objext): $(fpbit-src)
570 $(gcc_s_compile) -DFINE_GRAINED_LIBRARIES -DL$* -DTFLOAT $(TPBIT_CFLAGS) -c $<
571 libgcc-s-objects += $(tpbit-s-o)
572 endif
573 endif
574
575 # Build decimal floating point support.
576 ifeq ($(decimal_float),yes)
577
578 # If $DFP_ENABLE is set, then we want all data type sizes.
579 ifneq ($(DFP_ENABLE),)
580 D32PBIT = 1
581 D64PBIT = 1
582 D128PBIT = 1
583 endif
584
585 dfp-filenames =
586 ifneq ($(D32PBIT)$(D64PBIT)$(D128PBIT),)
587 ifeq ($(enable_decimal_float),bid)
588 dfp-filenames += bid_decimal_globals bid_decimal_data \
589 bid_binarydecimal bid_convert_data \
590 _isinfd32 _isinfd64 _isinfd128 bid64_noncomp \
591 bid128_noncomp bid128_fma bid_round bid_from_int \
592 bid64_add bid128_add bid64_div bid128_div \
593 bid64_mul bid128_mul bid64_compare bid128_compare \
594 bid128 bid32_to_bid64 bid32_to_bid128 bid64_to_bid128 \
595 bid64_to_int32 bid64_to_int64 \
596 bid64_to_uint32 bid64_to_uint64 \
597 bid128_to_int32 bid128_to_int64 \
598 bid128_to_uint32 bid128_to_uint64
599 else
600 dfp-filenames += decContext decNumber decExcept decRound decLibrary decDouble decPacked decQuad decSingle
601 endif
602 endif
603
604 dfp-objects = $(patsubst %,%$(objext),$(dfp-filenames))
605 ifeq ($(enable_decimal_float),bid)
606 $(dfp-objects): %$(objext): $(srcdir)/config/libbid/%.c
607 else
608 $(dfp-objects): %$(objext): $(srcdir)/../libdecnumber/%.c
609 endif
610 $(gcc_compile) -c $<
611 libgcc-objects += $(dfp-objects)
612
613 decbits-filenames =
614 ifneq ($(enable_decimal_float),bid)
615 ifneq ($(D32PBIT),)
616 decbits-filenames += decimal32
617 endif
618
619 ifneq ($(D64PBIT),)
620 decbits-filenames += decimal64
621 endif
622
623 ifneq ($(D128PBIT),)
624 decbits-filenames += decimal128
625 endif
626 endif
627
628 decbits-objects = $(patsubst %,%$(objext),$(decbits-filenames))
629 ifeq ($(enable_decimal_float),bid)
630 $(decbits-objects): %$(objext): $(srcdir)/config/libbid/%.c
631 else
632 $(decbits-objects): %$(objext): $(srcdir)/../libdecnumber/$(enable_decimal_float)/%.c
633 endif
634 $(gcc_compile) -c $<
635 libgcc-objects += $(decbits-objects)
636
637 # Next build individual support functions.
638 D32PBIT_FUNCS = _addsub_sd _div_sd _mul_sd _plus_sd _minus_sd \
639 _eq_sd _ne_sd _lt_sd _gt_sd _le_sd _ge_sd \
640 _sd_to_si _sd_to_di _sd_to_usi _sd_to_udi \
641 _si_to_sd _di_to_sd _usi_to_sd _udi_to_sd \
642 _sd_to_sf _sd_to_df _sd_to_xf _sd_to_tf \
643 _sf_to_sd _df_to_sd _xf_to_sd _tf_to_sd \
644 _sd_to_dd _sd_to_td _unord_sd _conv_sd
645
646 D64PBIT_FUNCS = _addsub_dd _div_dd _mul_dd _plus_dd _minus_dd \
647 _eq_dd _ne_dd _lt_dd _gt_dd _le_dd _ge_dd \
648 _dd_to_si _dd_to_di _dd_to_usi _dd_to_udi \
649 _si_to_dd _di_to_dd _usi_to_dd _udi_to_dd \
650 _dd_to_sf _dd_to_df _dd_to_xf _dd_to_tf \
651 _sf_to_dd _df_to_dd _xf_to_dd _tf_to_dd \
652 _dd_to_sd _dd_to_td _unord_dd _conv_dd
653
654 D128PBIT_FUNCS = _addsub_td _div_td _mul_td _plus_td _minus_td \
655 _eq_td _ne_td _lt_td _gt_td _le_td _ge_td \
656 _td_to_si _td_to_di _td_to_usi _td_to_udi \
657 _si_to_td _di_to_td _usi_to_td _udi_to_td \
658 _td_to_sf _td_to_df _td_to_xf _td_to_tf \
659 _sf_to_td _df_to_td _xf_to_td _tf_to_td \
660 _td_to_sd _td_to_dd _unord_td _conv_td
661
662 ifeq ($(enable_decimal_float),bid)
663 ifneq ($(D32PBIT),)
664 D32PBIT_FUNCS:=$(filter-out _plus_sd _minus_sd _conv_sd, $(D32PBIT_FUNCS))
665 endif
666
667 ifneq ($(D64PBIT),)
668 D64PBIT_FUNCS:=$(filter-out _plus_dd _minus_dd _conv_dd, $(D64PBIT_FUNCS))
669 endif
670
671 ifneq ($(D128PBIT),)
672 D128PBIT_FUNCS:=$(filter-out _plus_td _minus_td _conv_td, $(D128PBIT_FUNCS))
673 endif
674 endif
675
676 ifneq ($(D32PBIT),)
677 d32pbit-o = $(patsubst %,%$(objext),$(D32PBIT_FUNCS))
678 ifeq ($(enable_decimal_float),bid)
679 $(d32pbit-o): %$(objext): $(srcdir)/config/libbid/%.c
680 else
681 $(d32pbit-o): %$(objext): $(srcdir)/dfp-bit.c
682 endif
683 $(gcc_compile) -DFINE_GRAINED_LIBRARIES -DL$* -DWIDTH=32 -c $<
684 libgcc-objects += $(d32pbit-o)
685 endif
686
687 ifneq ($(D64PBIT),)
688 d64pbit-o = $(patsubst %,%$(objext),$(D64PBIT_FUNCS))
689 ifeq ($(enable_decimal_float),bid)
690 $(d64pbit-o): %$(objext): $(srcdir)/config/libbid/%.c
691 else
692 $(d64pbit-o): %$(objext): $(srcdir)/dfp-bit.c
693 endif
694 $(gcc_compile) -DFINE_GRAINED_LIBRARIES -DL$* -DWIDTH=64 -c $<
695 libgcc-objects += $(d64pbit-o)
696 endif
697
698 ifneq ($(D128PBIT),)
699 d128pbit-o = $(patsubst %,%$(objext),$(D128PBIT_FUNCS))
700 ifeq ($(enable_decimal_float),bid)
701 $(d128pbit-o): %$(objext): $(srcdir)/config/libbid/%.c
702 else
703 $(d128pbit-o): %$(objext): $(srcdir)/dfp-bit.c
704 endif
705 $(gcc_compile) -DFINE_GRAINED_LIBRARIES -DL$* -DWIDTH=128 -c $<
706 libgcc-objects += $(d128pbit-o)
707 endif
708
709 endif
710
711 ifeq ($(SYNC),yes)
712 libgcc-sync-size-funcs := $(foreach op, add sub or and xor nand, \
713 sync_fetch_and_$(op) \
714 sync_$(op)_and_fetch) \
715 sync_bool_compare_and_swap \
716 sync_val_compare_and_swap \
717 sync_lock_test_and_set
718
719 libgcc-sync-size-funcs := $(foreach prefix, $(libgcc-sync-size-funcs), \
720 $(foreach suffix, 1 2 4 8 16, \
721 $(prefix)_$(suffix)))
722
723 libgcc-sync-size-funcs-o = $(patsubst %,%$(objext),$(libgcc-sync-size-funcs))
724 $(libgcc-sync-size-funcs-o): %$(objext): $(srcdir)/sync.c
725 $(gcc_compile) $(SYNC_CFLAGS) \
726 -DFN=`echo "$*" | sed 's/_[^_]*$$//'` \
727 -DSIZE=`echo "$*" | sed 's/.*_//'` \
728 -c $< $(vis_hide)
729 libgcc-objects += $(libgcc-sync-size-funcs-o)
730
731 libgcc-sync-funcs := sync_synchronize
732
733 libgcc-sync-funcs-o = $(patsubst %,%$(objext),$(libgcc-sync-funcs))
734 $(libgcc-sync-funcs-o): %$(objext): $(srcdir)/sync.c
735 $(gcc_compile) $(SYNC_CFLAGS) \
736 -DL$* \
737 -c $< $(vis_hide)
738 libgcc-objects += $(libgcc-sync-funcs-o)
739
740 ifeq ($(enable_shared),yes)
741 libgcc-sync-size-funcs-s-o = $(patsubst %,%_s$(objext), \
742 $(libgcc-sync-size-funcs))
743 $(libgcc-sync-size-funcs-s-o): %_s$(objext): $(srcdir)/sync.c
744 $(gcc_s_compile) $(SYNC_CFLAGS) \
745 -DFN=`echo "$*" | sed 's/_[^_]*$$//'` \
746 -DSIZE=`echo "$*" | sed 's/.*_//'` \
747 -c $<
748 libgcc-s-objects += $(libgcc-sync-size-funcs-s-o)
749
750 libgcc-sync-funcs-s-o = $(patsubst %,%_s$(objext),$(libgcc-sync-funcs))
751 $(libgcc-sync-funcs-s-o): %_s$(objext): $(srcdir)/sync.c
752 $(gcc_s_compile) $(SYNC_CFLAGS) \
753 -DL$* \
754 -c $<
755 libgcc-s-objects += $(libgcc-sync-funcs-s-o)
756 endif
757 endif
758
759 # Build fixed-point support.
760 ifeq ($(fixed_point),yes)
761
762 # Generate permutations of function name and mode
763 fixed-labels := $(shell $(SHELL) $(srcdir)/gen-fixed.sh arith labels)
764 fixed-funcs := $(shell $(SHELL) $(srcdir)/gen-fixed.sh arith funcs)
765 fixed-modes := $(shell $(SHELL) $(srcdir)/gen-fixed.sh arith modes)
766
767 # Generate the rules for each arithmetic function
768 iter-items := $(fixed-funcs)
769 iter-labels := $(fixed-labels)
770 iter-from := $(fixed-modes)
771 iter-to := $(fixed-modes)
772 include $(srcdir)/empty.mk $(patsubst %,$(srcdir)/fixed-obj.mk,$(iter-items))
773
774 # Add arithmetic functions to list of objects to be built
775 libgcc-objects += $(patsubst %,%$(objext),$(filter-out $(LIB2FUNCS_EXCLUDE),$(fixed-funcs)))
776 ifeq ($(enable_shared),yes)
777 libgcc-s-objects += $(patsubst %,%_s$(objext),$(filter-out $(LIB2FUNCS_EXCLUDE),$(fixed-funcs)))
778 endif
779
780 # Convert from or to fractional
781 fixed-conv-funcs := $(shell $(SHELL) $(srcdir)/gen-fixed.sh conv funcs)
782 fixed-conv-labels := $(shell $(SHELL) $(srcdir)/gen-fixed.sh conv labels)
783 fixed-conv-from := $(shell $(SHELL) $(srcdir)/gen-fixed.sh conv from)
784 fixed-conv-to := $(shell $(SHELL) $(srcdir)/gen-fixed.sh conv to)
785
786 # Generate the make rules for each conversion function
787 iter-items := $(fixed-conv-funcs)
788 iter-labels := $(fixed-conv-labels)
789 iter-from := $(fixed-conv-from)
790 iter-to := $(fixed-conv-to)
791 include $(srcdir)/empty.mk $(patsubst %,$(srcdir)/fixed-obj.mk,$(iter-items))
792
793 # Add conversion functions to list of objects to be built
794 libgcc-objects += $(patsubst %,%$(objext),$(filter-out $(LIB2FUNCS_EXCLUDE),$(fixed-conv-funcs)))
795 ifeq ($(enable_shared),yes)
796 libgcc-s-objects += $(patsubst %,%_s$(objext),$(filter-out $(LIB2FUNCS_EXCLUDE),$(fixed-conv-funcs)))
797 endif
798
799 endif
800
801 # Build LIB2ADD and LIB2ADD_ST.
802 ifneq ($(filter-out %.c %.S %.asm,$(LIB2ADD) $(LIB2ADD_ST)),)
803 $(error Unsupported files in LIB2ADD or LIB2ADD_ST.)
804 endif
805
806 libgcc-objects += $(addsuffix $(objext),$(basename $(notdir $(LIB2ADD))))
807 libgcc-objects += $(addsuffix $(objext),$(basename $(notdir $(LIB2ADD_ST))))
808
809 c_flags :=
810 iter-items := $(LIB2ADD) $(LIB2ADD_ST)
811 include $(iterator)
812
813 ifeq ($(enable_shared),yes)
814 libgcc-s-objects += $(addsuffix _s$(objext),$(basename $(notdir $(LIB2ADD))))
815 endif
816
817 # Build LIB2ADDEH, LIB2ADDEHSTATIC, and LIB2ADDEHSHARED. If we don't have
818 # libgcc_eh.a, only LIB2ADDEH matters. If we do, only LIB2ADDEHSTATIC and
819 # LIB2ADDEHSHARED matter. (Usually all three are identical.)
820
821 c_flags := -fexceptions
822
823 ifeq ($(enable_shared),yes)
824
825 libgcc-eh-objects += $(addsuffix $(objext),$(basename $(notdir $(LIB2ADDEHSTATIC))))
826 libgcc-s-objects += $(addsuffix _s$(objext),$(basename $(notdir $(LIB2ADDEHSHARED))))
827
828 iter-items := $(sort $(LIB2ADDEHSTATIC) $(LIB2ADDEHSHARED))
829 include $(iterator)
830
831 else
832 # Not shared. LIB2ADDEH are added to libgcc.a.
833
834 libgcc-objects += $(addsuffix $(objext),$(basename $(notdir $(LIB2ADDEH))))
835
836 iter-items := $(LIB2ADDEH)
837 include $(iterator)
838
839 endif
840
841 # Build LIBUNWIND. Use -fno-exceptions so that the unwind library does
842 # not generate calls to __gcc_personality_v0.
843
844 c_flags := -fno-exceptions
845
846 libunwind-objects += $(addsuffix $(objext),$(basename $(notdir $(LIBUNWIND))))
847
848 ifeq ($(enable_shared),yes)
849 libunwind-s-objects += $(addsuffix _s$(objext),$(basename $(notdir $(LIBUNWIND))))
850 endif
851
852 iter-items := $(LIBUNWIND)
853 include $(iterator)
854
855 # Build libgcov components.
856
857 LIBGCOV_MERGE = _gcov_merge_add _gcov_merge_single _gcov_merge_delta \
858 _gcov_merge_ior _gcov_merge_time_profile _gcov_merge_icall_topn
859 LIBGCOV_PROFILER = _gcov_interval_profiler _gcov_pow2_profiler \
860 _gcov_one_value_profiler _gcov_indirect_call_profiler \
861 _gcov_average_profiler _gcov_ior_profiler \
862 _gcov_indirect_call_profiler_v2 _gcov_time_profiler \
863 _gcov_indirect_call_topn_profiler
864 LIBGCOV_INTERFACE = _gcov_dump _gcov_flush _gcov_fork \
865 _gcov_execl _gcov_execlp \
866 _gcov_execle _gcov_execv _gcov_execvp _gcov_execve _gcov_reset
867 LIBGCOV_DRIVER = _gcov
868
869 libgcov-merge-objects = $(patsubst %,%$(objext),$(LIBGCOV_MERGE))
870 libgcov-profiler-objects = $(patsubst %,%$(objext),$(LIBGCOV_PROFILER))
871 libgcov-interface-objects = $(patsubst %,%$(objext),$(LIBGCOV_INTERFACE))
872 libgcov-driver-objects = $(patsubst %,%$(objext),$(LIBGCOV_DRIVER))
873 libgcov-objects = $(libgcov-merge-objects) $(libgcov-profiler-objects) \
874 $(libgcov-interface-objects) $(libgcov-driver-objects)
875
876 $(libgcov-merge-objects): %$(objext): $(srcdir)/libgcov-merge.c $(srcdir)/libgcov.h
877 $(gcc_compile) -DL$* -c $(srcdir)/libgcov-merge.c
878 $(libgcov-profiler-objects): %$(objext): $(srcdir)/libgcov-profiler.c $(srcdir)/libgcov.h
879 $(gcc_compile) -DL$* -c $(srcdir)/libgcov-profiler.c
880 $(libgcov-interface-objects): %$(objext): $(srcdir)/libgcov-interface.c $(srcdir)/libgcov.h
881 $(gcc_compile) -DL$* -c $(srcdir)/libgcov-interface.c
882 $(libgcov-driver-objects): %$(objext): $(srcdir)/libgcov-driver.c \
883 $(srcdir)/libgcov-driver-system.c $(srcdir)/libgcov.h
884 $(gcc_compile) -DL$* -c $(srcdir)/libgcov-driver.c
885
886
887 # Static libraries.
888 libgcc.a: $(libgcc-objects)
889 libgcov.a: $(libgcov-objects)
890 libunwind.a: $(libunwind-objects)
891 libgcc_eh.a: $(libgcc-eh-objects)
892
893 libgcc.a libgcov.a libunwind.a libgcc_eh.a:
894 -rm -f $@
895
896 objects="$(objects)"; \
897 if test -z "$$objects"; then \
898 echo 'int __libgcc_eh_dummy;' > eh_dummy.c; \
899 $(gcc_compile_bare) $(vis_hide) -c eh_dummy.c \
900 -o eh_dummy$(objext); \
901 objects=eh_dummy$(objext); \
902 fi; \
903 $(AR_CREATE_FOR_TARGET) $@ $$objects
904
905 $(RANLIB) $@
906
907 all: libgcc.a libgcov.a
908
909 ifneq ($(LIBUNWIND),)
910 all: libunwind.a
911 libgcc_s$(SHLIB_EXT): libunwind$(SHLIB_EXT)
912 endif
913
914 ifeq ($(enable_shared),yes)
915 all: libgcc_eh.a libgcc_s$(SHLIB_EXT)
916 ifneq ($(LIBUNWIND),)
917 all: libunwind$(SHLIB_EXT)
918 endif
919 endif
920
921 ifeq ($(enable_shared),yes)
922
923 # Map-file generation.
924 ifneq ($(SHLIB_MKMAP),)
925 libgcc.map: $(SHLIB_MKMAP) $(SHLIB_MAPFILES) $(libgcc-s-objects)
926 { $(NM) $(SHLIB_NM_FLAGS) $(libgcc-s-objects); echo %%; \
927 cat $(SHLIB_MAPFILES) \
928 | sed -e '/^[ ]*#/d' \
929 -e 's/^%\(if\|else\|elif\|endif\|define\)/#\1/' \
930 | $(gcc_compile_bare) -E -xassembler-with-cpp -; \
931 } | $(AWK) -f $(SHLIB_MKMAP) $(SHLIB_MKMAP_OPTS) > tmp-$@
932 mv tmp-$@ $@
933 libgcc_s$(SHLIB_EXT): libgcc.map
934 mapfile = libgcc.map
935 endif
936
937 libgcc-std.ver: $(srcdir)/libgcc-std.ver.in
938 sed -e 's/__PFX__/$(LIBGCC_VER_GNU_PREFIX)/g' \
939 -e 's/__FIXPTPFX__/$(LIBGCC_VER_FIXEDPOINT_GNU_PREFIX)/g' < $< > $@
940
941 libgcc_s$(SHLIB_EXT): $(libgcc-s-objects) $(extra-parts) libgcc.a
942 # @multilib_flags@ is still needed because this may use
943 # $(GCC_FOR_TARGET) and $(LIBGCC2_CFLAGS) directly.
944 # @multilib_dir@ is not really necessary, but sometimes it has
945 # more uses than just a directory name.
946 $(mkinstalldirs) $(MULTIDIR)
947 $(subst @multilib_flags@,$(CFLAGS) -B./,$(subst \
948 @multilib_dir@,$(MULTIDIR),$(subst \
949 @shlib_objs@,$(objects) libgcc.a,$(subst \
950 @shlib_base_name@,libgcc_s,$(subst \
951 @shlib_map_file@,$(mapfile),$(subst \
952 @shlib_slibdir_qual@,$(MULTIOSSUBDIR),$(subst \
953 @shlib_slibdir@,$(shlib_slibdir),$(SHLIB_LINK))))))))
954
955 libunwind$(SHLIB_EXT): $(libunwind-s-objects) $(extra-parts)
956 # @multilib_flags@ is still needed because this may use
957 # $(GCC_FOR_TARGET) and $(LIBGCC2_CFLAGS) directly.
958 # @multilib_dir@ is not really necessary, but sometimes it has
959 # more uses than just a directory name.
960 $(mkinstalldirs) $(MULTIDIR)
961 $(subst @multilib_flags@,$(CFLAGS) -B./,$(subst \
962 @multilib_dir@,$(MULTIDIR),$(subst \
963 @shlib_objs@,$(objects),$(subst \
964 @shlib_base_name@,libunwind,$(subst \
965 @shlib_slibdir_qual@,$(MULTIOSSUBDIR),$(SHLIBUNWIND_LINK))))))
966
967 endif
968
969 # Build the standard GCC startfiles and endfiles.
970 ALL_CRT_CFLAGS = $(CFLAGS) $(CRTSTUFF_CFLAGS) $(INCLUDES)
971 crt_compile = $(CC) $(ALL_CRT_CFLAGS) -o $@ $(compile_deps)
972
973 ifeq ($(CUSTOM_CRTSTUFF),)
974 # Compile two additional files that are linked with every program
975 # linked using GCC on systems using COFF or ELF, for the sake of C++
976 # constructors.
977 crtbegin$(objext): $(srcdir)/crtstuff.c
978 $(crt_compile) $(CRTSTUFF_T_CFLAGS) -c $< -DCRT_BEGIN
979
980 crtend$(objext): $(srcdir)/crtstuff.c
981 $(crt_compile) $(CRTSTUFF_T_CFLAGS) -c $< -DCRT_END
982
983 # These are versions of crtbegin and crtend for shared libraries.
984 crtbeginS$(objext): $(srcdir)/crtstuff.c
985 $(crt_compile) $(CRTSTUFF_T_CFLAGS_S) -c $< -DCRT_BEGIN -DCRTSTUFFS_O
986
987 crtendS$(objext): $(srcdir)/crtstuff.c
988 $(crt_compile) $(CRTSTUFF_T_CFLAGS_S) -c $< -DCRT_END -DCRTSTUFFS_O
989
990 # This is a version of crtbegin for -static links.
991 crtbeginT$(objext): $(srcdir)/crtstuff.c
992 $(crt_compile) $(CRTSTUFF_T_CFLAGS) -c $< -DCRT_BEGIN -DCRTSTUFFT_O
993
994 ifeq ($(enable_vtable_verify),yes)
995 # These are used in vtable verification; see comments in source files for
996 # more details.
997 vtv_start$(objext): $(srcdir)/vtv_start.c
998 $(crt_compile) $(CRTSTUFF_T_CFLAGS_S) -c $(srcdir)/vtv_start.c
999
1000 vtv_end$(objext): $(srcdir)/vtv_end.c
1001 $(crt_compile) $(CRTSTUFF_T_CFLAGS_S) -c $(srcdir)/vtv_end.c
1002
1003 vtv_start_preinit$(objext): $(srcdir)/vtv_start_preinit.c
1004 $(crt_compile) $(CRTSTUFF_T_CFLAGS_S) -c $(srcdir)/vtv_start_preinit.c
1005
1006 vtv_end_preinit$(objext): $(srcdir)/vtv_end_preinit.c
1007 $(crt_compile) $(CRTSTUFF_T_CFLAGS_S) -c $(srcdir)/vtv_end_preinit.c
1008 endif
1009 endif
1010
1011 ifeq ($(CUSTOM_CRTIN),)
1012 # -x assembler-with-cpp is only needed on case-insensitive filesystem.
1013 crti$(objext): $(srcdir)/config/$(cpu_type)/crti.S
1014 $(crt_compile) -c -x assembler-with-cpp $<
1015
1016 crtn$(objext): $(srcdir)/config/$(cpu_type)/crtn.S
1017 $(crt_compile) -c -x assembler-with-cpp $<
1018 endif
1019
1020 # Build extra startfiles in the libgcc directory.
1021 .PHONY: libgcc-extra-parts
1022 libgcc-extra-parts: $(EXTRA_PARTS)
1023
1024 # Early copyback; see "all" above for the rationale. The
1025 # early copy is necessary so that the gcc -B options find
1026 # the right startup files when linking shared libgcc.
1027 $(mkinstalldirs) $(gcc_objdir)$(MULTISUBDIR)
1028 parts="$(EXTRA_PARTS)"; \
1029 for file in $$parts; do \
1030 rm -f $(gcc_objdir)$(MULTISUBDIR)/$$file; \
1031 $(INSTALL_DATA) $$file $(gcc_objdir)$(MULTISUBDIR)/; \
1032 case $$file in \
1033 *.a) \
1034 $(RANLIB) $(gcc_objdir)$(MULTISUBDIR)/$$file ;; \
1035 esac; \
1036 done
1037
1038 all: $(extra-parts)
1039
1040 $(libgcc-objects) $(libgcc-s-objects) $(libgcc-eh-objects) \
1041 $(libgcov-objects) \
1042 $(libunwind-objects) $(libunwind-s-objects) \
1043 $(EXTRA_PARTS): libgcc_tm.h
1044
1045 # Copy unwind.h to the place where gcc will look for it at build-time
1046 install-unwind_h-forbuild:
1047 dest=$(gcc_objdir)/include/tmp$$$$-unwind.h; \
1048 cp unwind.h $$dest; \
1049 chmod a+r $$dest; \
1050 sh $(srcdir)/../move-if-change $$dest $(gcc_objdir)/include/unwind.h
1051
1052 # Copy unwind.h to the place where gcc will look at run-time, once installed
1053 #
1054 # This is redundant with the internal copy above when using a regular toplevel
1055 # "install" target, because gcc's install will copy to the destination as well.
1056 #
1057 # This is however useful for "install-no-fixincludes" case, when only the gcc
1058 # internal headers are copied by gcc's install.
1059 install-unwind_h:
1060 $(mkinstalldirs) $(DESTDIR)$(libsubdir)/include
1061 $(INSTALL_DATA) unwind.h $(DESTDIR)$(libsubdir)/include
1062
1063 all: install-unwind_h-forbuild
1064
1065 # Documentation targets (empty).
1066 .PHONY: info html dvi pdf install-info install-html install-pdf
1067
1068 info:
1069 install-info:
1070 html:
1071 install-html:
1072 dvi:
1073 pdf:
1074 install-pdf:
1075
1076 # Install rules. These do not depend on "all", so that they can be invoked
1077 # recursively from it.
1078 install-libunwind:
1079 $(mkinstalldirs) $(DESTDIR)$(inst_slibdir)
1080
1081 # NOTE: Maybe this should go into $(inst_libdir), but this
1082 # is where the old mklibgcc.in put it.
1083 $(INSTALL_DATA) libunwind.a $(DESTDIR)$(inst_slibdir)/
1084 chmod 644 $(DESTDIR)$(inst_slibdir)/libunwind.a
1085 $(RANLIB) $(DESTDIR)$(inst_slibdir)/libunwind.a
1086
1087 $(subst @multilib_dir@,$(MULTIDIR),$(subst \
1088 @shlib_base_name@,libunwind,$(subst \
1089 @shlib_slibdir_qual@,$(MULTIOSSUBDIR),$(SHLIBUNWIND_INSTALL))))
1090
1091 install-shared:
1092 $(mkinstalldirs) $(DESTDIR)$(inst_libdir)
1093
1094 $(INSTALL_DATA) libgcc_eh.a $(DESTDIR)$(inst_libdir)/
1095 chmod 644 $(DESTDIR)$(inst_libdir)/libgcc_eh.a
1096 $(RANLIB) $(DESTDIR)$(inst_libdir)/libgcc_eh.a
1097
1098 $(subst @multilib_dir@,$(MULTIDIR),$(subst \
1099 @shlib_base_name@,libgcc_s,$(subst \
1100 @shlib_slibdir_qual@,$(MULTIOSSUBDIR),$(SHLIB_INSTALL))))
1101
1102 install-leaf: $(install-shared) $(install-libunwind)
1103 $(mkinstalldirs) $(DESTDIR)$(inst_libdir)
1104
1105 $(INSTALL_DATA) libgcc.a $(DESTDIR)$(inst_libdir)/
1106 chmod 644 $(DESTDIR)$(inst_libdir)/libgcc.a
1107 $(RANLIB) $(DESTDIR)$(inst_libdir)/libgcc.a
1108 $(INSTALL_DATA) libgcov.a $(DESTDIR)$(inst_libdir)/
1109 chmod 644 $(DESTDIR)$(inst_libdir)/libgcov.a
1110 $(RANLIB) $(DESTDIR)$(inst_libdir)/libgcov.a
1111
1112 parts="$(INSTALL_PARTS)"; \
1113 for file in $$parts; do \
1114 rm -f $(DESTDIR)$(inst_libdir)/$$file; \
1115 $(INSTALL_DATA) $$file $(DESTDIR)$(inst_libdir)/; \
1116 case $$file in \
1117 *.a) \
1118 $(RANLIB) $(gcc_objdir)$(MULTISUBDIR)/$$file ;; \
1119 esac; \
1120 done
1121
1122 install: install-leaf install-unwind_h
1123 @: $(MAKE) ; $(MULTIDO) $(FLAGS_TO_PASS) multi-do DO=install
1124
1125 install-strip: install
1126
1127 .PHONY: install install-shared install-libunwind install-strip
1128 .PHONY: install-unwind_h install-unwind_h-forbuild
1129
1130 # Don't export variables to the environment, in order to not confuse
1131 # configure.
1132 .NOEXPORT:
1133
1134 include $(srcdir)/empty.mk $(wildcard *.dep)