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