]> gcc.gnu.org Git - gcc.git/blame - libgcc/Makefile.in
Makefile.tpl ($(srcdir)/configure): Update dependencies.
[gcc.git] / libgcc / Makefile.in
CommitLineData
fa958513
DJ
1# Makefile.in
2
3# Copyright (C) 2005, 2006 Free Software Foundation
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 2 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 COPYING. If not, write to the Free Software
19# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301,
20# USA.
21#
22
23libgcc_topdir = @libgcc_topdir@
14e8fc8b
PB
24host_subdir = @host_subdir@
25
fa958513 26gcc_srcdir = $(libgcc_topdir)/gcc
14e8fc8b 27gcc_objdir = $(MULTIBUILDTOP)../../$(host_subdir)/gcc
fa958513
DJ
28
29srcdir = @srcdir@
30
31prefix = @prefix@
32
33exec_prefix = @exec_prefix@
34libdir = @libdir@
89deeaff 35shlib_slibdir = @slibdir@
fa958513
DJ
36
37SHELL = @SHELL@
38
39enable_shared = @enable_shared@
40decimal_float = @decimal_float@
79b87c74 41enable_decimal_float = @enable_decimal_float@
8d2a9e0e 42fixed_point = @fixed_point@
fa958513
DJ
43
44host_noncanonical = @host_noncanonical@
45
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.
48EXTRA_PARTS = @extra_parts@
49
50# Multilib support variables.
51MULTISRCTOP =
52MULTIBUILDTOP =
53MULTIDIRS =
54MULTISUBDIR =
55MULTIDO = true
56MULTICLEAN = true
57
58INSTALL = @INSTALL@
59INSTALL_PROGRAM = @INSTALL_PROGRAM@
60INSTALL_DATA = @INSTALL_DATA@
61mkinstalldirs = $(SHELL) $(libgcc_topdir)/mkinstalldirs
62
63objext = .o
64
65AR = @AR@
66AR_FLAGS = rc
67
68CC = @CC@
69CFLAGS = @CFLAGS@
70RANLIB = @RANLIB@
fa958513 71LN_S = @LN_S@
fa958513
DJ
72
73PWD_COMMAND = $${PWDCMD-pwd}
74
75# Flags to pass to a recursive make.
76FLAGS_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)"
96
97# Dependencies for "all" are set later in the file.
98all: 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.
edbf8b16 103 $(MAKE) install-leaf DESTDIR=$(gcc_objdir) \
fa958513
DJ
104 slibdir= libsubdir= MULTIOSDIR=$(MULTIDIR)
105
106.PHONY: all-multi
107all-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
111
112.PHONY: check installcheck
113check:
114installcheck:
115
116.PHONY: all clean
117
118clean:
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
126distclean: clean
127 @$(MULTICLEAN) multi-clean DO=distclean
128 -rm -f *~ Makefile config.cache config.status multilib.out
129 -rm -f config.log
130maintainer-clean realclean: distclean
131
132Makefile: $(srcdir)/Makefile.in config.status
133 CONFIG_FILES=Makefile CONFIG_HEADERS= $(SHELL) ./config.status
134
135# Depending on Makefile makes sure that config.status has been re-run
136# if needed. This prevents problems with parallel builds.
137config.h: stamp-h ; @true
138stamp-h: $(srcdir)/config.in config.status Makefile
139 CONFIG_FILES= CONFIG_HEADERS=config.h:$(srcdir)/config.in $(SHELL) ./config.status
140
141config.status: $(srcdir)/configure
142 $(SHELL) ./config.status --recheck
143
144include $(gcc_objdir)/libgcc.mvars
145
146# Flags to pass to recursive makes.
147
148AR_FOR_TARGET = $(AR)
149AR_FLAGS_FOR_TARGET =
150AR_CREATE_FOR_TARGET = $(AR_FOR_TARGET) $(AR_FLAGS_FOR_TARGET) rc
151AR_EXTRACT_FOR_TARGET = $(AR_FOR_TARGET) $(AR_FLAGS_FOR_TARGET) x
152AWK = @AWK@
153GCC_FOR_TARGET = $(CC)
154LIPO = @LIPO@
155LIPO_FOR_TARGET = $(LIPO)
156MACHMODE_H = machmode.h mode-classes.def insn-modes.h
157NM = @NM@
158NM_FOR_TARGET = $(NM)
159RANLIB_FOR_TARGET = $(RANLIB)
160STRIP = @STRIP@
161STRIP_FOR_TARGET = $(STRIP)
162
163# Directory in which the compiler finds libraries etc.
164libsubdir = $(libdir)/gcc/$(host_noncanonical)/$(version)
165# Used to install the shared libgcc.
166slibdir = @slibdir@
167
168export AR_FOR_TARGET
169export AR_CREATE_FOR_TARGET
170export AR_FLAGS_FOR_TARGET
171export AR_EXTRACT_FOR_TARGET
172export AWK
173export DESTDIR
174export GCC_FOR_TARGET
175export INCLUDES
176export INSTALL_DATA
177export LIB1ASMSRC
178export LIBGCC2_CFLAGS
179export LIPO_FOR_TARGET
180export MACHMODE_H
181export NM_FOR_TARGET
182export STRIP_FOR_TARGET
183export RANLIB_FOR_TARGET
184export libsubdir
185export slibdir
186
79e6eaeb
DJ
187version := $(shell $(CC) -dumpversion)
188
79b87c74 189ifeq ($(decimal_float),yes)
200359e8
L
190ifeq ($(enable_decimal_float),bid)
191DECNUMINC = -I$(srcdir)/config/libbid -DENABLE_DECIMAL_BID_FORMAT
192else
79b87c74 193DECNUMINC = -I$(srcdir)/../libdecnumber/$(enable_decimal_float) \
bc6d4c3f 194 -I$(srcdir)/../libdecnumber
200359e8 195endif
79b87c74
MM
196else
197DECNUMINC =
198endif
fa958513
DJ
199
200# Specify the directories to be searched for header files.
201# Both . and srcdir are used, in that order,
202# so that *config.h will be found in the compilation
203# subdirectory rather than in the source directory.
204# -I$(@D) and -I$(srcdir)/$(@D) cause the subdirectory of the file
205# currently being compiled, in both source trees, to be examined as well.
206INCLUDES = -I. -I$(@D) -I$(gcc_objdir) \
207 -I$(srcdir) -I$(srcdir)/$(@D) -I$(srcdir)/../gcc \
208 -I$(srcdir)/../include $(DECNUMINC)
209
9891ec5f
DJ
210# Forcibly remove any profiling-related flags. There is no point
211# in supporting profiled bootstrap in this library.
212override CFLAGS := $(filter-out -fprofile-generate -fprofile-use,$(CFLAGS))
213
fa958513
DJ
214# CFLAGS first is not perfect; normally setting CFLAGS should override any
215# options in LIBGCC2_CFLAGS. But LIBGCC2_CFLAGS may contain -g0, and CFLAGS
216# will usually contain -g, so for the moment CFLAGS goes first. We must
217# include CFLAGS - that's where multilib options live.
6f461e76
L
218INTERNAL_CFLAGS = $(CFLAGS) $(LIBGCC2_CFLAGS) $(HOST_LIBGCC2_CFLAGS) \
219 $(INCLUDES) @set_have_cc_tls@
fa958513
DJ
220
221MULTIDIR := $(shell $(CC) $(CFLAGS) -print-multi-directory)
222MULTIOSDIR := $(shell $(CC) $(CFLAGS) -print-multi-os-directory)
223
224MULTIOSSUBDIR := $(shell if test $(MULTIOSDIR) != .; then echo /$(MULTIOSDIR); fi)
225inst_libdir = $(libsubdir)$(MULTISUBDIR)
226inst_slibdir = $(slibdir)$(MULTIOSSUBDIR)
227
228gcc_compile_bare = $(CC) $(INTERNAL_CFLAGS)
229compile_deps = -MT $@ -MD -MP -MF $(basename $@).dep
230gcc_compile = $(gcc_compile_bare) -o $@ $(compile_deps)
231gcc_s_compile = $(gcc_compile) -DSHARED
232
233objects = $(filter %$(objext),$^)
234
235# Collect any host-specific information from Makefile fragments.
236tmake_file = @tmake_file@
237include $(srcdir)/empty.mk $(tmake_file)
238
239# Only handle shared libraries if both:
240# - the user requested them
241# - we know how to build them
242ifeq ($(SHLIB_LINK),)
243 enable_shared := no
244endif
245
246ifeq ($(enable_shared),yes)
247 iterator = $(srcdir)/empty.mk $(patsubst %,$(srcdir)/shared-object.mk,$(iter-items))
248
249 install-shared = install-shared
250
251 ifneq ($(LIBUNWIND),)
252 install-libunwind = install-libunwind
253 endif
254
255# For -fvisibility=hidden. We need both a -fvisibility=hidden on
256# the command line, and a #define to prevent libgcc2.h etc from
257# overriding that with #pragmas.
258vis_hide = @vis_hide@
259
260ifneq (,$(vis_hide))
261
262# If we have -fvisibility=hidden, then we need to generate hide
263# lists for object files implemented in assembly.
264ASM_HIDDEN_OP = @asm_hidden_op@
265
266define gen-hide-list
267$(NM) -pg $< | \
268 $(AWK) 'NF == 3 && $$2 !~ /^[UN]$$/ { print "\t$(ASM_HIDDEN_OP)", $$3 }' > $@T
269mv -f $@T $@
270endef
271else
272gen-hide-list = echo > $@
273endif
274
275else
276# Not enable_shared.
277iterator = $(srcdir)/empty.mk $(patsubst %,$(srcdir)/static-object.mk,$(iter-items))
278vis_hide =
279gen-hide-list = echo > \$@
280endif
281
282ifneq ($(EXTRA_PARTS),)
283 extra-parts = libgcc-extra-parts
284 INSTALL_PARTS = $(EXTRA_PARTS)
285else
286ifneq ($(GCC_EXTRA_PARTS),)
287 extra-parts = gcc-extra-parts
288 INSTALL_PARTS = $(GCC_EXTRA_PARTS)
289endif
290endif
291
292# Library members defined in libgcc2.c.
293lib2funcs = _muldi3 _negdi2 _lshrdi3 _ashldi3 _ashrdi3 _cmpdi2 _ucmpdi2 \
294 _clear_cache _enable_execute_stack _trampoline __main _absvsi2 \
295 _absvdi2 _addvsi3 _addvdi3 _subvsi3 _subvdi3 _mulvsi3 _mulvdi3 \
296 _negvsi2 _negvdi2 _ctors _ffssi2 _ffsdi2 _clz _clzsi2 _clzdi2 \
297 _ctzsi2 _ctzdi2 _popcount_tab _popcountsi2 _popcountdi2 \
298 _paritysi2 _paritydi2 _powisf2 _powidf2 _powixf2 _powitf2 \
299 _mulsc3 _muldc3 _mulxc3 _multc3 _divsc3 _divdc3 _divxc3 \
300 _divtc3 _bswapsi2 _bswapdi2
301
302# The floating-point conversion routines that involve a single-word integer.
303# XX stands for the integer mode.
304swfloatfuncs = $(patsubst %,_fixuns%XX,sf df xf)
305
306# Likewise double-word routines.
307dwfloatfuncs = $(patsubst %,_fix%XX,sf df xf tf) \
308 $(patsubst %,_fixuns%XX,sf df xf tf) \
309 $(patsubst %,_floatXX%,sf df xf tf) \
310 $(patsubst %,_floatunXX%,sf df xf tf)
311
312ifeq ($(LIB2_SIDITI_CONV_FUNCS),)
313 lib2funcs += $(subst XX,si,$(swfloatfuncs))
314 lib2funcs += $(subst XX,di,$(dwfloatfuncs))
315endif
316
317# These might cause a divide overflow trap and so are compiled with
318# unwinder info.
319LIB2_DIVMOD_FUNCS = _divdi3 _moddi3 _udivdi3 _umoddi3 _udiv_w_sdiv _udivmoddi4
320
321# Remove any objects from lib2funcs and LIB2_DIVMOD_FUNCS that are
322# defined as optimized assembly code in LIB1ASMFUNCS or as C code
323# in LIB2FUNCS_EXCLUDE.
324lib2funcs := $(filter-out $(LIB2FUNCS_EXCLUDE) $(LIB1ASMFUNCS),$(lib2funcs))
325LIB2_DIVMOD_FUNCS := $(filter-out $(LIB2FUNCS_EXCLUDE) $(LIB1ASMFUNCS), \
326 $(LIB2_DIVMOD_FUNCS))
327
328# Build "libgcc1" (assembly) components.
329ifeq ($(enable_shared),yes)
330
331lib1asmfuncs-o = $(patsubst %,%$(objext),$(LIB1ASMFUNCS))
332$(lib1asmfuncs-o): %$(objext): $(gcc_srcdir)/config/$(LIB1ASMSRC) %.vis
333 $(gcc_compile) -DL$* -xassembler-with-cpp \
334 -c $(gcc_srcdir)/config/$(LIB1ASMSRC) -include $*.vis
335$(patsubst %,%.vis,$(LIB1ASMFUNCS)): %.vis: %_s$(objext)
336 $(gen-hide-list)
337libgcc-objects += $(lib1asmfuncs-o)
338
339lib1asmfuncs-s-o = $(patsubst %,%_s$(objext),$(LIB1ASMFUNCS))
340$(lib1asmfuncs-s-o): %_s$(objext): $(gcc_srcdir)/config/$(LIB1ASMSRC)
341 $(gcc_s_compile) -DL$* -xassembler-with-cpp \
342 -c $(gcc_srcdir)/config/$(LIB1ASMSRC)
343libgcc-s-objects += $(lib1asmfuncs-s-o)
344
345else
346
347lib1asmfuncs-o = $(patsubst %,%$(objext),$(LIB1ASMFUNCS))
348$(lib1asmfuncs-o): %$(objext): $(gcc_srcdir)/config/$(LIB1ASMSRC)
349 $(gcc_compile) -DL$* -xassembler-with-cpp \
350 -c $(gcc_srcdir)/config/$(LIB1ASMSRC)
351libgcc-objects += $(lib1asmfuncs-o)
352
353endif
354
355# Build lib2funcs. For the static library also include LIB2FUNCS_ST.
356lib2funcs-o = $(patsubst %,%$(objext),$(lib2funcs) $(LIB2FUNCS_ST))
357$(lib2funcs-o): %$(objext): $(gcc_srcdir)/libgcc2.c
358 $(gcc_compile) -DL$* -c $(gcc_srcdir)/libgcc2.c \
359 $(vis_hide)
360libgcc-objects += $(lib2funcs-o)
361
362ifeq ($(enable_shared),yes)
363lib2funcs-s-o = $(patsubst %,%_s$(objext),$(lib2funcs))
364$(lib2funcs-s-o): %_s$(objext): $(gcc_srcdir)/libgcc2.c
365 $(gcc_s_compile) -DL$* -c $(gcc_srcdir)/libgcc2.c
366libgcc-s-objects += $(lib2funcs-s-o)
367endif
368
369ifneq ($(LIB2_SIDITI_CONV_FUNCS),)
370# Build libgcc2.c for each conversion function, with a specific
371# L<func> definition and LIBGCC2_UNITS_PER_WORD setting. The DImode
372# functions are built with a wordsize of 4; the TImode functions are
373# built with the same labels, but a wordsize of 8.
374
375sifuncs = $(subst XX,si,$(swfloatfuncs))
376difuncs = $(subst XX,di,$(dwfloatfuncs))
377tifuncs = $(subst XX,ti,$(dwfloatfuncs))
378
379iter-items := $(sifuncs) $(difuncs) $(tifuncs)
380iter-labels := $(sifuncs) $(difuncs) $(difuncs)
381iter-sizes := $(patsubst %,4,$(sifuncs) $(difuncs)) $(patsubst %,8,$(tifuncs))
382
383include $(srcdir)/empty.mk $(patsubst %,$(srcdir)/siditi-object.mk,$(iter-items))
384
385libgcc-objects += $(patsubst %,%$(objext),$(sifuncs) $(difuncs) $(tifuncs))
386ifeq ($(enable_shared),yes)
387libgcc-s-objects += $(patsubst %,%_s$(objext),$(sifuncs) $(difuncs) $(tifuncs))
388endif
389endif
390
391# Build LIB2_DIVMOD_FUNCS.
392lib2-divmod-o = $(patsubst %,%$(objext),$(LIB2_DIVMOD_FUNCS))
393$(lib2-divmod-o): %$(objext): $(gcc_srcdir)/libgcc2.c
394 $(gcc_compile) -DL$* -c $(gcc_srcdir)/libgcc2.c \
395 -fexceptions -fnon-call-exceptions $(vis_hide)
396libgcc-objects += $(lib2-divmod-o)
397
398ifeq ($(enable_shared),yes)
399lib2-divmod-s-o = $(patsubst %,%_s$(objext),$(LIB2_DIVMOD_FUNCS))
400$(lib2-divmod-s-o): %_s$(objext): $(gcc_srcdir)/libgcc2.c
401 $(gcc_s_compile) -DL$* -c $(gcc_srcdir)/libgcc2.c \
402 -fexceptions -fnon-call-exceptions
403libgcc-s-objects += $(lib2-divmod-s-o)
404endif
405
406# $(FPBIT) et al. are pathnames relative to the GCC build
407# directory; the supporting files are made by the GCC
408# Makefile.
409# FIXME: Soon we will be able to move this logic into this directory.
410
411ifneq ($(fpbit-in-libgcc),yes)
412FPBIT:=$(if $(FPBIT),$(gcc_objdir)/$(FPBIT),)
413DPBIT:=$(if $(DPBIT),$(gcc_objdir)/$(DPBIT),)
414TPBIT:=$(if $(TPBIT),$(gcc_objdir)/$(TPBIT),)
415endif
416
417ifeq ($(TPBIT),)
418# _sf_to_tf and _df_to_tf require tp-bit.c being compiled in.
419FPBIT_FUNCS := $(filter-out _sf_to_tf,$(FPBIT_FUNCS))
420DPBIT_FUNCS := $(filter-out _df_to_tf,$(DPBIT_FUNCS))
421endif
422
423# Build FPBIT.
424ifneq ($(FPBIT),)
425fpbit-o = $(patsubst %,%$(objext),$(FPBIT_FUNCS))
426$(fpbit-o): %$(objext): $(FPBIT)
427 $(gcc_compile) -DFINE_GRAINED_LIBRARIES -DL$* -c $(FPBIT) $(vis_hide)
428libgcc-objects += $(fpbit-o)
429
430ifeq ($(enable_shared),yes)
431fpbit-s-o = $(patsubst %,%_s$(objext),$(FPBIT_FUNCS))
432$(fpbit-s-o): %_s$(objext): $(FPBIT)
433 $(gcc_s_compile) -DFINE_GRAINED_LIBRARIES -DL$* -c $(FPBIT)
434libgcc-s-objects += $(fpbit-s-o)
435endif
436endif
437
438# Build DPBIT.
439ifneq ($(DPBIT),)
440dpbit-o = $(patsubst %,%$(objext),$(DPBIT_FUNCS))
441$(dpbit-o): %$(objext): $(DPBIT)
442 $(gcc_compile) -DFINE_GRAINED_LIBRARIES -DL$* -c $(DPBIT) $(vis_hide)
443libgcc-objects += $(dpbit-o)
444
445ifeq ($(enable_shared),yes)
446dpbit-s-o = $(patsubst %,%_s$(objext),$(DPBIT_FUNCS))
447$(dpbit-s-o): %_s$(objext): $(DPBIT)
448 $(gcc_s_compile) -DFINE_GRAINED_LIBRARIES -DL$* -c $(DPBIT)
449libgcc-s-objects += $(dpbit-s-o)
450endif
451endif
452
453# Build TPBIT.
454ifneq ($(TPBIT),)
455tpbit-o = $(patsubst %,%$(objext),$(TPBIT_FUNCS))
456$(tpbit-o): %$(objext): $(TPBIT)
457 $(gcc_compile) -DFINE_GRAINED_LIBRARIES -DL$* -c $(TPBIT) $(vis_hide)
458libgcc-objects += $(tpbit-o)
459
460ifeq ($(enable_shared),yes)
461tpbit-s-o = $(patsubst %,%_s$(objext),$(TPBIT_FUNCS))
462$(tpbit-s-o): %_s$(objext): $(TPBIT)
463 $(gcc_s_compile) -DFINE_GRAINED_LIBRARIES -DL$* -c $(TPBIT)
464libgcc-s-objects += $(tpbit-s-o)
465endif
466endif
467
468# Build decimal floating point support.
469ifeq ($(decimal_float),yes)
470
471# If $DFP_ENABLE is set, then we want all data type sizes.
472ifneq ($(DFP_ENABLE),)
473D32PBIT = 1
474D64PBIT = 1
475D128PBIT = 1
476endif
477
200359e8 478dfp-filenames =
fa958513 479ifneq ($(D32PBIT)$(D64PBIT)$(D128PBIT),)
200359e8 480ifeq ($(enable_decimal_float),bid)
b2a00c89
L
481dfp-filenames += bid_decimal_globals bid_decimal_data \
482 bid_binarydecimal bid_convert_data \
483 _isinfd32 _isinfd64 _isinfd128 bid64_noncomp \
484 bid128_noncomp bid128_fma bid_round bid_from_int \
200359e8
L
485 bid64_add bid128_add bid64_div bid128_div \
486 bid64_mul bid128_mul bid64_compare bid128_compare \
487 bid128 bid32_to_bid64 bid32_to_bid128 bid64_to_bid128 \
488 bid64_to_int32 bid64_to_int64 \
489 bid64_to_uint32 bid64_to_uint64 \
490 bid128_to_int32 bid128_to_int64 \
491 bid128_to_uint32 bid128_to_uint64
492else
2533577f 493dfp-filenames += decContext decNumber decExcept decRound decLibrary decDouble decPacked decQuad decSingle
200359e8 494endif
fa958513
DJ
495endif
496
200359e8
L
497dfp-objects = $(patsubst %,%$(objext),$(dfp-filenames))
498ifeq ($(enable_decimal_float),bid)
499$(dfp-objects): %$(objext): $(srcdir)/config/libbid/%.c
500else
501$(dfp-objects): %$(objext): $(srcdir)/../libdecnumber/%.c
502endif
79b87c74 503 $(gcc_compile) -c $<
200359e8 504libgcc-objects += $(dfp-objects)
79b87c74
MM
505
506decbits-filenames =
200359e8 507ifneq ($(enable_decimal_float),bid)
fa958513 508ifneq ($(D32PBIT),)
79b87c74 509decbits-filenames += decimal32
fa958513
DJ
510endif
511
512ifneq ($(D64PBIT),)
79b87c74 513decbits-filenames += decimal64
fa958513
DJ
514endif
515
516ifneq ($(D128PBIT),)
79b87c74 517decbits-filenames += decimal128
fa958513 518endif
79b87c74
MM
519endif
520
521decbits-objects = $(patsubst %,%$(objext),$(decbits-filenames))
200359e8
L
522ifeq ($(enable_decimal_float),bid)
523$(decbits-objects): %$(objext): $(srcdir)/config/libbid/%.c
524else
79b87c74 525$(decbits-objects): %$(objext): $(srcdir)/../libdecnumber/$(enable_decimal_float)/%.c
200359e8 526endif
fa958513 527 $(gcc_compile) -c $<
79b87c74 528libgcc-objects += $(decbits-objects)
fa958513
DJ
529
530# Next build individual support functions.
200359e8
L
531ifeq ($(enable_decimal_float),bid)
532ifneq ($(D32PBIT),)
533D32PBIT_FUNCS:=$(filter-out _plus_sd _minus_sd _conv_sd, $(D32PBIT_FUNCS))
534endif
535
536ifneq ($(D64PBIT),)
537D64PBIT_FUNCS:=$(filter-out _plus_dd _minus_dd _conv_dd, $(D64PBIT_FUNCS))
538endif
539
540ifneq ($(D128PBIT),)
541D128PBIT_FUNCS:=$(filter-out _plus_td _minus_td _conv_td, $(D128PBIT_FUNCS))
542endif
543endif
544
fa958513
DJ
545ifneq ($(D32PBIT),)
546d32pbit-o = $(patsubst %,%$(objext),$(D32PBIT_FUNCS))
200359e8
L
547ifeq ($(enable_decimal_float),bid)
548$(d32pbit-o): %$(objext): $(srcdir)/config/libbid/%.c
549else
fa958513 550$(d32pbit-o): %$(objext): $(gcc_srcdir)/config/dfp-bit.c
200359e8 551endif
fa958513
DJ
552 $(gcc_compile) -DFINE_GRAINED_LIBRARIES -DL$* -DWIDTH=32 -c $<
553libgcc-objects += $(d32pbit-o)
554endif
555
556ifneq ($(D64PBIT),)
557d64pbit-o = $(patsubst %,%$(objext),$(D64PBIT_FUNCS))
200359e8
L
558ifeq ($(enable_decimal_float),bid)
559$(d64pbit-o): %$(objext): $(srcdir)/config/libbid/%.c
560else
fa958513 561$(d64pbit-o): %$(objext): $(gcc_srcdir)/config/dfp-bit.c
200359e8 562endif
fa958513
DJ
563 $(gcc_compile) -DFINE_GRAINED_LIBRARIES -DL$* -DWIDTH=64 -c $<
564libgcc-objects += $(d64pbit-o)
565endif
566
567ifneq ($(D128PBIT),)
568d128pbit-o = $(patsubst %,%$(objext),$(D128PBIT_FUNCS))
200359e8
L
569ifeq ($(enable_decimal_float),bid)
570$(d128pbit-o): %$(objext): $(srcdir)/config/libbid/%.c
571else
fa958513 572$(d128pbit-o): %$(objext): $(gcc_srcdir)/config/dfp-bit.c
200359e8 573endif
fa958513
DJ
574 $(gcc_compile) -DFINE_GRAINED_LIBRARIES -DL$* -DWIDTH=128 -c $<
575libgcc-objects += $(d128pbit-o)
576endif
577
578endif
579
8d2a9e0e
CF
580# Build fixed-point support.
581ifeq ($(fixed_point),yes)
582
583# Generate permutations of function name and mode
584fixed-labels := $(shell $(SHELL) $(srcdir)/gen-fixed.sh arith labels)
585fixed-funcs := $(shell $(SHELL) $(srcdir)/gen-fixed.sh arith funcs)
586fixed-modes := $(shell $(SHELL) $(srcdir)/gen-fixed.sh arith modes)
587
588# Generate the rules for each arithmetic function
589iter-items := $(fixed-funcs)
590iter-labels := $(fixed-labels)
591iter-from := $(fixed-modes)
592iter-to := $(fixed-modes)
593include $(srcdir)/empty.mk $(patsubst %,$(srcdir)/fixed-obj.mk,$(iter-items))
594
595# Add arithmetic functions to list of objects to be built
596libgcc-objects += $(patsubst %,%$(objext),$(fixed-funcs))
597ifeq ($(enable_shared),yes)
598libgcc-s-objects += $(patsubst %,%_s$(objext),$(fixed-funcs))
599endif
600
601# Convert from or to fractional
602fixed-conv-funcs := $(shell $(SHELL) $(srcdir)/gen-fixed.sh conv funcs)
603fixed-conv-labels := $(shell $(SHELL) $(srcdir)/gen-fixed.sh conv labels)
604fixed-conv-from := $(shell $(SHELL) $(srcdir)/gen-fixed.sh conv from)
605fixed-conv-to := $(shell $(SHELL) $(srcdir)/gen-fixed.sh conv to)
606
607# Generate the make rules for each conversion function
608iter-items := $(fixed-conv-funcs)
609iter-labels := $(fixed-conv-labels)
610iter-from := $(fixed-conv-from)
611iter-to := $(fixed-conv-to)
612include $(srcdir)/empty.mk $(patsubst %,$(srcdir)/fixed-obj.mk,$(iter-items))
613
614# Add conversion functions to list of objects to be built
615libgcc-objects += $(patsubst %,%$(objext),$(fixed-conv-funcs))
616ifeq ($(enable_shared),yes)
617libgcc-s-objects += $(patsubst %,%_s$(objext),$(fixed-conv-funcs))
618endif
619
620endif
621
fa958513
DJ
622# Build LIB2ADD and LIB2ADD_ST.
623ifneq ($(filter-out %.c %.S %.asm,$(LIB2ADD) $(LIB2ADD_ST)),)
624$(error Unsupported files in LIB2ADD or LIB2ADD_ST.)
625endif
626
627libgcc-objects += $(addsuffix $(objext),$(basename $(notdir $(LIB2ADD))))
628libgcc-objects += $(addsuffix $(objext),$(basename $(notdir $(LIB2ADD_ST))))
629
630c_flags :=
631iter-items := $(LIB2ADD) $(LIB2ADD_ST)
632include $(iterator)
633
634ifeq ($(enable_shared),yes)
635libgcc-s-objects += $(addsuffix _s$(objext),$(basename $(notdir $(LIB2ADD))))
636endif
637
638# Build LIB2ADDEH, LIB2ADDEHSTATIC, and LIB2ADDEHSHARED. If we don't have
639# libgcc_eh.a, only LIB2ADDEH matters. If we do, only LIB2ADDEHSTATIC and
640# LIB2ADDEHSHARED matter. (Usually all three are identical.)
641
642c_flags := -fexceptions
643
644ifeq ($(enable_shared),yes)
645
646libgcc-eh-objects += $(addsuffix $(objext),$(basename $(notdir $(LIB2ADDEHSTATIC))))
647libgcc-s-objects += $(addsuffix _s$(objext),$(basename $(notdir $(LIB2ADDEHSHARED))))
648
649iter-items := $(sort $(LIB2ADDEHSTATIC) $(LIB2ADDEHSHARED))
650include $(iterator)
651
652else
653# Not shared. LIB2ADDEH are added to libgcc.a.
654
655libgcc-objects += $(addsuffix $(objext),$(basename $(notdir $(LIB2ADDEH))))
656
657iter-items := $(LIB2ADDEH)
658include $(iterator)
659
660endif
661
662# Build LIBUNWIND.
663
664c_flags := -fexceptions
665
666libunwind-objects += $(addsuffix $(objext),$(basename $(notdir $(LIBUNWIND))))
667
668ifeq ($(enable_shared),yes)
669libunwind-s-objects += $(addsuffix _s$(objext),$(basename $(notdir $(LIBUNWIND))))
670endif
671
672iter-items := $(LIBUNWIND)
673include $(iterator)
674
675# Build libgcov components.
676libgcov-objects = $(patsubst %,%$(objext),$(LIBGCOV))
677$(libgcov-objects): %$(objext): $(gcc_srcdir)/libgcov.c
678 $(gcc_compile) -DL$* -c $(gcc_srcdir)/libgcov.c
679
680
681# Static libraries.
682libgcc.a: $(libgcc-objects)
683libgcov.a: $(libgcov-objects)
684libunwind.a: $(libunwind-objects)
685libgcc_eh.a: $(libgcc-eh-objects)
686
687libgcc.a libgcov.a libunwind.a libgcc_eh.a:
688 -rm -f $@
689
690 objects="$(objects)"; \
691 if test -z "$$objects"; then \
692 echo 'int __libgcc_eh_dummy;' > eh_dummy.c; \
693 $(gcc_compile_bare) $(vis_hide) -c eh_dummy.c \
694 -o eh_dummy$(objext); \
695 objects=eh_dummy$(objext); \
696 fi; \
697 $(AR_CREATE_FOR_TARGET) $@ $$objects
698
699 $(RANLIB) $@
700
701all: libgcc.a libgcov.a
702
703ifneq ($(LIBUNWIND),)
704all: libunwind.a
cd5c2357 705libgcc_s$(SHLIB_EXT): libunwind$(SHLIB_EXT)
fa958513
DJ
706endif
707
708ifeq ($(enable_shared),yes)
709all: libgcc_eh.a libgcc_s$(SHLIB_EXT)
710ifneq ($(LIBUNWIND),)
711all: libunwind$(SHLIB_EXT)
712endif
713endif
714
715ifeq ($(enable_shared),yes)
716
717# Map-file generation.
718ifneq ($(SHLIB_MKMAP),)
719libgcc.map: $(SHLIB_MKMAP) $(SHLIB_MAPFILES) $(libgcc-s-objects)
720 { $(NM) $(SHLIB_NM_FLAGS) $(libgcc-s-objects); echo %%; \
721 cat $(SHLIB_MAPFILES) \
722 | sed -e '/^[ ]*#/d' \
723 -e 's/^%\(if\|else\|elif\|endif\|define\)/#\1/' \
724 | $(gcc_compile_bare) -E -xassembler-with-cpp -; \
725 } | $(AWK) -f $(SHLIB_MKMAP) $(SHLIB_MKMAP_OPTS) > tmp-$@
726 mv tmp-$@ $@
727libgcc_s$(SHLIB_EXT): libgcc.map
728mapfile = libgcc.map
729endif
730
731libgcc_s$(SHLIB_EXT): $(libgcc-s-objects) $(extra-parts)
732 # @multilib_flags@ is still needed because this may use
733 # $(GCC_FOR_TARGET) and $(LIBGCC2_CFLAGS) directly.
734 # @multilib_dir@ is not really necessary, but sometimes it has
735 # more uses than just a directory name.
736 $(mkinstalldirs) $(MULTIDIR)
cd5c2357 737 $(subst @multilib_flags@,$(CFLAGS) -B./,$(subst \
fa958513
DJ
738 @multilib_dir@,$(MULTIDIR),$(subst \
739 @shlib_objs@,$(objects),$(subst \
740 @shlib_base_name@,libgcc_s,$(subst \
741 @shlib_map_file@,$(mapfile),$(subst \
89deeaff
EK
742 @shlib_slibdir_qual@,$(MULTIOSSUBDIR),$(subst \
743 @shlib_slibdir@,$(shlib_slibdir),$(SHLIB_LINK))))))))
fa958513
DJ
744
745libunwind$(SHLIB_EXT): $(libunwind-s-objects) $(extra-parts)
746 # @multilib_flags@ is still needed because this may use
747 # $(GCC_FOR_TARGET) and $(LIBGCC2_CFLAGS) directly.
748 # @multilib_dir@ is not really necessary, but sometimes it has
749 # more uses than just a directory name.
750 $(mkinstalldirs) $(MULTIDIR)
cd5c2357 751 $(subst @multilib_flags@,$(CFLAGS) -B./,$(subst \
fa958513
DJ
752 @multilib_dir@,$(MULTIDIR),$(subst \
753 @shlib_objs@,$(objects),$(subst \
754 @shlib_base_name@,libunwind,$(subst \
755 @shlib_slibdir_qual@,$(MULTIOSSUBDIR),$(SHLIBUNWIND_LINK))))))
756
757endif
758
759# Build the standard GCC startfiles and endfiles.
760ALL_CRT_CFLAGS = $(CFLAGS) $(CRTSTUFF_CFLAGS) $(INCLUDES)
761crt_compile = $(CC) $(ALL_CRT_CFLAGS) -o $@ $(compile_deps)
762
763ifeq ($(CUSTOM_CRTSTUFF),)
764crtbegin$(objext): $(gcc_srcdir)/crtstuff.c
765 $(crt_compile) $(CRTSTUFF_T_CFLAGS) \
766 -c $(gcc_srcdir)/crtstuff.c -DCRT_BEGIN
767
768crtend$(objext): $(gcc_srcdir)/crtstuff.c
769 $(crt_compile) $(CRTSTUFF_T_CFLAGS) \
770 -c $(gcc_srcdir)/crtstuff.c -DCRT_END
771
772# These are versions of crtbegin and crtend for shared libraries.
773crtbeginS$(objext): $(gcc_srcdir)/crtstuff.c
774 $(crt_compile) $(CRTSTUFF_T_CFLAGS_S) \
775 -c $(gcc_srcdir)/crtstuff.c -DCRT_BEGIN -DCRTSTUFFS_O
776
777crtendS$(objext): $(gcc_srcdir)/crtstuff.c
778 $(crt_compile) $(CRTSTUFF_T_CFLAGS_S) \
779 -c $(gcc_srcdir)/crtstuff.c -DCRT_END -DCRTSTUFFS_O
780
781# This is a version of crtbegin for -static links.
782crtbeginT.o: $(gcc_srcdir)/crtstuff.c
783 $(crt_compile) $(CRTSTUFF_T_CFLAGS) \
784 -c $(gcc_srcdir)/crtstuff.c -DCRT_BEGIN -DCRTSTUFFT_O
785endif
786
787# Build extra startfiles in the libgcc directory.
788.PHONY: libgcc-extra-parts
789libgcc-extra-parts: $(EXTRA_PARTS)
790ifneq ($(GCC_EXTRA_PARTS),)
791ifneq ($(sort $(EXTRA_PARTS)),$(GCC_EXTRA_PARTS))
792 # If the gcc directory specifies which extra parts to
793 # build for this target, and the libgcc configuration also
794 # specifies, make sure they match. This can be removed
795 # when the gcc directory no longer holds libgcc configuration;
796 # it is useful when migrating a target.
797 @echo "Configuration mismatch!"
798 @echo "Extra parts from gcc directory: $(GCC_EXTRA_PARTS)"
799 @echo "Extra parts from libgcc: $(EXTRA_PARTS)"
800 exit 1
801endif
802endif
803
804 # Early copyback; see "all" above for the rationale. The
805 # early copy is necessary so that the gcc -B options find
806 # the right startup files when linking shared libgcc.
807 $(mkinstalldirs) $(gcc_objdir)$(MULTISUBDIR)
808 parts="$(EXTRA_PARTS)"; \
809 for file in $$parts; do \
810 rm -f $(gcc_objdir)$(MULTISUBDIR)/$$file; \
811 $(INSTALL_DATA) $$file $(gcc_objdir)$(MULTISUBDIR)/; \
812 done
813
814# Build extra startfiles in the gcc directory, for unconverted
815# targets.
816.PHONY: gcc-extra-parts
817gcc-extra-parts:
818 # Recursively invoke make in the GCC directory to build any
819 # startfiles (for now). We must do this just once, passing
820 # it all the GCC_EXTRA_PARTS as simultaneous goal targets,
821 # so that rules which cannot execute simultaneously are properly
822 # serialized. We indirect through T_TARGET in case any multilib
823 # directories contain an equals sign, to prevent make from
824 # interpreting any of the goals as variable assignments.
825
826 # We must use cd && make rather than make -C, or else the stage
827 # number will be embedded in debug information.
828
829 T=`$(PWD_COMMAND)`/ \
830 && cd $(gcc_objdir) \
831 && $(MAKE) GCC_FOR_TARGET="$(CC)" \
832 MULTILIB_CFLAGS="$(CFLAGS)" \
833 T=$$T \
834 T_TARGET="$(patsubst %,$${T}%,$(GCC_EXTRA_PARTS))" \
835 T_TARGET
836
837 # Early copyback; see "all" above for the rationale. The
838 # early copy is necessary so that the gcc -B options find
839 # the right startup files when linking shared libgcc.
840 $(mkinstalldirs) $(gcc_objdir)$(MULTISUBDIR)
841 parts="$(GCC_EXTRA_PARTS)"; \
842 for file in $$parts; do \
843 rm -f $(gcc_objdir)$(MULTISUBDIR)/$$file; \
844 $(INSTALL_DATA) $$file $(gcc_objdir)$(MULTISUBDIR)/; \
845 done
846
847all: $(extra-parts)
848
e0a9456a 849# Documentation targets (empty).
e8bb4597 850.PHONY: info html dvi pdf install-info install-html install-pdf
b0088af7 851
e0a9456a 852info:
e8bb4597 853install-info:
e0a9456a 854html:
ac84c172 855install-html:
e0a9456a 856dvi:
e0a9456a 857pdf:
ac84c172 858install-pdf:
e0a9456a 859
fa958513
DJ
860# Install rules. These do not depend on "all", so that they can be invoked
861# recursively from it.
862install-libunwind:
863 $(mkinstalldirs) $(DESTDIR)$(inst_slibdir)
864
865 # NOTE: Maybe this should go into $(inst_libdir), but this
866 # is where the old mklibgcc.in put it.
867 $(INSTALL_DATA) libunwind.a $(DESTDIR)$(inst_slibdir)/
868 chmod 644 $(DESTDIR)$(inst_slibdir)/libunwind.a
869 $(RANLIB) $(DESTDIR)$(inst_slibdir)/libunwind.a
870
871 $(subst @multilib_dir@,$(MULTIDIR),$(subst \
872 @shlib_base_name@,libunwind,$(subst \
873 @shlib_slibdir_qual@,$(MULTIOSSUBDIR),$(SHLIBUNWIND_INSTALL))))
874
875install-shared:
876 $(mkinstalldirs) $(DESTDIR)$(inst_libdir)
877
878 $(INSTALL_DATA) libgcc_eh.a $(DESTDIR)$(inst_libdir)/
879 chmod 644 $(DESTDIR)$(inst_libdir)/libgcc_eh.a
880 $(RANLIB) $(DESTDIR)$(inst_libdir)/libgcc_eh.a
881
882 $(subst @multilib_dir@,$(MULTIDIR),$(subst \
883 @shlib_base_name@,libgcc_s,$(subst \
884 @shlib_slibdir_qual@,$(MULTIOSSUBDIR),$(SHLIB_INSTALL))))
885
edbf8b16 886install-leaf: $(install-shared) $(install-libunwind)
fa958513
DJ
887 $(mkinstalldirs) $(DESTDIR)$(inst_libdir)
888
889 $(INSTALL_DATA) libgcc.a $(DESTDIR)$(inst_libdir)/
890 chmod 644 $(DESTDIR)$(inst_libdir)/libgcc.a
891 $(RANLIB) $(DESTDIR)$(inst_libdir)/libgcc.a
892 $(INSTALL_DATA) libgcov.a $(DESTDIR)$(inst_libdir)/
893 chmod 644 $(DESTDIR)$(inst_libdir)/libgcov.a
894 $(RANLIB) $(DESTDIR)$(inst_libdir)/libgcov.a
895
896 parts="$(INSTALL_PARTS)"; \
897 for file in $$parts; do \
898 rm -f $(DESTDIR)$(inst_libdir)/$$file; \
899 $(INSTALL_DATA) $$file $(DESTDIR)$(inst_libdir)/; \
900 done
901
edbf8b16 902install: install-leaf
97af925b
DJ
903 @$(MULTIDO) $(FLAGS_TO_PASS) multi-do DO=install
904
fa958513
DJ
905.PHONY: install install-shared install-libunwind
906
907# Don't export variables to the environment, in order to not confuse
908# configure.
909.NOEXPORT:
910
911include $(srcdir)/empty.mk $(wildcard *.dep)
912
913# TODO QUEUE:
914# Garbage collect in gcc/:
915# $(LIBGCC) settings in t-* are now unused
916#
917# Remove use of $(gcc_srcdir). Source files referenced using $(gcc_srcdir)
918# should move into the libgcc directory.
919
This page took 0.218529 seconds and 5 git commands to generate.