]> git.ipfire.org Git - thirdparty/gcc.git/blame - gcc/Makefile.in
* alpha/elf.h (ASM_FINISH_DECLARE_OBJECT): Use HOST_WIDE_INT_PRINT_DEC.
[thirdparty/gcc.git] / gcc / Makefile.in
CommitLineData
32e6d418 1# Makefile for GNU C compiler.
6544861d 2# Copyright (C) 1987, 88, 90-98, 1999 Free Software Foundation, Inc.
32e6d418 3
4#This file is part of GNU CC.
5
6#GNU CC is free software; you can redistribute it and/or modify
7#it under the terms of the GNU General Public License as published by
8#the Free Software Foundation; either version 2, or (at your option)
9#any later version.
10
11#GNU CC is distributed in the hope that it will be useful,
12#but WITHOUT ANY WARRANTY; without even the implied warranty of
13#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14#GNU General Public License for more details.
15
16#You should have received a copy of the GNU General Public License
17#along with GNU CC; see the file COPYING. If not, write to
8d62a21c 18#the Free Software Foundation, 59 Temple Place - Suite 330,
19#Boston MA 02111-1307, USA.
32e6d418 20
21# The targets for external use include:
22# all, doc, proto, install, install-cross, install-cross-rest,
a8514488 23# uninstall, TAGS, mostlyclean, clean, distclean, maintainer-clean,
32e6d418 24# stage1, stage2, stage3, stage4.
25
c6396a0b 26# Suppress smart makes who think they know how to automake Yacc files
27.y.c:
28
87c0ad1b 29# Directory where sources are, from where we are.
30srcdir = @srcdir@
31VPATH = @srcdir@
32
32e6d418 33# Variables that exist for you to override.
34# See below for how to change them for certain systems.
35
73027c94 36# List of language subdirectories.
37# This is overridden by configure.
87c0ad1b 38SUBDIRS =@subdirs@
73027c94 39
32e6d418 40# Selection of languages to be made.
73027c94 41# This is overridden by configure.
76103b2c 42CONFIG_LANGUAGES = @all_languages@
43LANGUAGES = c proto gcov$(exeext) $(CONFIG_LANGUAGES)
32e6d418 44
e754efc9 45# Selection of languages to be made during stage1 build.
46# This is overridden by configure.
87c0ad1b 47BOOT_LANGUAGES = c @all_boot_languages@
e754efc9 48
32e6d418 49ALLOCA =
1ab99fde 50ALLOCA_FLAGS =
94c53b91 51ALLOCA_FINISH = true
32e6d418 52
53# Various ways of specifying flags for compilations:
54# CFLAGS is for the user to override to, e.g., do a bootstrap with -O2.
55# BOOT_CFLAGS is the value of CFLAGS to pass
56# to the stage2 and stage3 compilations
6f63674e 57# WARN_CFLAGS are the warning flags to pass to stage2 and stage3.
58# (And for stage 1 if the native compiler is GCC.) It is
a727632e 59# separate from BOOT_CFLAGS because people tend to override optimization
60# flags and we'd like them to still have warnings turned on. They are free
61# to explicitly turn warnings off if they wish.
32e6d418 62# XCFLAGS is used for most compilations but not when using the GCC just built.
329da2a1 63# TCFLAGS is used for compilations with the GCC just built.
32e6d418 64XCFLAGS =
329da2a1 65TCFLAGS =
6f63674e 66CFLAGS = -g @stage1_warn_cflags@
86373592 67BOOT_CFLAGS = -O2 $(CFLAGS)
a727632e 68WARN_CFLAGS = -W -Wall
32e6d418 69# These exists to be overridden by the x-* and t-* files, respectively.
70X_CFLAGS =
71T_CFLAGS =
72
73X_CPPFLAGS =
74T_CPPFLAGS =
75
38bce124 76CC = @CC@
fbf120a6 77# srcdir might be a relative pathname which won't be valid in a subdirectory,
78# so we must use objdir/srcdir instead to make it safe. objdir is always
79# a full pathname.
80BISON = `if [ -f $(objdir)/../bison/bison ] ; then case $(srcdir) in \
81 /*) echo $(objdir)/../bison/bison -L $(srcdir)/../bison/ ;; \
82 *) echo $(objdir)/../bison/bison -L $(objdir)/$(srcdir)/../bison/ ;; \
f6b47e76 83 esac; else echo bison ; fi`
3f1608f3 84BISONFLAGS =
fbf120a6 85LEX = `if [ -f $(objdir)/../flex/flex ] ; then echo $(objdir)/../flex/flex ; else echo flex ; fi`
73027c94 86LEXFLAGS =
32e6d418 87AR = ar
32e6d418 88AR_FLAGS = rc
0dbd1c74 89LN = @symbolic_link@
4664c5d5 90DLLTOOL = dlltool
32e6d418 91SHELL = /bin/sh
92# on sysV, define this as cp.
87c0ad1b 93INSTALL = @INSTALL@
ea4a6c81 94# Some systems may be missing symbolic links, regular links, or both.
95# Allow configure to check this and use "ln -s", "ln", or "cp" as appropriate.
96LN=@LN@
97LN_S=@LN_S@
32e6d418 98# These permit overriding just for certain files.
74086405 99INSTALL_PROGRAM = @INSTALL_PROGRAM@
100INSTALL_DATA = @INSTALL_DATA@
bc51108a 101MAKEINFO = makeinfo
64cda823 102MAKEINFOFLAGS =
f345940f 103TEXI2DVI = texi2dvi
73027c94 104# For GNUmake: let us decide what gets passed to recursive makes.
105MAKEOVERRIDES =
87c0ad1b 106@SET_MAKE@
32e6d418 107
108# Define this as & to perform parallel make on a Sequent.
109# Note that this has some bugs, and it seems currently necessary
110# to compile all the gen* files first by hand to avoid erroneous results.
111P =
112
113# How to invoke ranlib.
114RANLIB = ranlib
115# Test to use to see whether ranlib exists on the system.
116RANLIB_TEST = [ -f /usr/bin/ranlib -o -f /bin/ranlib ]
117
73b4c875 118HOST_AR = ar
119HOST_AR_FLAGS = rc
120HOST_RANLIB = ranlib
121HOST_RANLIB_TEST = [ -f /usr/bin/ranlib -o -f /bin/ranlib ]
122
32e6d418 123# Compiler to use for compiling libgcc1.a.
124# OLDCC should not be the GNU C compiler,
125# since that would compile typical libgcc1.a functions such as mulsi3
126# into infinite recursions.
127OLDCC = cc
128
129# CFLAGS for use with OLDCC, for compiling libgcc1.a.
130# NOTE: -O does not work on some Unix systems!
131CCLIBFLAGS = -O
132
c6396a0b 133# Version of ar to use when compiling libgcc1.a.
32e6d418 134OLDAR = ar
38bce124 135OLDAR_FLAGS = qc
32e6d418 136
2cfd79fe 137# Target to use when installing include directory. Either
138# install-headers-tar or install-headers-cpio.
87c0ad1b 139INSTALL_HEADERS_DIR = @build_install_headers_dir@
2cfd79fe 140
c8763215 141# Header files that are made available under the same name
142# to programs compiled with GCC.
143USER_H = $(srcdir)/ginclude/stdarg.h $(srcdir)/ginclude/stddef.h \
144 $(srcdir)/ginclude/varargs.h $(srcdir)/ginclude/va-alpha.h \
145 $(srcdir)/ginclude/va-h8300.h $(srcdir)/ginclude/va-i860.h \
146 $(srcdir)/ginclude/va-i960.h $(srcdir)/ginclude/va-mips.h \
169dbe8d 147 $(srcdir)/ginclude/va-m88k.h $(srcdir)/ginclude/va-mn10200.h \
148 $(srcdir)/ginclude/va-mn10300.h $(srcdir)/ginclude/va-pa.h \
c8763215 149 $(srcdir)/ginclude/va-pyr.h $(srcdir)/ginclude/va-sparc.h \
150 $(srcdir)/ginclude/va-clipper.h $(srcdir)/ginclude/va-spur.h \
7820337b 151 $(srcdir)/ginclude/va-m32r.h $(srcdir)/ginclude/va-sh.h \
399e3dbb 152 $(srcdir)/ginclude/va-v850.h $(srcdir)/ginclude/va-arc.h \
c8763215 153 $(srcdir)/ginclude/iso646.h $(srcdir)/ginclude/va-ppc.h \
f49aed97 154 $(srcdir)/ginclude/va-c4x.h $(EXTRA_HEADERS) $(LANG_EXTRA_HEADERS) \
9c571843 155 $(srcdir)/ginclude/proto.h $(srcdir)/ginclude/stdbool.h
c8763215 156
157# Target to use whe installing assert.h. Some systems may
158# want to set this empty.
159INSTALL_ASSERT_H = install-assert-h
160
3b9b6fde 161# The GCC to use for compiling libgcc2.a, enquire, and libgcc1-test.
b3781cc4 162# Usually the one we just built.
32e6d418 163# Don't use this as a dependency--use $(GCC_PASSES) or $(GCC_PARTS).
12626b99 164GCC_FOR_TARGET = ./xgcc -B./ -B$(build_tooldir)/bin/
32e6d418 165
166# This is used instead of ALL_CFLAGS when compiling with GCC_FOR_TARGET.
167# It omits XCFLAGS, and specifies -B./.
66820558 168# It also specifies -I./include to find, e.g., stddef.h.
329da2a1 169GCC_CFLAGS=$(INTERNAL_CFLAGS) $(X_CFLAGS) $(T_CFLAGS) $(CFLAGS) -I./include $(TCFLAGS)
32e6d418 170
b541ad9d 171# Sed command to transform gcc to installed name. Overwritten by configure.
3271658e 172program_transform_name = @program_transform_name@
ccb6700d 173program_transform_cross_name = s,^,$(target_alias)-,
b541ad9d 174
11d80b02 175build_canonical = @build_canonical@
176host_canonical = @host_canonical@
177
32e6d418 178# Tools to use when building a cross-compiler.
179# These are used because `configure' appends `cross-make'
180# to the makefile when making a cross-compiler.
181
fbc57885 182# Use the tools from the build tree, if they are available.
183
184# objdir is set by configure.
185objdir = @objdir@
186
187AR_FOR_TARGET = ` \
188 if [ -f $(objdir)/../binutils/ar ] ; then \
189 echo $(objdir)/../binutils/ar ; \
190 else \
191 if [ "$(host_canonical)" = "$(target)" ] ; then \
192 echo ar; \
193 else \
194 t='$(program_transform_name)'; echo ar | sed -e $$t ; \
195 fi; \
196 fi`
32e6d418 197AR_FOR_TARGET_FLAGS = rc
fbc57885 198RANLIB_FOR_TARGET = ` \
199 if [ -f $(objdir)/../binutils/ranlib ] ; then \
200 echo $(objdir)/../binutils/ranlib ; \
201 else \
202 if [ "$(host_canonical)" = "$(target)" ] ; then \
203 echo ranlib; \
204 else \
205 t='$(program_transform_name)'; echo ranlib | sed -e $$t ; \
206 fi; \
207 fi`
208RANLIB_TEST_FOR_TARGET = \
209 [ -f $(RANLIB_FOR_TARGET) ] \
210 || ( [ "$(host_canonical)" = "$(target)" ] \
211 && [ -f /usr/bin/ranlib -o -f /bin/ranlib ] )
212
213# We always act like a cross-compiler, even when we're
214# compiling native. This is because we want to use our own tools if
215# we can. We don't just set RANLIB to a complicated expression,
216# because the top level Makefile.in might override RANLIB_FOR_TARGET.
217# These are from the FSF file "cross-make".
218AR = $(AR_FOR_TARGET)
219AR_FLAGS = $(AR_FOR_TARGET_FLAGS)
220OLDAR = $(AR_FOR_TARGET)
221OLDAR_FLAGS = $(AR_FOR_TARGET_FLAGS)
222RANLIB = $(RANLIB_FOR_TARGET)
223RANLIB_TEST = $(RANLIB_TEST_FOR_TARGET)
224
3f69fed5 225# Dir to search for system headers. Overridden by cross-make.
226SYSTEM_HEADER_DIR = /usr/include
227
61fad423 228# Control whether to run fixproto.
229STMP_FIXPROTO = stmp-fixproto
a5889b74 230
0848b369 231# Test to see whether <limits.h> exists in the system header files.
232LIMITS_H_TEST = [ -f $(SYSTEM_HEADER_DIR)/limits.h ]
233
8bd8ea06 234# There may be a premade insn-attrtab.c for this machine.
235# (You could rebuild it with genattrtab as usual, but it takes a long time.)
236# PREMADE_ATTRTAB is the file name of the file to use.
237# PREMADE_ATTRTAB_MD is the md file it corresponds to.
238PREMADE_ATTRTAB_MD = Makefile # Guaranteed not to cmp equal to md.
239PREMADE_ATTRTAB =
240
87c0ad1b 241target=@target@
71d9c015 242target_alias=@target_alias@
87c0ad1b 243xmake_file=@dep_host_xmake_file@
244tmake_file=@dep_tmake_file@
245out_file=$(srcdir)/config/@out_file@
246out_object_file=@out_object_file@
247md_file=$(srcdir)/config/@md_file@
248tm_file=@tm_file_list@
249build_xm_file=@build_xm_file_list@
250host_xm_file=@host_xm_file_list@
251lang_specs_files=@lang_specs_files@
252lang_options_files=@lang_options_files@
c3cc26e1 253lang_tree_files=@lang_tree_files@
714fe809 254GCC_THREAD_FILE=@thread_file@
5c872430 255OBJC_BOEHM_GC=@objc_boehm_gc@
cc775b65 256JAVAGC=@JAVAGC@
58febf9e 257GTHREAD_FLAGS=@gthread_flags@
7955e3d2 258# Be prepared for gcc2 merges.
259gcc_version=@gcc_version@
260gcc_version_trigger=@gcc_version_trigger@
261version=$(gcc_version)
2b19125c 262mainversion=`sed -e 's/.*\"\([0-9]*\.[0-9]*\).*/\1/' < $(srcdir)/version.c`
32e6d418 263
32e6d418 264# Common prefix for installation directories.
265# NOTE: This directory must exist when you start installation.
87c0ad1b 266prefix = @prefix@
2ffdcadf 267# Directory in which to put localized header files. On the systems with
268# gcc as the native cc, `local_prefix' may not be `prefix' which is
269# `/usr'.
a2aa0fc1 270# NOTE: local_prefix *should not* default from prefix.
87c0ad1b 271local_prefix = @local_prefix@
c6396a0b 272# Directory in which to put host dependent programs and libraries
87c0ad1b 273exec_prefix = @exec_prefix@
32e6d418 274# Directory in which to put the executable for the command `gcc'
87c0ad1b 275bindir = @bindir@
32e6d418 276# Directory in which to put the directories used by the compiler.
87c0ad1b 277libdir = @libdir@
32e6d418 278# Directory in which the compiler finds executables, libraries, etc.
67cb4bc1 279libsubdir = $(libdir)/gcc-lib/$(target_alias)/$(version)
8099945b 280# Used to produce a relative $(tooldir) in gcc.o
281unlibsubdir = ../../..
3bf5d4dc 282# Directory in which the compiler finds g++ includes.
df693a69 283gxx_include_dir= @gxx_include_dir@
35df828f 284# Directory to search for site-specific includes.
9671ce48 285includedir = $(local_prefix)/include
db9a0b19 286# assertdir is overridden in cross-make.
9d8314a9 287# (But this currently agrees with what is in cross-make.)
288assertdir = $(tooldir)/include
a2aa0fc1 289# where the info files go
87c0ad1b 290infodir = @infodir@
32e6d418 291# Extension (if any) to put in installed man-page filename.
292manext = .1
f403cbcb 293objext = .o
2aa3e87b 294exeext = @host_exeext@
295build_exeext = @build_exeext@
f403cbcb 296
32e6d418 297# Directory in which to put man pages.
3cf6a465 298mandir = @mandir@
299man1dir = $(mandir)/man1
32e6d418 300# Directory in which to find other cross-compilation tools and headers.
301# Used in install-cross.
12626b99 302tooldir = $(libsubdir)/$(unlibsubdir)/../$(target_alias)
303# Since tooldir does not exist at build-time, use -B$(build_tooldir)/bin/
304build_tooldir = $(exec_prefix)/$(target_alias)
f32abccb 305# Dir for temp files.
306tmpdir = /tmp
32e6d418 307
308# Additional system libraries to link with.
309CLIB=
310
311# Change this to a null string if obstacks are installed in the
312# system library.
313OBSTACK=obstack.o
314
b8a373b2 315# Configure will set these if you need vfprintf and possibly _doprnt support.
316VFPRINTF=@vfprintf@
317DOPRINT=@doprint@
318
2289acd7 319# Specify the rule for actually making libgcc.a,
320LIBGCC = libgcc.a
321# and the rule for installing it.
322INSTALL_LIBGCC = install-libgcc
323
32e6d418 324# Specify the rule for actually making libgcc1.a.
c6396a0b 325# The value may be empty; that means to do absolutely nothing
326# with or for libgcc1.a.
32e6d418 327LIBGCC1 = libgcc1.a
328
b0d230b7 329# Specify the rule for making libgcc1.a for a cross-compiler.
330# The default rule assumes that libgcc1.a is supplied by the user.
331CROSS_LIBGCC1 = libgcc1.cross
332
32e6d418 333# Specify the rule for actually making libgcc2.a.
334LIBGCC2 = libgcc2.a
335
336# Options to use when compiling libgcc2.a.
337# -g1 causes output of debug info only for file-scope entities.
338# we use this here because that should be enough, and also
339# so that -g1 will be tested.
cce804d3 340#
b1e0e993 341LIBGCC2_DEBUG_CFLAGS = -g1
a69e7f5f 342LIBGCC2_CFLAGS = -O2 $(LIBGCC2_INCLUDES) $(GCC_CFLAGS) $(TARGET_LIBGCC2_CFLAGS) $(LIBGCC2_DEBUG_CFLAGS) $(GTHREAD_FLAGS) -DIN_LIBGCC2 -D__GCC_FLOAT_NOT_NEEDED @inhibit_libc@
690a93ea 343
344# Additional options to use when compiling libgcc2.a.
345# Some targets override this to -Iinclude
346LIBGCC2_INCLUDES =
347
b5dba0c7 348# Additional target-dependent options for compiling libgcc2.a.
349TARGET_LIBGCC2_CFLAGS =
350
690a93ea 351# Things which must be built before building libgcc2.a.
352# Some targets override this to stmp-int-hdrs
353LIBGCC2_DEPS =
32e6d418 354
3b9b6fde 355# libgcc1-test target (must also be overridable for a target)
356LIBGCC1_TEST = libgcc1-test
17886975 357
32e6d418 358# List of extra executables that should be compiled for this target machine
359# that are used for compiling from source code to object code.
360# The rules for compiling them should be in the t-* file for the machine.
87c0ad1b 361EXTRA_PASSES =@extra_passes@
32e6d418 362
c6396a0b 363# Like EXTRA_PASSES, but these are used when linking.
87c0ad1b 364EXTRA_PROGRAMS = @extra_programs@
c6396a0b 365
366# List of extra object files that should be compiled for this target machine.
32e6d418 367# The rules for compiling them should be in the t-* file for the machine.
87c0ad1b 368EXTRA_PARTS = @extra_parts@
32e6d418 369
c6396a0b 370# List of extra object files that should be compiled and linked with
371# compiler proper (cc1, cc1obj, cc1plus).
87c0ad1b 372EXTRA_OBJS = @extra_objs@
c6396a0b 373
17108b2b 374# List of extra object files that should be compiled and linked with
375# the gcc driver.
87c0ad1b 376EXTRA_GCC_OBJS =@host_extra_gcc_objs@
17108b2b 377
630c76ba 378# List of additional header files to install.
379# Often this is edited directly by `configure'.
87c0ad1b 380EXTRA_HEADERS =@extra_headers_list@
630c76ba 381
0c787992 382# Set this to `collect2' to enable use of collect2.
87c0ad1b 383USE_COLLECT2 = @will_use_collect2@
23029fe8 384MAYBE_USE_COLLECT2 = @maybe_use_collect2@
79f818d0 385# It is convenient for configure to add the assignment at the beginning,
386# so don't override it here.
0c787992 387USE_COLLECT2 = collect2$(exeext)
79f818d0 388
32e6d418 389# List of extra C and assembler files to add to libgcc1.a.
390# Assembler files should have names ending in `.asm'.
391LIB1FUNCS_EXTRA =
392
393# List of extra C and assembler files to add to libgcc2.a.
394# Assembler files should have names ending in `.asm'.
395LIB2FUNCS_EXTRA =
396
2cfd79fe 397# Default float.h source to use for cross-compiler.
ad87de1e 398# This is overridden by configure.
87c0ad1b 399CROSS_FLOAT_H=$(srcdir)/config/float-@float_format@.h
2cfd79fe 400
d54b81e0 401# We do not try to build float.h anymore. Let configure select the
402# appropriate pre-built float.h file for the target.
403FLOAT_H=$(srcdir)/config/float-@float_format@.h
404
32e6d418 405# Program to convert libraries.
406LIBCONVERT =
407
408# Control whether header files are installed.
32e6d418 409INSTALL_HEADERS=install-headers
410
ed2f1f67 411# Options for tar when copying trees. So HPUX can override it.
412TAROUTOPTS = xpBf
413
32e6d418 414# Select which version of fixincludes to use (I.E. regular versus SVR4)
6848a9c6 415# This value is overridden directly by configure.
87c0ad1b 416FIXINCLUDES = @fixincludes@
32e6d418 417
106a27e5 418# Additional directories of header files to run fixincludes on.
af731fc2 419# These should be directories searched automatically by default
420# just as /usr/include is.
421# *Do not* use this for directories that happen to contain
422# header files, but are not searched automatically by default.
106a27e5 423# On most systems, this is empty.
424OTHER_FIXINCLUDES_DIRS=
425
fc0b8ef8 426# A list of all the language-specific executables.
427# This is overridden by configure.
8757933b 428COMPILERS = cc1$(exeext) @all_compilers@
fc0b8ef8 429
77a164d8 430# List of things which should already be built whenever we try to use xgcc
32e6d418 431# to compile anything (without linking).
7f6a6499 432GCC_PASSES=xgcc$(exeext) cc1$(exeext) cpp$(exeext) $(EXTRA_PASSES)
32e6d418 433
77a164d8 434# List of things which should already be built whenever we try to use xgcc
32e6d418 435# to link anything.
2289acd7 436GCC_PARTS=$(GCC_PASSES) $(LIBGCC) $(EXTRA_PROGRAMS) $(USE_COLLECT2) $(EXTRA_PARTS)
32e6d418 437
32e6d418 438# Directory to link to, when using the target `maketest'.
439DIR = ../gcc
440
89e36a04 441# Guaranteed to not exist when not passing md through cpp.
2c352995 442# This value is overridden directly by configure.
89e36a04 443MD_FILE = md-cpp-not-used
444
32e6d418 445# Flags to use when cross-building GCC.
446# Prefix to apply to names of object files when using them
447# to run on the machine we are compiling on.
448HOST_PREFIX=
449# Prefix to apply to names of object files when compiling them
450# to run on the machine we are compiling on.
451# The default for this variable is chosen to keep these rules
452# out of the way of the other rules for compiling the same source files.
453HOST_PREFIX_1=loser-
454HOST_CC=$(CC)
455HOST_CFLAGS=$(ALL_CFLAGS)
c6396a0b 456HOST_CLIB=$(CLIB)
32e6d418 457HOST_LDFLAGS=$(LDFLAGS)
458HOST_CPPFLAGS=$(ALL_CPPFLAGS)
c6396a0b 459HOST_ALLOCA=$(ALLOCA)
460HOST_MALLOC=$(MALLOC)
461HOST_OBSTACK=$(OBSTACK)
b8a373b2 462HOST_VFPRINTF=$(VFPRINTF)
463HOST_DOPRINT=$(DOPRINT)
32e6d418 464
b541ad9d 465# Actual name to use when installing a native compiler.
ccb6700d 466GCC_INSTALL_NAME = `t='$(program_transform_name)'; echo gcc | sed -e $$t`
fc56a674 467PROTOIZE_INSTALL_NAME = `t='$(program_transform_name)'; echo protoize | sed -e $$t`
468UNPROTOIZE_INSTALL_NAME = `t='$(program_transform_name)'; echo unprotoize | sed -e $$t`
b541ad9d 469
470# Actual name to use when installing a cross-compiler.
ccb6700d 471GCC_CROSS_NAME = `t='$(program_transform_cross_name)'; echo gcc | sed -e $$t`
fc56a674 472PROTOIZE_CROSS_NAME = `t='$(program_transform_cross_name)'; echo protoize | sed -e $$t`
473UNPROTOIZE_CROSS_NAME = `t='$(program_transform_cross_name)'; echo unprotoize | sed -e $$t`
b541ad9d 474
32e6d418 475# Choose the real default target.
476ALL=all.internal
477
478# Choose the real install target.
2cfd79fe 479INSTALL_TARGET=install-normal
480
6c08487b 481# Setup the testing framework, if you have one
482EXPECT = `if [ -f $${rootme}/../expect/expect ] ; then \
483 echo $${rootme}/../expect/expect ; \
484 else echo expect ; fi`
485
486RUNTEST = `if [ -f $${srcdir}/../dejagnu/runtest ] ; then \
487 echo $${srcdir}/../dejagnu/runtest ; \
488 else echo runtest; fi`
489RUNTESTFLAGS =
490
b33b80ed 491# Extra symbols for fixproto to define when parsing headers.
492FIXPROTO_DEFINES =
493
b7c87ff2 494# Extra flags to use when compiling crt{begin,end}.o.
495CRTSTUFF_T_CFLAGS =
496
4d3c962c 497# Extra flags to use when compiling [m]crt0.o.
498CRT0STUFF_T_CFLAGS =
499
0dbd1c74 500# "t" or nothing, for building multilibbed versions of, say, crtbegin.o.
501T =
502
32e6d418 503# End of variables for you to override.
504
505# Definition of `all' is here so that new rules inserted by sed
506# do not specify the default target.
507# The real definition is under `all.internal' (for native compilers)
508# or `all.cross' (for cross compilers).
c6396a0b 509all: all.indirect
32e6d418 510
131b361e 511# This tells GNU Make version 3 not to put all variables in the environment.
512.NOEXPORT:
513
32e6d418 514# sed inserts variable overrides after the following line.
a0a99f10 515####target overrides
87c0ad1b 516@target_overrides@
517
a0a99f10 518####host overrides
87c0ad1b 519@host_overrides@
520
a0a99f10 521####cross overrides
87c0ad1b 522@cross_defines@
523@cross_overrides@
524
e77fd588 525####build overrides
87c0ad1b 526@build_overrides@
2e9d8ccf 527#\f
32e6d418 528# Now figure out from those variables how to compile and link.
529
c6396a0b 530all.indirect: $(ALL)
531
7b6bbd12 532# IN_GCC tells various files that system.h, toplev.c, etc are available.
792e272d 533INTERNAL_CFLAGS = $(CROSS) -DIN_GCC $(SCHED_CFLAGS) @extra_c_flags@
32e6d418 534
535# This is the variable actually used when we compile.
792e272d 536# If you change this line, you probably also need to change the definition
537# of HOST_CFLAGS in build-make to match.
5539b206 538ALL_CFLAGS = $(INTERNAL_CFLAGS) $(X_CFLAGS) $(T_CFLAGS) $(CFLAGS) $(XCFLAGS) \
792e272d 539 @DEFS@
32e6d418 540
541# Likewise.
542ALL_CPPFLAGS = $(CPPFLAGS) $(X_CPPFLAGS) $(T_CPPFLAGS)
543
544# Even if ALLOCA is set, don't use it if compiling with GCC.
c1f5b841 545USE_ALLOCA= ${ALLOCA}
546USE_HOST_ALLOCA= ` case "${HOST_ALLOCA}" in ?*) echo ${HOST_PREFIX}${HOST_ALLOCA} ;; esac `
c6396a0b 547USE_HOST_MALLOC= ` case "${HOST_MALLOC}" in ?*) echo ${HOST_PREFIX}${HOST_MALLOC} ;; esac `
548USE_HOST_OBSTACK= ` case "${HOST_OBSTACK}" in ?*) echo ${HOST_PREFIX}${HOST_OBSTACK} ;; esac `
b8a373b2 549USE_HOST_VFPRINTF= ` case "${HOST_VFPRINTF}" in ?*) echo ${HOST_PREFIX}${HOST_VFPRINTF} ;; esac `
550USE_HOST_DOPRINT= ` case "${HOST_DOPRINT}" in ?*) echo ${HOST_PREFIX}${HOST_DOPRINT} ;; esac `
32e6d418 551
552# Dependency on obstack, alloca, malloc or whatever library facilities
553# are not installed in the system libraries.
554# We don't use USE_ALLOCA because backquote expansion doesn't work in deps.
b8a373b2 555LIBDEPS= $(OBSTACK) $(ALLOCA) $(MALLOC) $(VFPRINTF) $(DOPRINT)
32e6d418 556
557# Likewise, for use in the tools that must run on this machine
558# even if we are cross-building GCC.
559# We don't use USE_ALLOCA because backquote expansion doesn't work in deps.
b8a373b2 560HOST_LIBDEPS= $(HOST_PREFIX)$(HOST_OBSTACK) $(HOST_PREFIX)$(HOST_ALLOCA) $(HOST_PREFIX)$(HOST_MALLOC) $(HOST_PREFIX)$(HOST_VFPRINTF) $(HOST_PREFIX)$(HOST_DOPRINT)
32e6d418 561
562# How to link with both our special library facilities
563# and the system's installed libraries.
d7e36a01 564LIBS = $(OBSTACK) $(USE_ALLOCA) $(MALLOC) $(VFPRINTF) $(DOPRINT) $(CLIB) \
565 ../libiberty/libiberty.a
32e6d418 566
567# Likewise, for use in the tools that must run on this machine
568# even if we are cross-building GCC.
c6396a0b 569HOST_LIBS = $(USE_HOST_OBSTACK) $(USE_HOST_ALLOCA) $(USE_HOST_MALLOC) \
b8a373b2 570 $(USE_HOST_VFPRINTF) $(USE_HOST_DOPRINT) $(HOST_CLIB)
32e6d418 571
a3426c4c 572HOST_RTL = $(HOST_PREFIX)rtl.o $(HOST_PREFIX)bitmap.o
32e6d418 573HOST_RTLANAL = $(HOST_PREFIX)rtlanal.o
262d46de 574HOST_PRINT = $(HOST_PREFIX)print-rtl.o
32e6d418 575
576# Specify the directories to be searched for header files.
577# Both . and srcdir are used, in that order,
578# so that tm.h and config.h will be found in the compilation
579# subdirectory rather than in the source directory.
dda5abb0 580INCLUDES = -I. -I$(srcdir) -I$(srcdir)/config -I$(srcdir)/../include
32e6d418 581
582# Always use -I$(srcdir)/config when compiling.
583.c.o:
584 $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $<
585
586# This tells GNU make version 3 not to export all the variables
587# defined in this file into the environment.
588.NOEXPORT:
2e9d8ccf 589#\f
73027c94 590# Support for additional languages (other than c and objc).
591# ??? objc can be supported this way too (leave for later).
592
593# These next lines are overridden by configure.
87c0ad1b 594LANG_MAKEFILES = @all_lang_makefiles@
595LANG_STAGESTUFF = @all_stagestuff@
596LANG_DIFF_EXCLUDES = @all_diff_excludes@
597LANG_LIB2FUNCS = @all_lib2funcs@
598LANG_EXTRA_HEADERS = @all_headers@
73027c94 599
600# Flags to pass to recursive makes.
601# CC is set by configure. Hosts without symlinks need special handling
602# because we need CC="stage1/xgcc -Bstage1/" to work in the language
603# subdirectories.
604# ??? The choices here will need some experimenting with.
605FLAGS_TO_PASS = \
ff750663 606 "AR_FLAGS=$(AR_FOR_TARGET_FLAGS)" \
73027c94 607 "AR_FOR_TARGET=$(AR_FOR_TARGET)" \
608 "BISON=$(BISON)" \
609 "BISONFLAGS=$(BISONFLAGS)" \
87c0ad1b 610 "CC=@cc_set_by_configure@" \
73027c94 611 "CFLAGS=$(CFLAGS)" \
2feda28e 612 "CLIB=$(CLIB)" \
c1a2e040 613 "GCC_FOR_TARGET=$(GCC_FOR_TARGET)" \
73027c94 614 "LDFLAGS=$(LDFLAGS)" \
615 "LEX=$(LEX)" \
616 "LEXFLAGS=$(LEXFLAGS)" \
ea4a6c81 617 "LN=$(LN)" \
618 "LN_S=$(LN_S)" \
73027c94 619 "MAKEINFO=$(MAKEINFO)" \
620 "MAKEINFOFLAGS=$(MAKEINFOFLAGS)" \
73027c94 621 "RANLIB_FOR_TARGET=$(RANLIB_FOR_TARGET)" \
622 "RANLIB_TEST_FOR_TARGET=$(RANLIB_TEST_FOR_TARGET)" \
623 "SHELL=$(SHELL)" \
87c0ad1b 624 "STAGE_PREFIX=@stage_prefix_set_by_configure@" \
62268150 625 "exeext=$(exeext)" \
2aa3e87b 626 "build_exeext=$(build_exeext)" \
62268150 627 "objext=$(objext)" \
73027c94 628 "exec_prefix=$(exec_prefix)" \
629 "prefix=$(prefix)" \
933b38ee 630 "local_prefix=$(local_prefix)" \
631 "gxx_include_dir=$(gxx_include_dir)" \
73027c94 632 "tooldir=$(tooldir)" \
633 "bindir=$(bindir)" \
634 "libsubdir=$(libsubdir)"
2e9d8ccf 635#\f
32e6d418 636# Lists of files for various purposes.
637
ee8f5350 638# Language-specific object files for C and Objective C.
639C_AND_OBJC_OBJS = c-lex.o c-pragma.o c-decl.o c-typeck.o c-convert.o \
640 c-aux-info.o c-common.o c-iterate.o @extra_c_objs@
641
32e6d418 642# Language-specific object files for C.
ee8f5350 643C_OBJS = c-parse.o c-lang.o $(C_AND_OBJC_OBJS)
6cba4ca3 644
3eb9a99d 645SCHED_PREFIX = @sched_prefix@
646SCHED_CFLAGS = @sched_cflags@
647
32e6d418 648# Language-independent object files.
649OBJS = toplev.o version.o tree.o print-tree.o stor-layout.o fold-const.o \
037a5228 650 function.o stmt.o except.o expr.o calls.o expmed.o explow.o optabs.o \
3ad7bb1c 651 varasm.o rtl.o print-rtl.o rtlanal.o emit-rtl.o genrtl.o real.o regmove.o \
3eb9a99d 652 dbxout.o sdbout.o dwarfout.o dwarf2out.o xcoffout.o bitmap.o alias.o \
d6ff8d83 653 integrate.o jump.o cse.o loop.o unroll.o flow.o stupid.o combine.o varray.o \
18aa2adf 654 regclass.o local-alloc.o global.o reload.o reload1.o caller-save.o gcse.o \
3eb9a99d 655 insn-peep.o reorg.o $(SCHED_PREFIX)sched.o final.o recog.o reg-stack.o \
bdb66cef 656 insn-opinit.o insn-recog.o insn-extract.o insn-output.o insn-emit.o \
33a62e3f 657 profile.o insn-attrtab.o $(out_object_file) getpwd.o $(EXTRA_OBJS) convert.o \
3eaf50a4 658 mbchar.o dyn-string.o splay-tree.o graph.o
32e6d418 659
660# GEN files are listed separately, so they can be built before doing parallel
661# makes for cc1 or cc1plus. Otherwise sequent parallel make attempts to load
662# them before rtl.o is compiled.
3ad7bb1c 663GEN= genemit genoutput genrecog genextract genflags gencodes genconfig \
1a237d7e 664 genpeep gengenrtl gencheck
32e6d418 665
be69511d 666CCCP=@cpp_main@
3e4227af 667
32e6d418 668# Files to be copied away after each stage in building.
62268150 669STAGESTUFF = *$(objext) insn-flags.h insn-config.h insn-codes.h \
32e6d418 670 insn-output.c insn-recog.c insn-emit.c insn-extract.c insn-peep.c \
fad95be0 671 insn-attr.h insn-attrtab.c insn-opinit.c genrtl.c genrtl.h tree-check.h \
9e042f31 672 s-flags s-config s-codes s-mlib s-under\
673 s-output s-recog s-emit s-extract s-peep s-check \
997d68fe 674 s-attr s-attrtab s-opinit s-crt s-crtS s-crt0 \
2aa3e87b 675 genemit$(build_exeext) genoutput$(build_exeext) genrecog$(build_exeext) \
676 genextract$(build_exeext) genflags$(build_exeext) gencodes$(build_exeext) \
677 genconfig$(build_exeext) genpeep$(build_exeext) genattrtab$(build_exeext) \
7369c81f 678 genattr$(build_exeext) genopinit$(build_exeext) gengenrtl$(build_exeext) \
1a237d7e 679 gencheck$(build_exeext) \
d1871a55 680 xgcc$(exeext) cc1$(exeext) cpp$(exeext) $(EXTRA_PASSES) \
681 $(EXTRA_PARTS) $(EXTRA_PROGRAMS) gcc-cross$(exeext) \
62268150 682 $(CCCP)$(exeext) cc1obj$(exeext) enquire$(exeext) \
683 protoize$(exeext) unprotoize$(exeext) \
c20b28d5 684 specs collect2$(exeext) $(USE_COLLECT2) underscore.c \
2b55270a 685 gcov$(exeext) *.bp \
389cd241 686 *.greg *.lreg *.combine *.flow *.cse *.jump *.rtl *.tree *.loop \
18aa2adf 687 *.dbr *.jump2 *.sched *.cse2 *.sched2 *.stack *.gcse \
73b4c875 688 *.[si] libcpp.a \
73027c94 689 $(LANG_STAGESTUFF)
32e6d418 690
691# Members of libgcc1.a.
692LIB1FUNCS = _mulsi3 _udivsi3 _divsi3 _umodsi3 _modsi3 \
799330a9 693 _lshrsi3 _ashrsi3 _ashlsi3 \
32e6d418 694 _divdf3 _muldf3 _negdf2 _adddf3 _subdf3 \
695 _fixdfsi _fixsfsi _floatsidf _floatsisf _truncdfsf2 _extendsfdf2 \
696 _addsf3 _negsf2 _subsf3 _mulsf3 _divsf3 \
697 _eqdf2 _nedf2 _gtdf2 _gedf2 _ltdf2 _ledf2 \
698 _eqsf2 _nesf2 _gtsf2 _gesf2 _ltsf2 _lesf2
699
700# Library members defined in libgcc2.c.
701LIB2FUNCS = _muldi3 _divdi3 _moddi3 _udivdi3 _umoddi3 _negdi2 \
799330a9 702 _lshrdi3 _ashldi3 _ashrdi3 _ffsdi2 \
4b8f50a8 703 _udiv_w_sdiv _udivmoddi4 _cmpdi2 _ucmpdi2 _floatdidf _floatdisf \
32e6d418 704 _fixunsdfsi _fixunssfsi _fixunsdfdi _fixdfdi _fixunssfdi _fixsfdi \
619c3e71 705 _fixxfdi _fixunsxfdi _floatdixf _fixunsxfsi \
d055d75f 706 _fixtfdi _fixunstfdi _floatditf \
4b7a79e2 707 __gcc_bcmp _varargs __dummy _eprintf \
708 _bb _shtab _clear_cache _trampoline __main _exit \
a69e7f5f 709 _ctors _pure
710
711LIB2FUNCS_EH = _eh
32e6d418 712
04ddb594 713FPBIT_FUNCS = _pack_sf _unpack_sf _addsub_sf _mul_sf _div_sf \
714 _fpcmp_parts_sf _compare_sf _eq_sf _ne_sf _gt_sf _ge_sf \
715 _lt_sf _le_sf _si_to_sf _sf_to_si _negate_sf _make_sf \
716 _sf_to_df
717
718DPBIT_FUNCS = _pack_df _unpack_df _addsub_df _mul_df _div_df \
719 _fpcmp_parts_df _compare_df _eq_df _ne_df _gt_df _ge_df \
720 _lt_df _le_df _si_to_df _df_to_si _negate_df _make_df \
721 _df_to_sf
722
32e6d418 723# The files that "belong" in CONFIG_H are deliberately omitted
724# because having them there would not be useful in actual practice.
725# All they would do is cause complete recompilation every time
726# one of the machine description files is edited.
727# That may or may not be what one wants to do.
728# If it is, rm *.o is an easy way to do it.
c20b28d5 729# CONFIG_H = $(host_xm_file) $(tm_file)
32e6d418 730CONFIG_H =
4a7d7a8b 731RTL_BASE_H = rtl.h rtl.def machmode.h machmode.def
3ad7bb1c 732RTL_H = $(RTL_BASE_H) genrtl.h
4a7d7a8b 733TREE_H = tree.h real.h tree.def machmode.h machmode.def tree-check.h
8f220b93 734BASIC_BLOCK_H = basic-block.h bitmap.h
f6afeec9 735DEMANGLE_H = $(srcdir)/../include/demangle.h
4a7d7a8b 736RECOG_H = recog.h
ae262a47 737EXPR_H = expr.h insn-codes.h
4a7d7a8b 738REGS_H = regs.h varray.h machmode.h machmode.def
2e9d8ccf 739#\f
73027c94 740# Language makefile fragments.
741
742# The following targets define the interface between us and the languages.
743#
744# all.build, all.cross, start.encap, rest.encap,
745# info, dvi,
746# install-normal, install-common, install-info, install-man,
747# uninstall, distdir,
a8514488 748# mostlyclean, clean, distclean, extraclean, maintainer-clean,
73027c94 749# stage1, stage2, stage3, stage4
750#
751# Each language is linked in with a series of hooks (since we can't use `::'
752# targets). The name of each hooked is "lang.${target_name}" (eg: lang.info).
753# Configure computes and adds these here.
754
755####language hooks
87c0ad1b 756@language_hooks@
73027c94 757
758# sed inserts language fragments after the following line.
759####language fragments
87c0ad1b 760@language_fragments@
73027c94 761
762# End of language makefile fragments.
2e9d8ccf 763#\f
8d12f02c 764# The only suffixes we want for implicit rules are .c and .o, so clear
765# the list and add them. This speeds up GNU Make, and allows -r to work.
766.SUFFIXES:
767.SUFFIXES: .c .o
32e6d418 768
d44645af 769Makefile: $(srcdir)/Makefile.in config.status $(srcdir)/version.c \
160b6fa9 770 $(xmake_file) $(tmake_file) $(LANG_MAKEFILES)
771 $(SHELL) $(srcdir)/configure.frag $(srcdir) "$(SUBDIRS)" \
772 "$(xmake_file)" "$(tmake_file)"
f403cbcb 773 cp config.status config.run
76103b2c 774 LANGUAGES="$(CONFIG_LANGUAGES)" $(SHELL) config.run
5484bc67 775 rm -f config.run
32e6d418 776
82470d2e 777$(srcdir)/configure: $(srcdir)/configure.in
87c0ad1b 778 cd $(srcdir); autoconf
779
0d9d9ae4 780# cstamp-h.in controls rebuilding of config.in.
d44645af 781# It is named cstamp-h.in and not stamp-h.in so the mostlyclean rule doesn't
782# delete it. A stamp file is needed as autoheader won't update the file if
783# nothing has changed.
0d9d9ae4 784# It remains in the source directory and is part of the distribution.
785# This follows what is done in shellutils, fileutils, etc.
c3b8daa3 786# "echo timestamp" is used instead of touch to be consistent with other
787# packages that use autoconf (??? perhaps also to avoid problems with patch?).
0d9d9ae4 788# ??? Newer versions have a maintainer mode that may be useful here.
789$(srcdir)/config.in: $(srcdir)/cstamp-h.in
790$(srcdir)/cstamp-h.in: $(srcdir)/configure.in $(srcdir)/acconfig.h
d211e301 791 cd $(srcdir) && autoheader
ba679b21 792 @rm -f $(srcdir)/cstamp-h.in
c3b8daa3 793 echo timestamp > $(srcdir)/cstamp-h.in
764fc592 794auto-host.h: cstamp-h ; @true
0d9d9ae4 795cstamp-h: config.in config.status
76103b2c 796 CONFIG_HEADERS=auto-host.h:config.in LANGUAGES="$(CONFIG_LANGUAGES)" $(SHELL) config.status
5539b206 797
d44645af 798# Really, really stupid make features, such as SUN's KEEP_STATE, may force
799# a target to build even if it is up-to-date. So we must verify that
800# config.status does not exist before failing.
9bec654d 801config.status: configure version.c
d44645af 802 @if [ ! -f config.status ] ; then \
803 echo You must configure gcc. Look at the INSTALL file for details.; \
804 false; \
805 else \
76103b2c 806 LANGUAGES="$(CONFIG_LANGUAGES)" $(SHELL) config.status --recheck; \
d44645af 807 fi
808
32e6d418 809all.internal: start.encap rest.encap
810# This is what to compile if making a cross-compiler.
73027c94 811# Note that we can compile enquire using the cross-compiler just built,
87540b0a 812# although we can't run it on this machine.
7c4fe5b5 813all.cross: native gcc-cross specs stmp-headers $(STMP_FIXPROTO) $(LIBGCC) \
3b9b6fde 814 $(LIBGCC1_TEST) $(EXTRA_PARTS) lang.all.cross
e77fd588 815# This is what to compile if making gcc with a cross-compiler.
7f6a6499 816all.build: native xgcc$(exeext) $(EXTRA_PARTS) lang.all.build
32e6d418 817# This is what must be made before installing GCC and converting libraries.
7f6a6499 818start.encap: native xgcc$(exeext) specs $(LIBGCC1) xlimits.h lang.start.encap
335ebf8f 819# These can't be made until after GCC can run.
7c4fe5b5 820rest.encap: stmp-headers $(STMP_FIXPROTO) $(LIBGCC) $(EXTRA_PARTS) lang.rest.encap
32e6d418 821# This is what is made with the host's compiler
822# whether making a cross compiler or not.
764fc592 823native: config.status auto-host.h cpp$(exeext) $(LANGUAGES) \
3ded972d 824 $(EXTRA_PASSES) $(EXTRA_PROGRAMS) $(USE_COLLECT2)
32e6d418 825
826# Define the names for selecting languages in LANGUAGES.
7f6a6499 827C c: cc1$(exeext)
32e6d418 828PROTO: proto
829
ee4720a9 830# Tell GNU make these are phony targets.
8757933b 831.PHONY: C c PROTO proto
ee4720a9 832
840a6e8d 833# On the target machine, finish building a cross compiler.
834# This does the things that can't be done on the host machine.
2289acd7 835rest.cross: $(LIBGCC) gfloat.h specs
840a6e8d 836
3b9b6fde 837# Verify that it works to compile and link libgcc1-test.
d7330690 838# If it does, then there are sufficient replacements for libgcc1.a.
3b9b6fde 839libgcc1-test: libgcc1-test.o native $(GCC_PARTS)
55e40402 840 @echo "Testing libgcc1. Ignore linker warning messages."
3b9b6fde 841 $(GCC_FOR_TARGET) $(GCC_CFLAGS) libgcc1-test.o -o libgcc1-test \
b6f6ec68 842 -nostartfiles -nostdlib `$(GCC_FOR_TARGET) --print-libgcc-file-name`
7f6a6499 843libgcc1-test.o: libgcc1-test.c native xgcc$(exeext)
3b9b6fde 844 $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(ALL_CPPFLAGS) -c $(srcdir)/libgcc1-test.c
d7330690 845
840a6e8d 846# Recompile all the language-independent object files.
847# This is used only if the user explicitly asks for it.
32e6d418 848compilations: ${OBJS}
849
03f51dea 850# Create a list of the language-independent object files so the language
851# subdirectories needn't mention their names explicitly.
b54842d8 852stamp-objlist: $(OBJS)
853 echo " $(OBJS)" | sed -e 's, \([a-z0-9]\), ../\1,g' -e 's/\.o/$(objext)/g' >stamp-objlist
03f51dea 854
77a164d8 855# We call this executable `xgcc' rather than `gcc'
856# to avoid confusion if the current directory is in the path
857# and CC is `gcc'. It is renamed to `gcc' when it is installed.
7f6a6499 858xgcc$(exeext): gcc.o version.o choose-temp.o pexecute.o prefix.o version.o \
07a3679c 859 mkstemp.o $(LIBDEPS) $(EXTRA_GCC_OBJS)
0dbd1c74 860 $(CC) $(ALL_CFLAGS) $(LDFLAGS) -o $@ gcc.o prefix.o version.o \
07a3679c 861 choose-temp.o pexecute.o mkstemp.o $(EXTRA_GCC_OBJS) $(LIBS)
840a6e8d 862
863# Dump a specs file to make -B./ read these specs over installed ones.
7f6a6499 864specs: xgcc$(exeext)
c92e16d4 865 $(GCC_FOR_TARGET) -dumpspecs > tmp-specs
866 mv tmp-specs specs
32e6d418 867
77a164d8 868# We do want to create an executable named `xgcc', so we can use it to
32e6d418 869# compile libgcc2.a.
870# Also create gcc-cross, so that install-common will install properly.
7f6a6499 871gcc-cross: xgcc$(exeext)
62268150 872 cp xgcc$(exeext) gcc-cross$(exeext)
32e6d418 873
95c4b02a 874cc1$(exeext): $(P) $(OBJS) $(C_OBJS) $(LIBDEPS)
875 $(CC) $(ALL_CFLAGS) $(LDFLAGS) -o $@ $(OBJS) $(C_OBJS) $(LIBS)
32e6d418 876
2cfd79fe 877# Copy float.h from its source.
d82b9c93 878gfloat.h: $(FLOAT_H)
98d3f9df 879 -rm -f gfloat.h
d82b9c93 880 cp $(FLOAT_H) gfloat.h
2cfd79fe 881
3f69fed5 882# Build the version of limits.h that we will install.
883xlimits.h: glimits.h limitx.h limity.h
0848b369 884 if $(LIMITS_H_TEST) ; then \
c92e16d4 885 cat $(srcdir)/limitx.h $(srcdir)/glimits.h $(srcdir)/limity.h > tmp-xlimits.h; \
3f69fed5 886 else \
c92e16d4 887 cat $(srcdir)/glimits.h > tmp-xlimits.h; \
3f69fed5 888 fi
c92e16d4 889 mv tmp-xlimits.h xlimits.h
2e9d8ccf 890#\f
32e6d418 891# Build libgcc.a.
892# This is done in two parts because some functions, in libgcc1.c,
77a164d8 893# must be compiled with something other than GCC,
894# while the rest, in libgcc2.c, must be compiled with xgcc.
895# That means we can't do libgcc2.c until after xgcc, cc1, etc.
32e6d418 896
897# Use this as value of LIBGCC1 to cause conversion to GNU library format.
898# LIBCONVERT should put its output in libgcc1.conv.
899libgcc1.conv: libgcc1.a
900 $(LIBCONVERT) libgcc1.a libgcc1.conv
901
902# Use this as value of LIBGCC1 to inhibit use of libgcc1.c entirely.
903# Make an empty file instead.
66e9b81a 904libgcc1.null: $(GCC_PASSES)
144546c5 905 echo "void __foo () {}" > dummy.c
32e6d418 906 $(GCC_FOR_TARGET) $(GCC_CFLAGS) -c dummy.c
62268150 907 $(OLDAR) $(OLDAR_FLAGS) libgcc1.null dummy$(objext)
908 rm -f dummy$(objext) dummy.c
32e6d418 909
fe918d35 910# This is $(LIBGCC1) for a cross-compiler.
911# We have no automatic way of building libgcc1.a,
912# so it's up to the installer to find a way to do that.
913# This rule deliberately does not depend on libgcc1.a
914# so that it will fail if the installer hasn't provided it.
915libgcc1.cross:
916 mv libgcc1.a libgcc1.cross || (echo You must find a way to make libgcc1.a; false)
917
32e6d418 918# Compile the library of arithmetic subroutines with the native compiler.
77a164d8 919# Don't compile it with GCC!
32e6d418 920# (That would cause most arithmetic functions to call themselves.)
5eef7030 921#
922# NOTE: If you modify these rules substantially, please be sure to
923# check at least config/i386/t-sco5 and possibly other makefile
924# fragments.
32e6d418 925libgcc1.a: libgcc1.c $(CONFIG_H) $(LIB1FUNCS_EXTRA) config.status
926 -rm -f tmplibgcc1.a
927# Actually build it in tmplibgcc1.a, then rename at end,
928# so that libgcc1.a itself remains nonexistent if compilation is aborted.
929# -e causes any failing command to make this rule fail.
930# -e doesn't work in certain shells, so we test $$? as well.
547e1b60 931# lynx has a broken ar, it always complains when the initial library is
932# empty, thus this command works only if we don't do -e
933# There is a trailing backslash (\) deleted from the following line.
934# set -e;
32e6d418 935 for name in $(LIB1FUNCS); \
936 do \
937 echo $${name}; \
62268150 938 rm -f $${name}$(objext); \
5eef7030 939 $(OLDCC) -DIN_LIBGCC1 $(CCLIBFLAGS) $(INCLUDES) -c -DL$${name} $(srcdir)/libgcc1.c; \
32e6d418 940 if [ $$? -eq 0 ] ; then true; else exit 1; fi; \
62268150 941 mv libgcc1$(objext) $${name}$(objext); \
942 $(OLDAR) $(OLDAR_FLAGS) tmplibgcc1.a $${name}$(objext); \
943 rm -f $${name}$(objext); \
32e6d418 944 done
945# Some shells crash when a loop has no items.
946# So make sure there is always at least one--`..'.
947# Then ignore it.
948# We don't use -e here because there are if statements
949# that should not make the command give up when the if condition is false.
950# Instead, we test for failure after each command where it matters.
4daa2154 951 for file in .. $(LIB1FUNCS_EXTRA); \
32e6d418 952 do \
953 if [ x$${file} != x.. ]; then \
24f83907 954 name=`echo $${file} | sed -e 's/[.][cS]$$//' -e 's/[.]asm$$//'`; \
32e6d418 955 echo $${name}; \
956 if [ $${name}.asm = $${file} ]; then \
f32abccb 957 cp $${file} $${name}.s || exit 1; file=$${name}.s; \
32e6d418 958 else true; fi; \
5eef7030 959 $(OLDCC) -DIN_LIBGCC1 $(CCLIBFLAGS) $(INCLUDES) -c $${file}; \
32e6d418 960 if [ $$? -eq 0 ] ; then true; else exit 1; fi; \
62268150 961 $(OLDAR) $(OLDAR_FLAGS) tmplibgcc1.a $${name}$(objext); \
32e6d418 962 if [ $$? -eq 0 ] ; then true; else exit 1; fi; \
62268150 963 rm -f $${name}.s $${name}$(objext); \
32e6d418 964 else true; \
965 fi; \
966 done
0f557c81 967 -if $(RANLIB_TEST) ; then $(RANLIB) tmplibgcc1.a; else true; fi
32e6d418 968 mv tmplibgcc1.a libgcc1.a
969
cf80c04b 970# Build libgcc1.a from assembler source. LIB1ASMFUNCS is the list of
971# functions. LIB1ASMSRC is the name of the source file in the config
972# subdirectory.
973libgcc1-asm.a: libgcc2.ready config.status $(srcdir)/config/$(LIB1ASMSRC)
974 -rm -f tmplibgcc1.a libgcc1.S
975 cp $(srcdir)/config/$(LIB1ASMSRC) libgcc1.S
976# Actually build it in tmplibgcc1.a, then rename at end,
977# so that libgcc1-asm.a itself remains nonexistent if compilation is aborted.
978# -e causes any failing command to make this rule fail.
979# -e doesn't work in certain shells, so we test $$? as well.
980# lynx has a broken ar, it always complains when the initial library is
981# empty, thus this command works only if we don't do -e
982# There is a trailing backslash (\) deleted from the following line.
983# set -e;
984 for name in $(LIB1ASMFUNCS); \
985 do \
986 echo $${name}; \
987 $(GCC_FOR_TARGET) $(LIBGCC2_CFLAGS) $(INCLUDES) -c -DL$${name} libgcc1.S; \
988 if [ $$? -eq 0 ] ; then true; else exit 1; fi; \
62268150 989 mv libgcc1$(objext) $${name}$(objext); \
990 $(AR) $(AR_FLAGS) tmplibgcc1.a $${name}$(objext); \
991 rm -f $${name}$(objext); \
cf80c04b 992 done
993 -rm -f libgcc1.S
994 mv tmplibgcc1.a libgcc1-asm.a
995
a20b21eb 996# Generate assembly versions of the functions required for libgcc1.
997# You'll still need to massage the code by hand (possibly hacking
998# underscores and local labels) but this will get you started.
999libgcc1.S: libgcc1.c $(CONFIG_H) config.status
1000 -rm -f libgcc1.S
1001 touch libgcc1.S
1002 for name in $(LIB1FUNCS); \
1003 do \
1004 echo $${name}; \
5eef7030 1005 $(OLDCC) -DIN_LIBGCC1 $(CCLIBFLAGS) $(INCLUDES) -S -DL$${name} $(srcdir)/libgcc1.c; \
a20b21eb 1006 if [ $$? -eq 0 ] ; then true; else exit 1; fi; \
1007 echo '#ifdef ' L$${name} >> libgcc1.S; \
1008 cat libgcc1.s >> libgcc1.S; \
1009 echo '#endif /*' L$${name} '*/' >> libgcc1.S; \
1010 echo "" >> libgcc1.S; \
1011 done
1012
32e6d418 1013# Compiling libgcc2.a requires making sure that cc1, etc. have been compiled.
1014# But recompiling cc1 should not force recompilation of libgcc2.a.
1015# If you want to force recompilation, delete libgcc2.a.
d54b81e0 1016libgcc2.ready: $(GCC_PASSES) $(LIBGCC2_DEPS) stmp-int-hdrs $(STMP_FIXPROTO)
32e6d418 1017 -if [ -f libgcc2.ready ] ; then \
1018 true; \
1019 else \
1020 touch libgcc2.ready; \
1021 fi
1022
447a9eb9 1023LIB2ADD = $(srcdir)/frame.c $(LIB2FUNCS_EXTRA) $(LANG_LIB2FUNCS)
04ddb594 1024libgcc2.a: libgcc2.c libgcc2.ready $(CONFIG_H) $(FPBIT) $(DPBIT) $(LIB2ADD) \
4a7d7a8b 1025 machmode.h longlong.h frame.h gbl-ctors.h config.status
32e6d418 1026# Actually build it in tmplibgcc2.a, then rename at end,
1027# so that libgcc2.a itself remains nonexistent if compilation is aborted.
1028 -rm -f tmplibgcc2.a
1029# -e causes any failing command to make this rule fail.
1030# -e doesn't work in certain shells, so we test $$? as well.
547e1b60 1031# lynx has a broken ar, it always complains when the initial library is
1032# empty, thus this command works only if we don't do -e
1033# There is a trailing backslash (\) deleted from the following line.
1034# set -e;
32e6d418 1035 for name in $(LIB2FUNCS); \
1036 do \
1037 echo $${name}; \
c6396a0b 1038 $(GCC_FOR_TARGET) $(LIBGCC2_CFLAGS) $(INCLUDES) -c -DL$${name} \
62268150 1039 $(srcdir)/libgcc2.c -o $${name}$(objext); \
32e6d418 1040 if [ $$? -eq 0 ] ; then true; else exit 1; fi; \
62268150 1041 $(AR) $(AR_FLAGS) tmplibgcc2.a $${name}$(objext); \
1042 rm -f $${name}$(objext); \
32e6d418 1043 done
a69e7f5f 1044 for name in $(LIB2FUNCS_EH); \
1045 do \
1046 echo $${name}; \
1047 $(GCC_FOR_TARGET) $(LIBGCC2_CFLAGS) -fexceptions $(INCLUDES) -c \
1048 -DL$${name} $(srcdir)/libgcc2.c -o $${name}$(objext); \
1049 if [ $$? -eq 0 ] ; then true; else exit 1; fi; \
1050 $(AR) $(AR_FLAGS) tmplibgcc2.a $${name}$(objext); \
1051 rm -f $${name}$(objext); \
1052 done
04ddb594 1053 if [ x$(FPBIT) != x ]; then \
1054 for name in $(FPBIT_FUNCS); \
1055 do \
1056 echo $${name}; \
1057 $(GCC_FOR_TARGET) $(LIBGCC2_CFLAGS) $(INCLUDES) -c -DL$${name} \
1058 -DFINE_GRAINED_LIBRARIES $(FPBIT) -o $${name}$(objext); \
1059 if [ $$? -eq 0 ] ; then true; else exit 1; fi; \
1060 $(AR) $(AR_FLAGS) tmplibgcc2.a $${name}$(objext); \
1061 rm -f $${name}$(objext); \
1062 done; \
1063 else true; fi;
1064 if [ x$(DPBIT) != x ]; then \
1065 for name in $(DPBIT_FUNCS); \
1066 do \
1067 echo $${name}; \
1068 $(GCC_FOR_TARGET) $(LIBGCC2_CFLAGS) $(INCLUDES) -c -DL$${name} \
1069 -DFINE_GRAINED_LIBRARIES $(DPBIT) -o $${name}$(objext); \
1070 if [ $$? -eq 0 ] ; then true; else exit 1; fi; \
1071 $(AR) $(AR_FLAGS) tmplibgcc2.a $${name}$(objext); \
1072 rm -f $${name}$(objext); \
1073 done; \
1074 else true; fi;
32e6d418 1075# Some shells crash when a loop has no items.
1076# So make sure there is always at least one--`..'.
1077# Then ignore it.
1078# We don't use -e here because there are if statements
1079# that should not make the command give up when the if condition is false.
1080# Instead, we test for failure after each command where it matters.
447a9eb9 1081 for file in $(LIB2ADD); do \
1082 name=`echo $${file} | sed -e 's/[.][cSo]$$//' -e 's/[.]asm$$//' -e 's/[.]txt$$//'`; \
1083 oname=` echo $${name} | sed -e 's,.*/,,'`; \
1084 if [ $${name}.txt = $${file} ]; then \
1085 for f in .. `cat $${file}`; do if [ x$${f} != x.. ]; then \
1086 $(MAKE) GCC_FOR_TARGET="$(GCC_FOR_TARGET)" \
1087 AR="$(AR)" AR_FLAGS="$(AR_FLAGS)" CC="$(CC)" \
1088 CFLAGS="$(CFLAGS)" HOST_PREFIX="$(HOST_PREFIX)" \
1089 HOST_PREFIX_1="$(HOST_PREFIX_1)" \
1090 LANGUAGES="$(LANGUAGES)" \
1091 LIBGCC2_CFLAGS="$(LIBGCC2_CFLAGS)" $${f}; \
6143c0f8 1092 if [ $$? -eq 0 ] ; then true; else exit 1; fi; \
447a9eb9 1093 $(AR) $(AR_FLAGS) tmplibgcc2.a $${f}; \
1094 rm -f $${f}; \
1095 else true; \
1096 fi; done; \
1097 else \
1098 echo $${name}; \
1099 if [ $${name}.asm = $${file} ]; then \
1100 cp $${file} $${name}.s || exit 1; file=$${name}.s; \
1101 else true; fi; \
1102 $(GCC_FOR_TARGET) $(LIBGCC2_CFLAGS) $(INCLUDES) -c $${file}; \
1103 if [ $$? -eq 0 ] ; then true; else exit 1; fi; \
1104 $(AR) $(AR_FLAGS) tmplibgcc2.a $${oname}$(objext); \
1105 rm -f $${name}.s $${oname}$(objext); \
32e6d418 1106 fi; \
1107 done
1108 mv tmplibgcc2.a libgcc2.a
1109# These lines were deleted from above the mv command
1110# because ranlibing libgcc.a itself should suffice.
1111# -if [ x${HPUX_GAS} = x ] ; then \
13194ea9 1112# if $(RANLIB_TEST) ; then $(RANLIB) tmplibgcc2.a; else true; fi; \
32e6d418 1113# else true; fi
1114
1115# Combine the various libraries into a single library, libgcc.a.
1116libgcc.a: $(LIBGCC1) $(LIBGCC2)
1117 -rm -rf tmplibgcc.a libgcc.a tmpcopy
1118 mkdir tmpcopy
c6396a0b 1119 -if [ x$(LIBGCC1) != x ]; \
1120 then (cd tmpcopy; $(AR) x ../$(LIBGCC1)); \
1121 else true; \
1122 fi
edf5976e 1123# Some versions of ar (specifically the one in RISC/os 5.x), create an
1124# unwritable table of contents file, and then print an error message when
1125# the second ar command tries to overwrite this file. To avoid the error
1126# message from ar, we make sure all files are writable.
75c6d942 1127 -(cd tmpcopy; chmod +w * > /dev/null 2>&1)
32e6d418 1128 (cd tmpcopy; $(AR) x ../$(LIBGCC2))
62268150 1129 (cd tmpcopy; $(AR) $(AR_FLAGS) ../tmplibgcc.a *$(objext))
32e6d418 1130 rm -rf tmpcopy
1131 -if $(RANLIB_TEST) ; then $(RANLIB) tmplibgcc.a; else true; fi
1132# Actually build it in tmplibgcc.a, then rename at end,
1133# so that libgcc.a itself remains nonexistent if compilation is aborted.
1134 mv tmplibgcc.a libgcc.a
1135
f1ad3130 1136# Use the genmultilib shell script to generate the information the gcc
1137# driver program needs to select the library directory based on the
1138# switches.
997d68fe 1139multilib.h: s-mlib; @true
1140s-mlib: $(srcdir)/genmultilib Makefile
3d97d965 1141 $(SHELL) $(srcdir)/genmultilib \
1142 "$(MULTILIB_OPTIONS)" \
1143 "$(MULTILIB_DIRNAMES)" \
1144 "$(MULTILIB_MATCHES)" \
1145 "$(MULTILIB_EXCEPTIONS)" \
1146 "$(MULTILIB_EXTRA_OPTS)" > tmp-mlib.h
1147 $(srcdir)/move-if-change tmp-mlib.h multilib.h
997d68fe 1148 touch s-mlib
f1ad3130 1149
1150# Build multiple copies of libgcc.a, one for each target switch.
1151stmp-multilib: $(LIBGCC1) libgcc2.c libgcc2.ready $(CONFIG_H) \
4a7d7a8b 1152 frame.h \
447a9eb9 1153 $(LIB2ADD) machmode.h longlong.h gbl-ctors.h config.status
f1ad3130 1154 for i in `$(GCC_FOR_TARGET) --print-multi-lib`; do \
1155 dir=`echo $$i | sed -e 's/;.*$$//'`; \
1156 flags=`echo $$i | sed -e 's/^[^;]*;//' -e 's/@/ -/g'`; \
f1ad3130 1157 $(MAKE) GCC_FOR_TARGET="$(GCC_FOR_TARGET)" \
3ab62051 1158 AR="$(AR)" AR_FLAGS="$(AR_FLAGS)" CC="$(CC)" CFLAGS="$(CFLAGS)" \
00075505 1159 RANLIB="$(RANLIB)" RANLIB_TEST="$(RANLIB_TEST)" \
93ed8bee 1160 LANGUAGES="$(LANGUAGES)" \
f1ad3130 1161 HOST_PREFIX="$(HOST_PREFIX)" HOST_PREFIX_1="$(HOST_PREFIX_1)" \
00075505 1162 LIBGCC2_CFLAGS="$(LIBGCC2_CFLAGS) $${flags}" \
cdc96909 1163 MULTILIB_CFLAGS="$${flags}" \
00075505 1164 LIBGCC1="$(LIBGCC1)" LIBGCC2="$(LIBGCC2)" \
1165 dir="$${dir}" stmp-multilib-sub; \
ee4720a9 1166 if [ $$? -eq 0 ] ; then true; else exit 1; fi; \
f1ad3130 1167 done
1168 touch stmp-multilib
1169
00075505 1170# Subroutine of stmp-multilib so make -n works.
1171stmp-multilib-sub:
cdc96909 1172 rm -f $(LIBGCC2)
1173 if [ -d $(dir) ]; then \
1174 cd $(dir); \
1175 rm -f libgcc.a $(EXTRA_MULTILIB_PARTS); \
a123fd67 1176 else true; \
cdc96909 1177 fi
00075505 1178 $(MAKE) GCC_FOR_TARGET="$(GCC_FOR_TARGET)" \
3ab62051 1179 AR="$(AR)" AR_FLAGS="$(AR_FLAGS)" CC="$(CC)" CFLAGS="$(CFLAGS)" \
00075505 1180 HOST_PREFIX="$(HOST_PREFIX)" HOST_PREFIX_1="$(HOST_PREFIX_1)" \
93ed8bee 1181 LANGUAGES="$(LANGUAGES)" \
00075505 1182 LIBGCC2_CFLAGS="$(LIBGCC2_CFLAGS)" $(LIBGCC2)
1183 if [ x$(LIBGCC1) != xlibgcc1-asm.a ]; \
1184 then true; \
1185 else rm -f $(LIBGCC1); \
1186 fi
1187 if [ x$(LIBGCC1) != xlibgcc1-asm.a ]; \
1188 then true; \
1189 else \
1190 $(MAKE) GCC_FOR_TARGET="$(GCC_FOR_TARGET)" \
3ab62051 1191 AR="$(AR)" AR_FLAGS="$(AR_FLAGS)" CC="$(CC)" CFLAGS="$(CFLAGS)" \
00075505 1192 HOST_PREFIX="$(HOST_PREFIX)" HOST_PREFIX_1="$(HOST_PREFIX_1)" \
93ed8bee 1193 LANGUAGES="$(LANGUAGES)" \
00075505 1194 LIBGCC2_CFLAGS="$(LIBGCC2_CFLAGS)" $(LIBGCC1); \
1195 fi
1196 rm -rf tmplibgcc.a tmpcopy
1197 mkdir tmpcopy
1198 if [ x$(LIBGCC1) != x ]; \
1199 then (cd tmpcopy; $(AR) x ../$(LIBGCC1)); \
1200 else true; \
1201 fi
1202 (cd tmpcopy; $(AR) x ../$(LIBGCC2))
601520ec 1203 (cd tmpcopy; $(AR) $(AR_FLAGS) ../tmplibgcc.a *$(objext))
00075505 1204 rm -rf libgcc2.a tmpcopy
1205 if $(RANLIB_TEST) ; then $(RANLIB) tmplibgcc.a; else true; fi
1206 if [ -d $(dir) ]; then true; else mkdir $(dir); fi
1207 mv tmplibgcc.a $(dir)/libgcc.a
cdc96909 1208 for f in .. $(EXTRA_MULTILIB_PARTS); do if [ x$${f} != x.. ]; then \
1209 $(MAKE) GCC_FOR_TARGET="$(GCC_FOR_TARGET)" \
1210 AR="$(AR)" AR_FLAGS="$(AR_FLAGS)" CC="$(CC)" CFLAGS="$(CFLAGS)" \
1211 HOST_PREFIX="$(HOST_PREFIX)" HOST_PREFIX_1="$(HOST_PREFIX_1)" \
0d0b968b 1212 LANGUAGES="$(LANGUAGES)" \
cdc96909 1213 MULTILIB_CFLAGS="$(MULTILIB_CFLAGS)" T="t" t$${f}; \
1214 mv t$${f} $(dir)/$${f}; \
a123fd67 1215 else true; \
cdc96909 1216 fi; done
00075505 1217
32e6d418 1218# Compile two additional files that are linked with every program
6bcd7097 1219# linked using GCC on systems using COFF or ELF, for the sake of C++
1220# constructors.
ad87de1e 1221$(T)crtbegin.o: crtstuff.c $(GCC_PASSES) $(CONFIG_H) \
1222 defaults.h frame.h gbl-ctors.h
6efd403b 1223 $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(INCLUDES) $(MULTILIB_CFLAGS) -g0 \
447a9eb9 1224 -finhibit-size-directive -fno-inline-functions -fno-exceptions $(CRTSTUFF_T_CFLAGS) \
6efd403b 1225 -c $(srcdir)/crtstuff.c -DCRT_BEGIN -o $(T)crtbegin$(objext)
cdc96909 1226
ad87de1e 1227$(T)crtend.o: crtstuff.c $(GCC_PASSES) $(CONFIG_H) \
1228 defaults.h frame.h gbl-ctors.h
6efd403b 1229 $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(INCLUDES) $(MULTILIB_CFLAGS) -g0 \
447a9eb9 1230 -finhibit-size-directive -fno-inline-functions -fno-exceptions $(CRTSTUFF_T_CFLAGS) \
6efd403b 1231 -c $(srcdir)/crtstuff.c -DCRT_END -o $(T)crtend$(objext)
6bcd7097 1232
1233# On some systems we also want to install versions of these files
1234# compiled using PIC for use in shared libraries.
997d68fe 1235crtbeginS.o crtendS.o: s-crtS ; @true
6bcd7097 1236
997d68fe 1237s-crtS: crtstuff.c $(GCC_PASSES) $(CONFIG_H) \
ad87de1e 1238 defaults.h frame.h gbl-ctors.h
5eef7030 1239 $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(INCLUDES) $(CRTSTUFF_T_CFLAGS_S) \
8aed3df8 1240 -DCRT_BEGIN -DCRTSTUFFS_O -finhibit-size-directive -fno-inline-functions \
1241 -fno-exceptions -g0 -c $(srcdir)/crtstuff.c
6bcd7097 1242 mv crtstuff$(objext) crtbeginS$(objext)
5eef7030 1243 $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(INCLUDES) $(CRTSTUFF_T_CFLAGS_S) \
8aed3df8 1244 -DCRT_END -DCRTSTUFFS_O -finhibit-size-directive -fno-inline-functions \
1245 -fno-exceptions -g0 -c $(srcdir)/crtstuff.c -o crtendS$(objext)
997d68fe 1246 touch s-crtS
4d3c962c 1247
1248# Compile the start modules crt0.o and mcrt0.o that are linked with every program
997d68fe 1249crt0.o: s-crt0 ; @true
1250mcrt0.o: s-crt0; @true
4d3c962c 1251
997d68fe 1252s-crt0: $(CRT0_S) $(MCRT0_S) $(GCC_PASSES) $(CONFIG_H)
4d3c962c 1253 $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(CRT0STUFF_T_CFLAGS) \
1254 -o crt0.o -c $(CRT0_S)
1255 $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(CRT0STUFF_T_CFLAGS) \
1256 -o mcrt0.o -c $(MCRT0_S)
997d68fe 1257 touch s-crt0
2e9d8ccf 1258#\f
32e6d418 1259# Compiling object files from source files.
1260
1261# Note that dependencies on obstack.h are not written
1262# because that file is not part of GCC.
32e6d418 1263
1264# C language specific files.
1265
41b06fe4 1266c-parse.o : $(srcdir)/c-parse.c $(CONFIG_H) $(TREE_H) c-lex.h \
c3ab7bd5 1267 $(srcdir)/c-parse.h c-tree.h input.h flags.h system.h toplev.h
32e6d418 1268 $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) -c $(srcdir)/c-parse.c
112e5dd0 1269$(srcdir)/c-parse.h: $(srcdir)/c-parse.c
1270$(srcdir)/c-parse.c: $(srcdir)/c-parse.y
ab2562cb 1271 cd $(srcdir); $(BISON) $(BISONFLAGS) -d c-parse.y -o c-parse.c
0f557c81 1272$(srcdir)/c-parse.y: c-parse.in
04e167f4 1273 echo '/*WARNING: This file is automatically generated!*/' >tmp-c-parse.y
d7c691fa 1274 sed -e "/^ifobjc$$/,/^end ifobjc$$/d" \
1275 -e "/^ifc$$/d" -e "/^end ifc$$/d" \
04e167f4 1276 $(srcdir)/c-parse.in >>tmp-c-parse.y
a58045a1 1277 $(srcdir)/move-if-change tmp-c-parse.y $(srcdir)/c-parse.y
d7c691fa 1278
0f557c81 1279$(srcdir)/c-gperf.h: c-parse.gperf
c9c642bd 1280 gperf -L KR-C -F ', 0, 0' -p -j1 -i 1 -g -o -t -G -N is_reserved_word \
1281 -k1,3,$$ $(srcdir)/c-parse.gperf >tmp-gperf.h
a58045a1 1282 $(srcdir)/move-if-change tmp-gperf.h $(srcdir)/c-gperf.h
6a4a0b58 1283
405711de 1284c-decl.o : c-decl.c $(CONFIG_H) system.h $(TREE_H) c-tree.h c-lex.h flags.h \
c3ab7bd5 1285 output.h toplev.h
405711de 1286c-typeck.o : c-typeck.c $(CONFIG_H) system.h $(TREE_H) c-tree.h flags.h \
ae262a47 1287 output.h $(EXPR_H) $(RTL_H) toplev.h
a986b5e0 1288c-lang.o : c-lang.c $(CONFIG_H) system.h $(TREE_H) c-tree.h c-lex.h toplev.h \
1289 output.h
405711de 1290c-lex.o : c-lex.c $(CONFIG_H) system.h $(TREE_H) $(RTL_H) c-lex.h c-tree.h \
cd03a192 1291 $(srcdir)/c-parse.h input.h flags.h $(srcdir)/c-gperf.h c-pragma.h \
33a62e3f 1292 toplev.h output.h mbchar.h
405711de 1293c-aux-info.o : c-aux-info.c $(CONFIG_H) system.h $(TREE_H) c-tree.h flags.h
c3ab7bd5 1294c-convert.o : c-convert.c $(CONFIG_H) system.h $(TREE_H) flags.h toplev.h
bd3b1088 1295c-pragma.o: c-pragma.c $(CONFIG_H) system.h $(RTL_H) $(TREE_H) except.h \
1296 function.h defaults.h c-pragma.h toplev.h
405711de 1297c-iterate.o: c-iterate.c $(CONFIG_H) system.h $(TREE_H) $(RTL_H) c-tree.h \
ae262a47 1298 flags.h toplev.h $(EXPR_H)
4a7d7a8b 1299mbchar.o: mbchar.c $(CONFIG_H) system.h mbchar.h
27f5edd1 1300graph.o: graph.c $(CONFIG_H) system.h toplev.h flags.h output.h $(RTL_H) \
3eaf50a4 1301 hard-reg-set.h basic-block.h
32e6d418 1302
7f6a6499 1303collect2$(exeext): collect2.o tlink.o hash.o cplus-dem.o underscore.o \
07a3679c 1304 version.o choose-temp.o mkstemp.o $(LIBDEPS)
e77fd588 1305# Don't try modifying collect2 (aka ld) in place--it might be linking this.
62268150 1306 -rm -f collect2$(exeext)
94ca3aab 1307 $(CC) $(ALL_CFLAGS) $(LDFLAGS) -o $@ collect2.o tlink.o hash.o \
07a3679c 1308 cplus-dem.o underscore.o version.o choose-temp.o mkstemp.o $(LIBS)
32e6d418 1309
4a7d7a8b 1310collect2.o : collect2.c $(CONFIG_H) system.h gstab.h \
1ae13971 1311 $(srcdir)/../include/obstack.h $(DEMANGLE_H) collect2.h
5e03c63d 1312 $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \
67cb4bc1 1313 -DTARGET_MACHINE=\"$(target_alias)\" $(MAYBE_USE_COLLECT2) \
5e03c63d 1314 -c `echo $(srcdir)/collect2.c | sed 's,^\./,,'`
32e6d418 1315
1ae13971 1316tlink.o: tlink.c $(DEMANGLE_H) hash.h $(CONFIG_H) system.h toplev.h collect2.h
c3ab7bd5 1317hash.o: hash.c hash.h system.h toplev.h
cc895f11 1318
0f9685e4 1319cplus-dem.o: $(srcdir)/../libiberty/cplus-dem.c $(DEMANGLE_H)
cc895f11 1320 rm -f cplus-dem.c
1321 $(LN_S) $(srcdir)/../libiberty/cplus-dem.c cplus-dem.c
1322 $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) cplus-dem.c
d2f0b724 1323
4a7d7a8b 1324pexecute.o: $(srcdir)/../libiberty/pexecute.c $(CONFIG_H) system.h
44a8856e 1325 rm -f pexecute.c
1326 $(LN_S) $(srcdir)/../libiberty/pexecute.c pexecute.c
1327 $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) pexecute.c
1328
4a7d7a8b 1329vfprintf.o: $(srcdir)/../libiberty/vfprintf.c $(CONFIG_H) system.h
099377d8 1330 rm -f vfprintf.c
1331 $(LN_S) $(srcdir)/../libiberty/vfprintf.c vfprintf.c
1332 $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) vfprintf.c
1333
a5b1863e 1334splay-tree.o: $(srcdir)/../libiberty/splay-tree.c \
4a7d7a8b 1335 $(srcdir)/../include/splay-tree.h $(srcdir)/../include/libiberty.h
a5b1863e 1336 rm -f splay-tree.c
1337 $(LN_S) $(srcdir)/../libiberty/splay-tree.c splay-tree.c
1338 $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) splay-tree.c
1339
997d68fe 1340underscore.c: s-under ; @true
7306ddcf 1341
997d68fe 1342s-under: $(GCC_PASSES)
c20b28d5 1343 echo "int xxy_us_dummy;" >tmp-dum.c
1344 $(GCC_FOR_TARGET) -S tmp-dum.c
1345 echo '/*WARNING: This file is automatically generated!*/' >tmp-under.c
1346 if grep _xxy_us_dummy tmp-dum.s > /dev/null ; then \
1347 echo "int prepends_underscore = 1;" >>tmp-under.c; \
d2f0b724 1348 else \
c20b28d5 1349 echo "int prepends_underscore = 0;" >>tmp-under.c; \
d2f0b724 1350 fi
c20b28d5 1351 $(srcdir)/move-if-change tmp-under.c underscore.c
1352 -rm -f tmp-dum.c tmp-dum.s
997d68fe 1353 touch s-under
d2f0b724 1354
32e6d418 1355# A file used by all variants of C.
1356
c3ab7bd5 1357c-common.o : c-common.c $(CONFIG_H) system.h $(TREE_H) c-tree.h c-lex.h \
9516807d 1358 flags.h toplev.h output.h c-pragma.h $(RTL_H)
32e6d418 1359
1360# Language-independent files.
1361
4813bdd4 1362DRIVER_DEFINES = \
21b72f91 1363 -DSTANDARD_STARTFILE_PREFIX=\"$(libdir)/\" \
c6396a0b 1364 -DSTANDARD_EXEC_PREFIX=\"$(libdir)/gcc-lib/\" \
7df9e578 1365 -DDEFAULT_TARGET_VERSION=\"$(version)\" \
67cb4bc1 1366 -DDEFAULT_TARGET_MACHINE=\"$(target_alias)\" \
21b72f91 1367 -DTOOLDIR_BASE_PREFIX=\"$(exec_prefix)/\"
7bcdc3c7 1368gcc.o: gcc.c $(CONFIG_H) system.h multilib.h Makefile prefix.h \
5ae2e30a 1369 $(lang_specs_files)
4813bdd4 1370 $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \
1371 $(DRIVER_DEFINES) \
32e6d418 1372 -c `echo $(srcdir)/gcc.c | sed 's,^\./,,'`
1373
3e207e38 1374tree-check.h: s-check ; @true
1051d196 1375s-check : gencheck $(srcdir)/move-if-change
3e207e38 1376 ./gencheck > tmp-check.h
1377 $(srcdir)/move-if-change tmp-check.h tree-check.h
1378 touch s-check
1379
c3cc26e1 1380gencheck : gencheck.o tree.def $(lang_tree_files) $(HOST_LIBDEPS)
3e207e38 1381 $(HOST_CC) $(HOST_CFLAGS) $(HOST_LDFLAGS) -o $@ \
1382 gencheck.o $(HOST_LIBS)
1383
4a7d7a8b 1384gencheck.o : gencheck.c hconfig.h system.h
580b113f 1385 $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(srcdir)/gencheck.c
1386
32e6d418 1387dumpvers: dumpvers.c
1388
1389version.o: version.c
7b6bbd12 1390obstack.o: $(srcdir)/../libiberty/obstack.c $(CONFIG_H)
1391 rm -f obstack.c
1392 $(LN_S) $(srcdir)/../libiberty/obstack.c obstack.c
1393 $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) obstack.c
1394
4a7d7a8b 1395choose-temp.o: $(srcdir)/../libiberty/choose-temp.c $(CONFIG_H) system.h
c11a14ed 1396 rm -f choose-temp.c
1397 $(LN_S) $(srcdir)/../libiberty/choose-temp.c choose-temp.c
1398 $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) choose-temp.c
1399
4a7d7a8b 1400mkstemp.o: $(srcdir)/../libiberty/mkstemp.c $(CONFIG_H) system.h
c11a14ed 1401 rm -f mkstemp.c
1402 $(LN_S) $(srcdir)/../libiberty/mkstemp.c mkstemp.c
1403 $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) mkstemp.c
1404
7bcdc3c7 1405prefix.o: prefix.c $(CONFIG_H) system.h Makefile prefix.h
0dbd1c74 1406 $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \
1407 -DPREFIX=\"$(prefix)\" \
1408 -c `echo $(srcdir)/prefix.c | sed 's,^\./,,'`
32e6d418 1409
c3ab7bd5 1410convert.o: convert.c $(CONFIG_H) $(TREE_H) flags.h convert.h toplev.h
beb68ac1 1411
bd3b1088 1412tree.o : tree.c $(CONFIG_H) system.h $(TREE_H) flags.h function.h toplev.h except.h
405711de 1413print-tree.o : print-tree.c $(CONFIG_H) system.h $(TREE_H)
c091e5a4 1414stor-layout.o : stor-layout.c $(CONFIG_H) system.h $(TREE_H) flags.h \
ae262a47 1415 function.h $(EXPR_H) $(RTL_H) toplev.h except.h
0f9685e4 1416fold-const.o : fold-const.c $(CONFIG_H) system.h $(TREE_H) flags.h toplev.h \
1417 $(RTL_H)
405711de 1418toplev.o : toplev.c $(CONFIG_H) system.h $(TREE_H) $(RTL_H) \
636fef92 1419 flags.h input.h insn-attr.h xcoffout.h defaults.h output.h \
ae262a47 1420 insn-codes.h insn-config.h $(RECOG_H) Makefile toplev.h dwarfout.h \
74273693 1421 dwarf2out.h sdbout.h dbxout.h $(EXPR_H) \
636fef92 1422 $(lang_options_files)
b600804e 1423 $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $(MAYBE_USE_COLLECT2) \
67cb4bc1 1424 -DTARGET_NAME=\"$(target_alias)\" \
fe918d35 1425 -c `echo $(srcdir)/toplev.c | sed 's,^\./,,'`
32e6d418 1426
a3426c4c 1427rtl.o : rtl.c $(CONFIG_H) system.h $(RTL_H) bitmap.h
32e6d418 1428
0e93a6ac 1429print-rtl.o : print-rtl.c $(CONFIG_H) system.h $(RTL_H) bitmap.h
405711de 1430rtlanal.o : rtlanal.c $(CONFIG_H) system.h $(RTL_H)
32e6d418 1431
405711de 1432varasm.o : varasm.c $(CONFIG_H) system.h $(TREE_H) $(RTL_H) flags.h \
d6ff8d83 1433 function.h defaults.h $(EXPR_H) hard-reg-set.h $(REGS_H) \
ad6c9a58 1434 xcoffout.h output.h c-pragma.h toplev.h except.h dbxout.h sdbout.h
405711de 1435function.o : function.c $(CONFIG_H) system.h $(RTL_H) $(TREE_H) flags.h \
d6ff8d83 1436 function.h insn-flags.h insn-codes.h $(EXPR_H) $(REGS_H) hard-reg-set.h \
a6cb55bb 1437 insn-config.h $(RECOG_H) output.h toplev.h except.h
405711de 1438stmt.o : stmt.c $(CONFIG_H) system.h $(RTL_H) $(TREE_H) flags.h function.h \
ae262a47 1439 insn-flags.h insn-config.h insn-codes.h hard-reg-set.h $(EXPR_H) except.h \
cd03a192 1440 loop.h $(RECOG_H) toplev.h output.h
405711de 1441except.o : except.c $(CONFIG_H) system.h $(RTL_H) $(TREE_H) flags.h \
d6ff8d83 1442 function.h insn-flags.h $(EXPR_H) $(REGS_H) hard-reg-set.h \
c3ab7bd5 1443 insn-config.h $(RECOG_H) output.h except.h toplev.h
405711de 1444expr.o : expr.c $(CONFIG_H) system.h $(RTL_H) $(TREE_H) flags.h function.h \
d6ff8d83 1445 $(REGS_H) insn-flags.h insn-codes.h $(EXPR_H) insn-config.h $(RECOG_H) output.h \
21ff0670 1446 typeclass.h hard-reg-set.h toplev.h hard-reg-set.h except.h
ae262a47 1447calls.o : calls.c $(CONFIG_H) system.h $(RTL_H) $(TREE_H) flags.h $(EXPR_H) \
d6ff8d83 1448 insn-flags.h $(REGS_H) toplev.h output.h
405711de 1449expmed.o : expmed.c $(CONFIG_H) system.h $(RTL_H) $(TREE_H) flags.h \
ae262a47 1450 insn-flags.h insn-config.h insn-codes.h $(EXPR_H) $(RECOG_H) real.h
405711de 1451explow.o : explow.c $(CONFIG_H) system.h $(RTL_H) $(TREE_H) flags.h \
ae262a47 1452 hard-reg-set.h insn-config.h $(EXPR_H) $(RECOG_H) insn-flags.h insn-codes.h
405711de 1453optabs.o : optabs.c $(CONFIG_H) system.h $(RTL_H) $(TREE_H) flags.h \
ae262a47 1454 insn-flags.h insn-config.h insn-codes.h $(EXPR_H) $(RECOG_H) reload.h
d6ff8d83 1455dbxout.o : dbxout.c $(CONFIG_H) system.h $(TREE_H) $(RTL_H) flags.h $(REGS_H) \
0e93a6ac 1456 insn-config.h reload.h gstab.h xcoffout.h defaults.h output.h dbxout.h \
1457 toplev.h
405711de 1458sdbout.o : sdbout.c $(CONFIG_H) system.h $(TREE_H) $(RTL_H) flags.h except.h \
d6ff8d83 1459 function.h $(EXPR_H) output.h hard-reg-set.h $(REGS_H) defaults.h real.h \
7b6bbd12 1460 insn-config.h $(srcdir)/../include/obstack.h xcoffout.h c-pragma.h \
1461 sdbout.h toplev.h
405711de 1462dwarfout.o : dwarfout.c $(CONFIG_H) system.h $(TREE_H) $(RTL_H) dwarf.h \
744d3441 1463 flags.h insn-config.h reload.h output.h defaults.h toplev.h dwarfout.h
405711de 1464dwarf2out.o : dwarf2out.c $(CONFIG_H) system.h $(TREE_H) $(RTL_H) dwarf2.h \
ae262a47 1465 flags.h insn-config.h reload.h output.h defaults.h \
7eb169ba 1466 hard-reg-set.h $(REGS_H) $(EXPR_H) toplev.h dwarf2out.h dyn-string.h
405711de 1467xcoffout.o : xcoffout.c $(CONFIG_H) system.h $(TREE_H) $(RTL_H) xcoffout.h \
600e851b 1468 flags.h toplev.h output.h dbxout.h
405711de 1469emit-rtl.o : emit-rtl.c $(CONFIG_H) system.h $(RTL_H) $(TREE_H) flags.h \
d6ff8d83 1470 except.h function.h $(REGS_H) insn-config.h $(RECOG_H) real.h \
7b6bbd12 1471 $(EXPR_H) $(srcdir)/../include/obstack.h hard-reg-set.h bitmap.h
c3ab7bd5 1472real.o : real.c $(CONFIG_H) system.h $(TREE_H) toplev.h
405711de 1473getpwd.o : getpwd.c $(CONFIG_H) system.h
1474
1475integrate.o : integrate.c $(CONFIG_H) system.h $(RTL_H) $(TREE_H) flags.h \
d6ff8d83 1476 integrate.h insn-flags.h insn-config.h $(EXPR_H) real.h $(REGS_H) \
cd03a192 1477 function.h output.h $(RECOG_H) except.h toplev.h
405711de 1478
d6ff8d83 1479jump.o : jump.c $(CONFIG_H) system.h $(RTL_H) flags.h hard-reg-set.h $(REGS_H) \
ae262a47 1480 insn-config.h insn-flags.h $(RECOG_H) $(EXPR_H) real.h except.h \
ce1fd7fc 1481 toplev.h
d6ff8d83 1482stupid.o : stupid.c $(CONFIG_H) system.h $(RTL_H) $(REGS_H) hard-reg-set.h \
e94a59c6 1483 $(BASIC_BLOCK_H) insn-config.h reload.h flags.h toplev.h
32e6d418 1484
d6ff8d83 1485cse.o : cse.c $(CONFIG_H) system.h $(RTL_H) $(REGS_H) hard-reg-set.h flags.h \
ae262a47 1486 real.h insn-config.h $(RECOG_H) $(EXPR_H) toplev.h output.h
d6ff8d83 1487gcse.o : gcse.c $(CONFIG_H) system.h $(RTL_H) $(REGS_H) hard-reg-set.h flags.h \
ae262a47 1488 real.h insn-config.h $(RECOG_H) $(EXPR_H) $(BASIC_BLOCK_H) output.h
405711de 1489profile.o : profile.c $(CONFIG_H) system.h $(RTL_H) flags.h insn-flags.h \
0cefcd07 1490 gcov-io.h $(TREE_H) output.h $(REGS_H) toplev.h insn-config.h
405711de 1491loop.o : loop.c $(CONFIG_H) system.h $(RTL_H) flags.h loop.h insn-config.h \
d6ff8d83 1492 insn-flags.h $(REGS_H) hard-reg-set.h $(RECOG_H) $(EXPR_H) real.h \
ce1fd7fc 1493 toplev.h
ae262a47 1494unroll.o : unroll.c $(CONFIG_H) system.h $(RTL_H) insn-config.h \
d6ff8d83 1495 integrate.h $(REGS_H) $(RECOG_H) flags.h $(EXPR_H) loop.h toplev.h
405711de 1496flow.o : flow.c $(CONFIG_H) system.h $(RTL_H) flags.h insn-config.h \
ba1c8484 1497 $(BASIC_BLOCK_H) $(REGS_H) hard-reg-set.h output.h toplev.h recog.h
405711de 1498combine.o : combine.c $(CONFIG_H) system.h $(RTL_H) flags.h \
d6ff8d83 1499 insn-config.h insn-flags.h insn-codes.h insn-attr.h $(REGS_H) $(EXPR_H) \
ce1fd7fc 1500 $(BASIC_BLOCK_H) $(RECOG_H) real.h hard-reg-set.h toplev.h
405711de 1501regclass.o : regclass.c $(CONFIG_H) system.h $(RTL_H) hard-reg-set.h flags.h \
d6ff8d83 1502 $(BASIC_BLOCK_H) $(REGS_H) insn-config.h $(RECOG_H) reload.h real.h toplev.h \
cd03a192 1503 output.h
405711de 1504local-alloc.o : local-alloc.c $(CONFIG_H) system.h $(RTL_H) flags.h \
d6ff8d83 1505 $(BASIC_BLOCK_H) $(REGS_H) hard-reg-set.h insn-config.h $(RECOG_H) output.h \
ce1fd7fc 1506 insn-attr.h toplev.h
405711de 1507bitmap.o : bitmap.c $(CONFIG_H) system.h $(RTL_H) flags.h $(BASIC_BLOCK_H) \
d6ff8d83 1508 $(REGS_H)
e94a59c6 1509global.o : global.c $(CONFIG_H) system.h $(RTL_H) flags.h reload.h \
d6ff8d83 1510 $(BASIC_BLOCK_H) $(REGS_H) hard-reg-set.h insn-config.h output.h toplev.h
1511varray.o : varray.c $(CONFIG_H) system.h varray.h $(RTL_H) $(TREE_H) bitmap.h
32e6d418 1512
ae262a47 1513reload.o : reload.c $(CONFIG_H) system.h $(RTL_H) flags.h output.h $(EXPR_H) \
d6ff8d83 1514 reload.h $(RECOG_H) hard-reg-set.h insn-config.h insn-codes.h $(REGS_H) \
c3ab7bd5 1515 real.h toplev.h
ae262a47 1516reload1.o : reload1.c $(CONFIG_H) system.h $(RTL_H) real.h flags.h $(EXPR_H) \
d6ff8d83 1517 reload.h $(REGS_H) hard-reg-set.h insn-config.h insn-flags.h insn-codes.h \
c3ab7bd5 1518 $(BASIC_BLOCK_H) $(RECOG_H) output.h toplev.h
405711de 1519caller-save.o : caller-save.c $(CONFIG_H) system.h $(RTL_H) flags.h \
d6ff8d83 1520 $(REGS_H) hard-reg-set.h insn-config.h $(BASIC_BLOCK_H) \
ae262a47 1521 $(RECOG_H) reload.h $(EXPR_H) toplev.h
405711de 1522reorg.o : reorg.c $(CONFIG_H) system.h $(RTL_H) conditions.h hard-reg-set.h \
d6ff8d83 1523 $(BASIC_BLOCK_H) $(REGS_H) insn-config.h insn-attr.h \
ae262a47 1524 insn-flags.h $(RECOG_H) flags.h output.h $(EXPR_H)
308704fb 1525alias.o : alias.c $(CONFIG_H) system.h $(RTL_H) flags.h hard-reg-set.h \
a068b2a9 1526 $(REGS_H) toplev.h output.h $(EXPR_H)
405711de 1527regmove.o : regmove.c $(CONFIG_H) system.h $(RTL_H) insn-config.h \
d6ff8d83 1528 $(RECOG_H) output.h reload.h $(REGS_H) hard-reg-set.h flags.h \
ae262a47 1529 $(EXPR_H) insn-flags.h $(BASIC_BLOCK_H) toplev.h
405711de 1530$(SCHED_PREFIX)sched.o : $(SCHED_PREFIX)sched.c $(CONFIG_H) system.h $(RTL_H) \
274c11d8 1531 $(BASIC_BLOCK_H) $(REGS_H) hard-reg-set.h flags.h insn-config.h \
1532 insn-attr.h toplev.h recog.h
d6ff8d83 1533final.o : final.c $(CONFIG_H) system.h $(RTL_H) $(TREE_H) flags.h $(REGS_H) \
ad87de1e 1534 $(RECOG_H) conditions.h insn-config.h insn-attr.h except.h real.h output.h \
c3ab7bd5 1535 hard-reg-set.h insn-flags.h insn-codes.h gstab.h xcoffout.h defaults.h \
744d3441 1536 toplev.h reload.h dwarfout.h dwarf2out.h sdbout.h dbxout.h
405711de 1537recog.o : recog.c $(CONFIG_H) system.h $(RTL_H) \
d6ff8d83 1538 $(REGS_H) $(RECOG_H) hard-reg-set.h flags.h insn-config.h insn-attr.h \
4063e82c 1539 insn-flags.h insn-codes.h real.h toplev.h
78e49515 1540reg-stack.o : reg-stack.c $(CONFIG_H) system.h $(RTL_H) $(TREE_H) recog.h \
d6ff8d83 1541 $(REGS_H) hard-reg-set.h flags.h insn-config.h insn-flags.h toplev.h
4a7d7a8b 1542dyn-string.o: dyn-string.c dyn-string.h $(CONFIG_H) system.h
48c6936b 1543
5e7432f7 1544$(out_object_file): $(out_file) $(CONFIG_H) $(TREE_H) \
d6ff8d83 1545 $(RTL_H) $(REGS_H) hard-reg-set.h real.h insn-config.h conditions.h \
0e93a6ac 1546 insn-flags.h output.h insn-attr.h insn-codes.h system.h toplev.h
b600804e 1547 $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $(out_file)
32e6d418 1548
f213fcf9 1549# Build auxiliary files that support ecoff format.
1550mips-tfile: mips-tfile.o version.o $(LIBDEPS)
62268150 1551 $(CC) $(CFLAGS) $(LDFLAGS) -o $@ mips-tfile.o version.o $(LIBS)
f213fcf9 1552
1d9adefe 1553mips-tfile.o : mips-tfile.c $(CONFIG_H) $(RTL_H) system.h machmode.h
f213fcf9 1554
1555mips-tdump: mips-tdump.o version.o $(LIBDEPS)
62268150 1556 $(CC) $(CFLAGS) $(LDFLAGS) -o $@ mips-tdump.o version.o $(LIBS)
f213fcf9 1557
47003e2a 1558mips-tdump.o : mips-tdump.c $(CONFIG_H) $(RTL_H) system.h
f213fcf9 1559
636b182c 1560# Build file to support OSF/rose half-pic format.
1486870d 1561halfpic.o: halfpic.c $(CONFIG_H) $(RTL_H) $(TREE_H) system.h
636b182c 1562
32e6d418 1563# Normally this target is not used; but it is used if you
1564# define ALLOCA=alloca.o. In that case, you must get a suitable alloca.c
1565# from the GNU Emacs distribution.
099377d8 1566alloca.o: $(srcdir)/../libiberty/alloca.c
1567 rm -f alloca.c
1568 $(LN_S) $(srcdir)/../libiberty/alloca.c alloca.c
32e6d418 1569 $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $(ALLOCA_FLAGS) \
099377d8 1570 -c `echo alloca.c | sed 's,^\./,,'`
32e6d418 1571 $(ALLOCA_FINISH)
2e9d8ccf 1572#\f
32e6d418 1573# Generate header and source files from the machine description,
1574# and compile them.
1575
1576.PRECIOUS: insn-config.h insn-flags.h insn-codes.h \
1577 insn-emit.c insn-recog.c insn-extract.c insn-output.c insn-peep.c \
1578 insn-attr.h insn-attrtab.c
1579
1580# The following pair of rules has this effect:
1581# genconfig is run only if the md has changed since genconfig was last run;
1582# but the file insn-config.h is touched only when its contents actually change.
1583
1584# Each of the other insn-* files is handled by a similar pair of rules.
1585
3f69fed5 1586# This causes an anomaly in the results of make -n
997d68fe 1587# because insn-* is older than s-*
3f69fed5 1588# and thus make -n thinks that insn-* will be updated
1589# and force recompilation of things that depend on it.
9ac790c5 1590# We use move-if-change precisely to avoid such recompilation.
3f69fed5 1591# But there is no way to teach make -n that it will be avoided.
1592
32e6d418 1593# Each of the insn-*.[ch] rules has a semicolon at the end,
1594# for otherwise the system Make on SunOS 4.1 never tries
876dc5b0 1595# to recompile insn-*.o. To avoid problems and extra noise from
1596# versions of make which don't like empty commands (nothing after the
1597# trailing `;'), we call true for each.
32e6d418 1598
997d68fe 1599insn-config.h: s-config ; @true
1600s-config : $(md_file) genconfig $(srcdir)/move-if-change
c20b28d5 1601 ./genconfig $(md_file) > tmp-config.h
32e6d418 1602 $(srcdir)/move-if-change tmp-config.h insn-config.h
997d68fe 1603 touch s-config
32e6d418 1604
997d68fe 1605insn-flags.h: s-flags ; @true
1606s-flags : $(md_file) genflags $(srcdir)/move-if-change
c20b28d5 1607 ./genflags $(md_file) > tmp-flags.h
32e6d418 1608 $(srcdir)/move-if-change tmp-flags.h insn-flags.h
997d68fe 1609 touch s-flags
32e6d418 1610
997d68fe 1611insn-codes.h: s-codes ; @true
1612s-codes : $(md_file) gencodes $(srcdir)/move-if-change
c20b28d5 1613 ./gencodes $(md_file) > tmp-codes.h
32e6d418 1614 $(srcdir)/move-if-change tmp-codes.h insn-codes.h
997d68fe 1615 touch s-codes
32e6d418 1616
ae262a47 1617insn-emit.o : insn-emit.c $(CONFIG_H) $(RTL_H) $(EXPR_H) real.h output.h \
4063e82c 1618 insn-config.h insn-flags.h insn-codes.h system.h reload.h recog.h
32e6d418 1619 $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) -c insn-emit.c
1620
997d68fe 1621insn-emit.c: s-emit ; @true
1622s-emit : $(md_file) genemit $(srcdir)/move-if-change
c20b28d5 1623 ./genemit $(md_file) > tmp-emit.c
32e6d418 1624 $(srcdir)/move-if-change tmp-emit.c insn-emit.c
997d68fe 1625 touch s-emit
32e6d418 1626
ad87de1e 1627insn-recog.o : insn-recog.c $(CONFIG_H) $(RTL_H) insn-config.h $(RECOG_H) \
1cd80523 1628 real.h output.h flags.h system.h
32e6d418 1629 $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) -c insn-recog.c
1630
997d68fe 1631insn-recog.c: s-recog ; @true
1632s-recog : $(md_file) genrecog $(srcdir)/move-if-change
c20b28d5 1633 ./genrecog $(md_file) > tmp-recog.c
32e6d418 1634 $(srcdir)/move-if-change tmp-recog.c insn-recog.c
997d68fe 1635 touch s-recog
32e6d418 1636
bdb66cef 1637insn-opinit.o : insn-opinit.c $(CONFIG_H) $(RTL_H) insn-codes.h insn-flags.h \
ae262a47 1638 insn-config.h flags.h $(RECOG_H) $(EXPR_H) reload.h system.h
bdb66cef 1639 $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) -c insn-opinit.c
1640
997d68fe 1641insn-opinit.c: s-opinit ; @true
1642s-opinit : $(md_file) genopinit $(srcdir)/move-if-change
c20b28d5 1643 ./genopinit $(md_file) > tmp-opinit.c
bdb66cef 1644 $(srcdir)/move-if-change tmp-opinit.c insn-opinit.c
997d68fe 1645 touch s-opinit
bdb66cef 1646
5d07813e 1647insn-extract.o : insn-extract.c $(CONFIG_H) $(RTL_H) system.h toplev.h \
1648 insn-config.h recog.h
32e6d418 1649 $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) -c insn-extract.c
1650
997d68fe 1651insn-extract.c: s-extract ; @true
1652s-extract : $(md_file) genextract $(srcdir)/move-if-change
c20b28d5 1653 ./genextract $(md_file) > tmp-extract.c
32e6d418 1654 $(srcdir)/move-if-change tmp-extract.c insn-extract.c
997d68fe 1655 touch s-extract
32e6d418 1656
4063e82c 1657insn-peep.o : insn-peep.c $(CONFIG_H) $(RTL_H) $(REGS_H) output.h real.h \
1658 system.h insn-config.h recog.h
32e6d418 1659 $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) -c insn-peep.c
1660
997d68fe 1661insn-peep.c: s-peep ; @true
1662s-peep : $(md_file) genpeep $(srcdir)/move-if-change
c20b28d5 1663 ./genpeep $(md_file) > tmp-peep.c
32e6d418 1664 $(srcdir)/move-if-change tmp-peep.c insn-peep.c
997d68fe 1665 touch s-peep
32e6d418 1666
74273693 1667insn-attrtab.o : insn-attrtab.c $(CONFIG_H) $(RTL_H) $(REGS_H) real.h \
1668 output.h insn-attr.h insn-config.h system.h toplev.h
32e6d418 1669 $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) -c insn-attrtab.c
1670
997d68fe 1671insn-attr.h: s-attr ; @true
1672s-attr : $(md_file) genattr $(srcdir)/move-if-change
c20b28d5 1673 ./genattr $(md_file) > tmp-attr.h
32e6d418 1674 $(srcdir)/move-if-change tmp-attr.h insn-attr.h
997d68fe 1675 touch s-attr
32e6d418 1676
997d68fe 1677insn-attrtab.c: s-attrtab ; @true
1678s-attrtab : $(md_file) genattrtab $(srcdir)/move-if-change
c20b28d5 1679 if cmp -s $(PREMADE_ATTRTAB_MD) $(md_file); \
8bd8ea06 1680 then \
1681 echo Using $(PREMADE_ATTRTAB); \
ab866dde 1682 cp $(PREMADE_ATTRTAB) tmp-attrtab.c; \
8bd8ea06 1683 else \
c20b28d5 1684 ./genattrtab $(md_file) > tmp-attrtab.c; \
8bd8ea06 1685 fi
32e6d418 1686 $(srcdir)/move-if-change tmp-attrtab.c insn-attrtab.c
997d68fe 1687 touch s-attrtab
32e6d418 1688
d6ff8d83 1689insn-output.o : insn-output.c $(CONFIG_H) $(RTL_H) $(REGS_H) real.h conditions.h \
ad87de1e 1690 hard-reg-set.h insn-config.h insn-flags.h insn-attr.h output.h $(RECOG_H) \
1cd80523 1691 insn-codes.h system.h
32e6d418 1692 $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) -c insn-output.c
1693
997d68fe 1694insn-output.c: s-output ; @true
1695s-output : $(md_file) genoutput $(srcdir)/move-if-change
c20b28d5 1696 ./genoutput $(md_file) > tmp-output.c
32e6d418 1697 $(srcdir)/move-if-change tmp-output.c insn-output.c
997d68fe 1698 touch s-output
3ad7bb1c 1699
fe102f29 1700genrtl.o : genrtl.c $(CONFIG_H) $(RTL_H) system.h
997d68fe 1701genrtl.c genrtl.h : s-genrtl
7cc452c1 1702 @true # force gnu make to recheck modification times.
1703
997d68fe 1704s-genrtl: gengenrtl $(srcdir)/move-if-change $(RTL_BASE_H)
3ad7bb1c 1705 ./gengenrtl tmp-genrtl.h tmp-genrtl.c
1706 $(srcdir)/move-if-change tmp-genrtl.h genrtl.h
1707 $(srcdir)/move-if-change tmp-genrtl.c genrtl.c
997d68fe 1708 touch s-genrtl
3ad7bb1c 1709
2e9d8ccf 1710#\f
32e6d418 1711# Compile the programs that generate insn-* from the machine description.
1712# They are compiled with $(HOST_CC), and associated libraries,
1713# since they need to run on this machine
1714# even if GCC is being compiled to run on some other machine.
1715
1716# $(CONFIG_H) is omitted from the deps of the gen*.o
1717# because these programs don't really depend on anything
1718# about the target machine. They do depend on config.h itself,
1719# since that describes the host machine.
1720
89e36a04 1721# Pass the md file through cpp if the target requests it.
2c352995 1722$(MD_FILE): $(MD_DEPS)
1723 rm -f $@
c20b28d5 1724 $(MD_CPP) $(MD_CPPFLAGS) $(md_file) | sed 's/^# /; /g' > tmp-$@
c92e16d4 1725 mv tmp-$@ $@
89e36a04 1726
497b2a29 1727genconfig : genconfig.o $(HOST_RTL) $(HOST_PRINT) $(HOST_LIBDEPS)
62268150 1728 $(HOST_CC) $(HOST_CFLAGS) $(HOST_LDFLAGS) -o $@ \
497b2a29 1729 genconfig.o $(HOST_RTL) $(HOST_PRINT) $(HOST_LIBS)
32e6d418 1730
5ce88198 1731genconfig.o : genconfig.c $(RTL_H) $(build_xm_file) system.h
32e6d418 1732 $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(srcdir)/genconfig.c
1733
497b2a29 1734genflags : genflags.o $(HOST_RTL) $(HOST_PRINT) $(HOST_LIBDEPS)
62268150 1735 $(HOST_CC) $(HOST_CFLAGS) $(HOST_LDFLAGS) -o $@ \
497b2a29 1736 genflags.o $(HOST_RTL) $(HOST_PRINT) $(HOST_LIBS)
32e6d418 1737
5ce88198 1738genflags.o : genflags.c $(RTL_H) $(build_xm_file) system.h
32e6d418 1739 $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(srcdir)/genflags.c
1740
497b2a29 1741gencodes : gencodes.o $(HOST_RTL) $(HOST_PRINT) $(HOST_LIBDEPS)
62268150 1742 $(HOST_CC) $(HOST_CFLAGS) $(HOST_LDFLAGS) -o $@ \
497b2a29 1743 gencodes.o $(HOST_RTL) $(HOST_PRINT) $(HOST_LIBS)
32e6d418 1744
5ce88198 1745gencodes.o : gencodes.c $(RTL_H) $(build_xm_file) system.h
32e6d418 1746 $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(srcdir)/gencodes.c
1747
497b2a29 1748genemit : genemit.o $(HOST_RTL) $(HOST_PRINT) $(HOST_LIBDEPS)
62268150 1749 $(HOST_CC) $(HOST_CFLAGS) $(HOST_LDFLAGS) -o $@ \
497b2a29 1750 genemit.o $(HOST_RTL) $(HOST_PRINT) $(HOST_LIBS)
32e6d418 1751
5ce88198 1752genemit.o : genemit.c $(RTL_H) $(build_xm_file) system.h
32e6d418 1753 $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(srcdir)/genemit.c
1754
497b2a29 1755genopinit : genopinit.o $(HOST_RTL) $(HOST_PRINT) $(HOST_LIBDEPS)
62268150 1756 $(HOST_CC) $(HOST_CFLAGS) $(HOST_LDFLAGS) -o $@ \
497b2a29 1757 genopinit.o $(HOST_RTL) $(HOST_PRINT) $(HOST_LIBS)
bdb66cef 1758
5ce88198 1759genopinit.o : genopinit.c $(RTL_H) $(build_xm_file) system.h
bdb66cef 1760 $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(srcdir)/genopinit.c
1761
497b2a29 1762genrecog : genrecog.o $(HOST_RTL) $(HOST_PRINT) $(HOST_LIBDEPS)
62268150 1763 $(HOST_CC) $(HOST_CFLAGS) $(HOST_LDFLAGS) -o $@ \
497b2a29 1764 genrecog.o $(HOST_RTL) $(HOST_PRINT) $(HOST_LIBS)
32e6d418 1765
5ce88198 1766genrecog.o : genrecog.c $(RTL_H) $(build_xm_file) system.h
32e6d418 1767 $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(srcdir)/genrecog.c
1768
497b2a29 1769genextract : genextract.o $(HOST_RTL) $(HOST_PRINT) $(HOST_LIBDEPS)
62268150 1770 $(HOST_CC) $(HOST_CFLAGS) $(HOST_LDFLAGS) -o $@ \
497b2a29 1771 genextract.o $(HOST_RTL) $(HOST_PRINT) $(HOST_LIBS)
32e6d418 1772
5ce88198 1773genextract.o : genextract.c $(RTL_H) $(build_xm_file) system.h insn-config.h
32e6d418 1774 $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(srcdir)/genextract.c
1775
497b2a29 1776genpeep : genpeep.o $(HOST_RTL) $(HOST_PRINT) $(HOST_LIBDEPS)
62268150 1777 $(HOST_CC) $(HOST_CFLAGS) $(HOST_LDFLAGS) -o $@ \
497b2a29 1778 genpeep.o $(HOST_RTL) $(HOST_PRINT) $(HOST_LIBS)
32e6d418 1779
5ce88198 1780genpeep.o : genpeep.c $(RTL_H) $(build_xm_file) system.h
32e6d418 1781 $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(srcdir)/genpeep.c
1782
497b2a29 1783genattr : genattr.o $(HOST_RTL) $(HOST_PRINT) $(HOST_LIBDEPS)
62268150 1784 $(HOST_CC) $(HOST_CFLAGS) $(HOST_LDFLAGS) -o $@ \
497b2a29 1785 genattr.o $(HOST_RTL) $(HOST_PRINT) $(HOST_LIBS)
32e6d418 1786
5ce88198 1787genattr.o : genattr.c $(RTL_H) $(build_xm_file) system.h
32e6d418 1788 $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(srcdir)/genattr.c
1789
262d46de 1790genattrtab : genattrtab.o $(HOST_RTL) $(HOST_PRINT) $(HOST_RTLANAL) $(HOST_LIBDEPS)
62268150 1791 $(HOST_CC) $(HOST_CFLAGS) $(HOST_LDFLAGS) -o $@ \
262d46de 1792 genattrtab.o $(HOST_RTL) $(HOST_PRINT) $(HOST_RTLANAL) $(HOST_LIBS)
32e6d418 1793
5ce88198 1794genattrtab.o : genattrtab.c $(RTL_H) $(build_xm_file) system.h insn-config.h
32e6d418 1795 $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(srcdir)/genattrtab.c
1796
497b2a29 1797genoutput : genoutput.o $(HOST_RTL) $(HOST_PRINT) $(HOST_LIBDEPS)
62268150 1798 $(HOST_CC) $(HOST_CFLAGS) $(HOST_LDFLAGS) -o $@ \
497b2a29 1799 genoutput.o $(HOST_RTL) $(HOST_PRINT) $(HOST_LIBS)
32e6d418 1800
5ce88198 1801genoutput.o : genoutput.c $(RTL_H) $(build_xm_file) system.h
32e6d418 1802 $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(srcdir)/genoutput.c
3ad7bb1c 1803
1804gengenrtl : gengenrtl.o $(HOST_LIBDEPS)
1805 $(HOST_CC) $(HOST_CFLAGS) $(HOST_LDFLAGS) -o $@ \
1806 gengenrtl.o $(HOST_LIBS)
1807
1486870d 1808gengenrtl.o : gengenrtl.c $(RTL_BASE_H) system.h
3ad7bb1c 1809 $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(srcdir)/gengenrtl.c
1810
2e9d8ccf 1811#\f
32e6d418 1812# Compile the libraries to be used by gen*.
1813# If we are not cross-building, gen* use the same .o's that cc1 will use,
1814# and HOST_PREFIX_1 is `foobar', just to ensure these rules don't conflict
1815# with the rules for rtl.o, alloca.o, etc.
a3426c4c 1816$(HOST_PREFIX_1)rtl.o: $(srcdir)/rtl.c $(CONFIG_H) system.h $(RTL_H) bitmap.h
32e6d418 1817 rm -f $(HOST_PREFIX)rtl.c
e77fd588 1818 sed -e 's/config[.]h/hconfig.h/' $(srcdir)/rtl.c > $(HOST_PREFIX)rtl.c
32e6d418 1819 $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(HOST_PREFIX)rtl.c
1820
262d46de 1821$(HOST_PREFIX_1)print-rtl.o: $(srcdir)/print-rtl.c $(CONFIG_H) $(RTL_H)
1822 rm -f $(HOST_PREFIX)print-rtl.c
e77fd588 1823 sed -e 's/config[.]h/hconfig.h/' $(srcdir)/print-rtl.c > $(HOST_PREFIX)print-rtl.c
262d46de 1824 $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(HOST_PREFIX)print-rtl.c
1825
a3426c4c 1826$(HOST_PREFIX_1)bitmap.o: $(srcdir)/bitmap.c $(CONFIG_H) system.h $(RTL_H) \
d6ff8d83 1827 flags.h $(BASIC_BLOCK_H) $(REGS_H)
a3426c4c 1828 rm -f $(HOST_PREFIX)bitmap.c
1829 sed -e 's/config[.]h/hconfig.h/' $(srcdir)/bitmap.c > $(HOST_PREFIX)bitmap.c
1830 $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(HOST_PREFIX)bitmap.c
1831
32e6d418 1832$(HOST_PREFIX_1)rtlanal.o: $(srcdir)/rtlanal.c $(CONFIG_H) $(RTL_H)
1833 rm -f $(HOST_PREFIX)rtlanal.c
e77fd588 1834 sed -e 's/config[.]h/hconfig.h/' $(srcdir)/rtlanal.c > $(HOST_PREFIX)rtlanal.c
32e6d418 1835 $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(HOST_PREFIX)rtlanal.c
1836
099377d8 1837$(HOST_PREFIX_1)alloca.o: $(srcdir)/../libiberty/alloca.c
32e6d418 1838 rm -f $(HOST_PREFIX)alloca.c
099377d8 1839 $(LN_S) $(srcdir)/../libiberty/alloca.c $(HOST_PREFIX)alloca.c
32e6d418 1840 $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(HOST_PREFIX)alloca.c
1841
7b6bbd12 1842$(HOST_PREFIX_1)obstack.o: $(srcdir)/../libiberty/obstack.c
32e6d418 1843 rm -f $(HOST_PREFIX)obstack.c
7b6bbd12 1844 sed -e 's/config[.]h/hconfig.h/' $(srcdir)/../libiberty/obstack.c > $(HOST_PREFIX)obstack.c
32e6d418 1845 $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(HOST_PREFIX)obstack.c
1846
44a8856e 1847$(HOST_PREFIX_1)vfprintf.o: $(srcdir)/../libiberty/vfprintf.c
b8a373b2 1848 rm -f $(HOST_PREFIX)vfprintf.c
099377d8 1849 sed -e 's/config[.]h/hconfig.h/' $(srcdir)/../libiberty/vfprintf.c > $(HOST_PREFIX)vfprintf.c
b8a373b2 1850 $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(HOST_PREFIX)vfprintf.c
1851
1852$(HOST_PREFIX_1)doprint.o: doprint.c
1853 rm -f $(HOST_PREFIX)doprint.c
1854 sed -e 's/config[.]h/hconfig.h/' $(srcdir)/doprint.c > $(HOST_PREFIX)doprint.c
1855 $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(HOST_PREFIX)doprint.c
1856
32e6d418 1857$(HOST_PREFIX_1)malloc.o: malloc.c
1858 rm -f $(HOST_PREFIX)malloc.c
e77fd588 1859 sed -e 's/config[.]h/hconfig.h/' $(srcdir)/malloc.c > $(HOST_PREFIX)malloc.c
32e6d418 1860 $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(HOST_PREFIX)malloc.c
1861
1862# This satisfies the dependency that we get if you cross-compile a compiler
1863# that does not need to compile alloca, malloc or whatever.
1864$(HOST_PREFIX_1):
1865 touch $(HOST_PREFIX_1)
649d8da6 1866
2e9d8ccf 1867#\f
32e6d418 1868# Remake cpp and protoize.
1869
1870# Making the preprocessor
7f6a6499 1871cpp$(exeext): $(CCCP)$(exeext)
f403cbcb 1872 -rm -f cpp$(exeext)
ea4a6c81 1873 $(LN) $(CCCP)$(exeext) cpp$(exeext)
33a62e3f 1874cccp$(exeext): cccp.o cexp.o version.o prefix.o mbchar.o @extra_cpp_objs@ $(LIBDEPS)
1875 $(CC) $(ALL_CFLAGS) $(LDFLAGS) -o $@ cccp.o cexp.o prefix.o mbchar.o \
1876 version.o @extra_cpp_objs@ $(LIBS)
4a7d7a8b 1877cexp.o: $(srcdir)/cexp.c $(CONFIG_H) system.h
32e6d418 1878 $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) -c $(srcdir)/cexp.c
1879$(srcdir)/cexp.c: $(srcdir)/cexp.y
1880 cd $(srcdir); $(BISON) -o cexp.c cexp.y
62268150 1881
8099945b 1882# We use $(libsubdir)/$(unlibsubdir) to match the
1883# -iprefix argument which gcc will pass if GCC_EXEC_PREFIX is used.
4a7d7a8b 1884cccp.o: cccp.c $(CONFIG_H) pcp.h version.c config.status system.h \
7bcdc3c7 1885 mbchar.h prefix.h
32e6d418 1886 $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \
c6396a0b 1887 -DGCC_INCLUDE_DIR=\"$(libsubdir)/include\" \
12626b99 1888 -DGPLUSPLUS_INCLUDE_DIR=\"$(gxx_include_dir)\" \
1889 -DLOCAL_INCLUDE_DIR=\"$(includedir)\" \
1890 -DCROSS_INCLUDE_DIR=\"$(tooldir)/sys-include\" \
1891 -DTOOL_INCLUDE_DIR=\"$(tooldir)/include\" \
32e6d418 1892 -c `echo $(srcdir)/cccp.c | sed 's,^\./,,'`
1893
2e398cc7 1894LIBCPP_OBJS = cpplib.o cpphash.o cppalloc.o cpperror.o cppexp.o cppfiles.o \
95c4b02a 1895 cppulp.o prefix.o version.o mbchar.o @extra_cpp_objs@
1896
73b4c875 1897# All the other archives built/used by this makefile are for targets. This
1898# one is strictly for the host.
1899#
1900# For various reasons AR, RANLIB, etc are all set to the target tools and
1901# must not be used here. Instead explicitly use the host versions.
1902#
95c4b02a 1903libcpp.a: $(LIBCPP_OBJS)
73b4c875 1904 $(HOST_AR) $(HOST_AR_FLAGS) libcpp.a $(LIBCPP_OBJS)
1905 if $(HOST_RANLIB_TEST) ; then $(HOST_RANLIB) libcpp.a ; else true ; fi
95c4b02a 1906
1907cppmain$(exeext): cppmain.o libcpp.a $(LIBDEPS)
1908 $(CC) $(ALL_CFLAGS) $(LDFLAGS) -o cppmain$(exeext) cppmain.o \
1909 libcpp.a $(LIBS)
3e4227af 1910
83ab10c8 1911cppmain.o: cppmain.c $(CONFIG_H) cpplib.h machmode.h system.h
f03d7bcd 1912
7bcdc3c7 1913cpplib.o: cpplib.c $(CONFIG_H) cpplib.h machmode.h cpphash.h config.status \
1914 system.h prefix.h
3e4227af 1915 $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \
12626b99 1916 -DGCC_INCLUDE_DIR=\"$(libsubdir)/include\" \
1917 -DGPLUSPLUS_INCLUDE_DIR=\"$(gxx_include_dir)\" \
1918 -DLOCAL_INCLUDE_DIR=\"$(includedir)\" \
1919 -DCROSS_INCLUDE_DIR=\"$(tooldir)/sys-include\" \
1920 -DTOOL_INCLUDE_DIR=\"$(tooldir)/include\" \
3e4227af 1921 -c `echo $(srcdir)/cpplib.c | sed 's,^\./,,'`
1922
83ab10c8 1923cpperror.o: cpperror.c $(CONFIG_H) cpplib.h machmode.h system.h
7d1e7284 1924
83ab10c8 1925cppexp.o: cppexp.c $(CONFIG_H) cpplib.h machmode.h system.h
7d1e7284 1926
83ab10c8 1927cppfiles.o: cppfiles.c $(CONFIG_H) cpplib.h machmode.h system.h
2e398cc7 1928
83ab10c8 1929cpphash.o: cpphash.c cpplib.h machmode.h cpphash.h $(CONFIG_H) system.h
7d1e7284 1930
83ab10c8 1931cppalloc.o: cppalloc.c $(CONFIG_H) cpplib.h machmode.h system.h
885be33e 1932
876dc5b0 1933# Note for the stamp targets, we run the program `true' instead of
1934# having an empty command (nothing following the semicolon).
1935
7f6a6499 1936proto: config.status protoize$(exeext) unprotoize$(exeext) SYSCALLS.c.X
32e6d418 1937
7f6a6499 1938protoize$(exeext): protoize.o getopt.o getopt1.o getpwd.o version.o \
07a3679c 1939 pexecute.o choose-temp.o mkstemp.o $(LIBDEPS)
62268150 1940 $(CC) $(ALL_CFLAGS) $(LDFLAGS) -o $@ \
c90a87d1 1941 protoize.o getopt.o getopt1.o getpwd.o version.o \
07a3679c 1942 pexecute.o choose-temp.o mkstemp.o $(LIBS)
ab866dde 1943
7f6a6499 1944unprotoize$(exeext): unprotoize.o getopt.o getopt1.o getpwd.o version.o \
07a3679c 1945 pexecute.o choose-temp.o mkstemp.o $(LIBDEPS)
62268150 1946 $(CC) $(ALL_CFLAGS) $(LDFLAGS) -o $@ \
c90a87d1 1947 unprotoize.o getopt.o getopt1.o getpwd.o version.o \
07a3679c 1948 pexecute.o choose-temp.o mkstemp.o $(LIBS)
ab866dde 1949
dda5abb0 1950protoize.o: protoize.c $(srcdir)/../include/getopt.h $(CONFIG_H) system.h
32e6d418 1951 $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \
1952 -DGCC_INCLUDE_DIR=\"$(libsubdir)/include\" \
3bf5d4dc 1953 -DGPLUSPLUS_INCLUDE_DIR=\"$(gxx_include_dir)\" \
12626b99 1954 -DCROSS_INCLUDE_DIR=\"$(tooldir)/sys-include\" \
46073b39 1955 -DTOOL_INCLUDE_DIR=\"$(tooldir)/include\" \
9a4f2cdd 1956 -DLOCAL_INCLUDE_DIR=\"$(includedir)\" \
32e6d418 1957 -DSTD_PROTO_DIR=\"$(libsubdir)\" \
122c82ed 1958 $(srcdir)/protoize.c
1959
dda5abb0 1960unprotoize.o: unprotoize.c protoize.c $(srcdir)/../include/getopt.h $(CONFIG_H) system.h
32e6d418 1961 $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \
1962 -DGCC_INCLUDE_DIR=\"$(libsubdir)/include\" \
3bf5d4dc 1963 -DGPLUSPLUS_INCLUDE_DIR=\"$(gxx_include_dir)\" \
12626b99 1964 -DCROSS_INCLUDE_DIR=\"$(tooldir)/sys-include\" \
46073b39 1965 -DTOOL_INCLUDE_DIR=\"$(tooldir)/include\" \
9a4f2cdd 1966 -DLOCAL_INCLUDE_DIR=\"$(includedir)\" \
32e6d418 1967 -DSTD_PROTO_DIR=\"$(libsubdir)\" \
122c82ed 1968 $(srcdir)/unprotoize.c
32e6d418 1969
dda5abb0 1970getopt.o: $(srcdir)/../libiberty/getopt.c $(srcdir)/../include/getopt.h
1971 rm -f getopt.c
1972 $(LN_S) $(srcdir)/../libiberty/getopt.c getopt.c
1973 $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) getopt.c
1974
1975getopt1.o: $(srcdir)/../libiberty/getopt1.c $(srcdir)/../include/getopt.h
1976 rm -f getopt1.c
1977 $(LN_S) $(srcdir)/../libiberty/getopt1.c getopt1.c
1978 $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) getopt1.c
32e6d418 1979
32e6d418 1980# This info describes the target machine, so compile with GCC just built.
62268150 1981SYSCALLS.c.X: $(srcdir)/sys-types.h $(srcdir)/sys-protos.h $(GCC_PASSES) \
1982 stmp-int-hdrs
f678532a 1983 -rm -f SYSCALLS.c tmp-SYSCALLS.s
79f818d0 1984 cat $(srcdir)/sys-types.h $(srcdir)/sys-protos.h > SYSCALLS.c
32e6d418 1985 $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \
f678532a 1986 -aux-info $@ -S -o tmp-SYSCALLS.s SYSCALLS.c
1987 -rm -f SYSCALLS.c tmp-SYSCALLS.s
0b20f012 1988
a5889b74 1989
0b20f012 1990test-protoize-simple: ./protoize ./unprotoize $(GCC_PASSES)
c548e550 1991 -rm -f tmp-proto.[cso]
262d46de 1992 cp $(srcdir)/protoize.c tmp-proto.c
1993 chmod u+w tmp-proto.c
c548e550 1994 ./protoize -N -B ./ -x getopt.h -c "-B./ -Wall -Wwrite-strings \
1995 $(CFLAGS) $(INCLUDES) \
0b20f012 1996 -DGCC_INCLUDE_DIR=0 \
1997 -DGPLUSPLUS_INCLUDE_DIR=0 \
1998 -DCROSS_INCLUDE_DIR=0 \
46073b39 1999 -DTOOL_INCLUDE_DIR=0 \
262d46de 2000 -DSTD_PROTO_DIR=0" tmp-proto.c
1a754c64 2001 @echo '**********' Expect 400 lines of differences.
c548e550 2002 -diff $(srcdir)/protoize.c tmp-proto.c > tmp-proto.diff
2003 -wc -l tmp-proto.diff
2004 ./unprotoize -N -x getopt.h -c "-B./ -Wall -Wwrite-strings \
2005 $(CFLAGS) $(INCLUDES) \
0b20f012 2006 -DGCC_INCLUDE_DIR=0 \
2007 -DGPLUSPLUS_INCLUDE_DIR=0 \
2008 -DCROSS_INCLUDE_DIR=0 \
46073b39 2009 -DTOOL_INCLUDE_DIR=0 \
262d46de 2010 -DSTD_PROTO_DIR=0" tmp-proto.c
0b20f012 2011 @echo Expect zero differences.
262d46de 2012 diff $(srcdir)/protoize.c tmp-proto.c | cat
62268150 2013 -rm -f tmp-proto.[cs] tmp-proto$(objext)
2b55270a 2014
1486870d 2015gcov.o: gcov.c gcov-io.h system.h
2b55270a 2016
0f11bb5d 2017# Only one of 'gcov' or 'gcov.exe' is actually built, depending
2018# upon whether $(exeext) is empty or not.
2019gcov$(exeext): gcov.o $(LIBDEPS)
2b55270a 2020 $(CC) $(ALL_CFLAGS) $(LDFLAGS) gcov.o $(LIBS) -o $@
2e9d8ccf 2021#\f
2cfd79fe 2022# Build the include directory. The stamp files are stmp-* rather than
997d68fe 2023# s-* so that mostlyclean does not force the include directory to
2cfd79fe 2024# be rebuilt.
2025
d54b81e0 2026# Build the include directory including float.h (which no longer depends upon
690a93ea 2027# enquire).
d54b81e0 2028stmp-int-hdrs: stmp-fixinc $(USER_H) xlimits.h gfloat.h
2cfd79fe 2029# Copy in the headers provided with gcc.
2030# The sed command gets just the last file name component;
2031# this is necessary because VPATH could add a dirname.
2032# Using basename would be simpler, but some systems don't have it.
220345e0 2033# The touch command is here to workaround an AIX/Linux NFS bug.
c8763215 2034 for file in .. $(USER_H); do \
2035 if [ X$$file != X.. ]; then \
2036 realfile=`echo $$file | sed -e 's|.*/\([^/]*\)$$|\1|'`; \
220345e0 2037 touch include/$$realfile; \
1941d7da 2038 rm -f include/$$realfile; \
2039 cp $$file include; \
2040 chmod a+r include/$$realfile; \
c8763215 2041 fi; \
2cfd79fe 2042 done
b5850e21 2043 rm -f include/limits.h
2cfd79fe 2044 cp xlimits.h include/limits.h
2045 chmod a+r include/limits.h
690a93ea 2046 rm -f include/float.h
0dbd1c74 2047 if [ -s gfloat.h ]; then \
2048 cp gfloat.h include/float.h && \
2049 chmod a+r include/float.h; \
2050 else :; fi
d54b81e0 2051# Install the README
2052 rm -f include/README
2053 cp $(srcdir)/README-fixinc include/README
2054 chmod a+r include/README
2055 touch $@
2056
2057# Now that gfloat.h no longer depends upon enquire, this is actually a no-op.
2058stmp-headers:
2059 touch $@
2cfd79fe 2060
13520caa 2061fixinc.sh :
45f08132 2062 DEST=`cd $(srcdir) ; pwd`/$@ CC=$(CC) MAKE=$(MAKE) CFLAGS="$(CFLAGS)" \
2063 export DEST CC MAKE CFLAGS ; \
2064 echo DEST=$$DEST CC=$$CC MAKE=$$MAKE CFLAGS=$$CFLAGS ; \
2065 cd ../contrib/fixinc ; \
2066 $(SHELL) mkfixinc.sh $(target) $$DEST
13520caa 2067
2cfd79fe 2068# Build fixed copies of system files.
62268150 2069stmp-fixinc: $(FIXINCLUDES) gsyslimits.h
2cfd79fe 2070 rm -rf include
2071 mkdir include
92d223d1 2072 if [ x$(FIXINCLUDES) != xMakefile.in ]; \
6848a9c6 2073 then \
2074 for dir in $(SYSTEM_HEADER_DIR) $(OTHER_FIXINCLUDES_DIRS); do \
2075 if [ -d $$dir ]; \
2076 then \
cee3b7e3 2077 $(SHELL) $(srcdir)/$(FIXINCLUDES) include $$dir; \
6848a9c6 2078 else true; fi; \
92d223d1 2079 done; \
37dc7c47 2080 if [ x$(INSTALL_ASSERT_H) != x ] ; \
2081 then \
2082 rm -f include/assert.h; \
2083 cp $(srcdir)/assert.h include/assert.h; \
2084 chmod a+r include/assert.h; \
2085 fi \
6848a9c6 2086 else true; \
2087 fi
b7d4d520 2088 rm -f include/syslimits.h
2089 if [ -f include/limits.h ]; then \
2090 mv include/limits.h include/syslimits.h; \
2091 else \
2092 cp $(srcdir)/gsyslimits.h include/syslimits.h; \
2093 fi
2094 chmod a+r include/syslimits.h
8099945b 2095# If $(SYSTEM_HEADER_DIR) is $(tooldir)/sys-include, and
2096# that directory exists, then make sure that $(libsubdir) exists.
2097# This is because cpp is compiled to find $(tooldir)/include via
2098# $(libsubdir)/$(unlibsubdir), which will only work if $(libsubdir)
2099# exists.
2100 if [ "$(SYSTEM_HEADER_DIR)" = "$(tooldir)/sys-include" ] \
2101 && [ -d $(tooldir)/sys-include ]; then \
2102 if [ -d $(libdir) ] ; then true ; else mkdir $(libdir) ; fi; \
2103 if [ -d $(libdir)/gcc-lib ] ; then true ; else mkdir $(libdir)/gcc-lib; fi; \
2104 if [ -d $(libdir)/gcc-lib/$(target_alias) ] ; then true ; else mkdir $(libdir)/gcc-lib/$(target_alias) ; fi; \
2105 if [ -d $(libdir)/gcc-lib/$(target_alias)/$(version) ] ; then true ; else mkdir $(libdir)/gcc-lib/$(target_alias)/$(version) ; fi; \
2106 else true; fi
2107
9e74f24f 2108 touch stmp-fixinc
7c4f0e88 2109
a5889b74 2110# Files related to the fixproto script.
2111
047c2b8b 2112deduced.h: $(GCC_PASSES) $(srcdir)/scan-types.sh stmp-int-hdrs
6ce07cb7 2113 if [ -d $(SYSTEM_HEADER_DIR) ]; \
2114 then \
2115 CC="$(GCC_FOR_TARGET) $(GCC_CFLAGS) $(ALL_CPPFLAGS) -I. -I$(srcdir) -Iinclude -I${SYSTEM_HEADER_DIR}"; \
a5889b74 2116 export CC; \
6ce07cb7 2117 $(SHELL) $(srcdir)/scan-types.sh "$(srcdir)" >tmp-deduced.h; \
2118 mv tmp-deduced.h deduced.h; \
2119 else \
2120 touch deduced.h; \
2121 fi
a5889b74 2122
ff8281e4 2123gen-protos: gen-protos.o scan.o cppalloc.o $(HOST_LIBDEPS)
62268150 2124 ${HOST_CC} $(HOST_CFLAGS) $(HOST_LDFLAGS) -o $@ \
ff8281e4 2125 gen-protos.o scan.o cppalloc.o $(HOST_LIBS)
a5889b74 2126
1486870d 2127gen-protos.o: gen-protos.c scan.h $(build_xm_file) system.h
c68462d9 2128 $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(srcdir)/gen-protos.c
2129
1486870d 2130scan.o: scan.c scan.h $(build_xm_file) system.h
c68462d9 2131 $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(srcdir)/scan.c
9541a717 2132
047c2b8b 2133xsys-protos.h: $(GCC_PASSES) $(srcdir)/sys-protos.h deduced.h gen-protos Makefile
c92e16d4 2134 cat deduced.h $(srcdir)/sys-protos.h > tmp-fixtmp.c
2135 mv tmp-fixtmp.c fixtmp.c
2f9d2927 2136 $(GCC_FOR_TARGET) fixtmp.c -w -U__SIZE_TYPE__ -U__PTRDIFF_TYPE__ -U__WCHAR_TYPE__ -E \
6fc3eafd 2137 | sed -e 's/ / /g' -e 's/ *(/ (/g' -e 's/ [ ]*/ /g' -e 's/( )/()/' \
c92e16d4 2138 | ./gen-protos >xsys-protos.hT
2139 mv xsys-protos.hT xsys-protos.h
d7c4552e 2140 rm -rf fixtmp.c
a5889b74 2141
62268150 2142fix-header: fix-header.o scan-decls.o scan.o xsys-protos.h $(HOST_LIBDEPS) \
95c4b02a 2143 libcpp.a
62268150 2144 $(HOST_CC) $(HOST_CFLAGS) $(HOST_LDFLAGS) -o $@ fix-header.o \
95c4b02a 2145 scan-decls.o scan.o libcpp.a $(HOST_LIBS)
a5889b74 2146
7b6bbd12 2147fix-header.o: fix-header.c $(srcdir)/../include/obstack.h scan.h \
83ab10c8 2148 xsys-protos.h $(build_xm_file) system.h cpplib.h machmode.h cpphash.h
c68462d9 2149 $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(srcdir)/fix-header.c
2150
83ab10c8 2151scan-decls.o: scan-decls.c scan.h cpplib.h machmode.h $(build_xm_file) system.h
c68462d9 2152 $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(srcdir)/scan-decls.c
a5889b74 2153
047c2b8b 2154# stmp-fixproto depends on this, not on fix-header directly.
2155# The idea is to make sure fix-header gets built,
2156# but not rerun fixproto after each stage
2157# just because fix-header's mtime has changed.
2158fixhdr.ready: fix-header
2159 -if [ -f fixhdr.ready ] ; then \
2160 true; \
2161 else \
2162 touch fixhdr.ready; \
2163 fi
2164
7bf27989 2165# stmp-headers is to make sure fixincludes has already finished.
276709eb 2166# The if statement is so that we don't run fixproto a second time
2167# if it has already been run on the files in `include'.
6a0b7b7c 2168stmp-fixproto: fixhdr.ready fixproto stmp-headers
2deaa28d 2169 @echo "Various warnings and error messages from fixproto are normal"
4fbc622f 2170 -if [ -d include ] ; then true; else mkdir include; fi
b948f736 2171 -if [ -f include/fixed ] ; then true; \
276709eb 2172 else \
6f1f992e 2173 : This line works around a 'make' bug in BSDI 1.1.; \
ff8281e4 2174 FIXPROTO_DEFINES="$(FIXPROTO_DEFINES)"; export FIXPROTO_DEFINES; \
bcc35674 2175 if [ -d $(SYSTEM_HEADER_DIR) ] ; then \
2176 $(SHELL) ${srcdir}/fixproto include include $(SYSTEM_HEADER_DIR); \
2177 else true; fi; \
276709eb 2178 touch include/fixed; \
2179 fi
a5889b74 2180 touch stmp-fixproto
2e9d8ccf 2181#\f
32e6d418 2182# Remake the info files.
2183
627defc4 2184doc: info
17b258fe 2185info: cpp.info gcc.info lang.info
32e6d418 2186
17b258fe 2187cpp.info: $(srcdir)/cpp.texi
069f16fd 2188 $(MAKEINFO) $(MAKEINFOFLAGS) -I$(srcdir) -o cpp.info $(srcdir)/cpp.texi
32e6d418 2189
17b258fe 2190gcc.info: $(srcdir)/gcc.texi $(srcdir)/extend.texi $(srcdir)/install.texi \
2191 $(srcdir)/invoke.texi $(srcdir)/md.texi $(srcdir)/rtl.texi \
2192 $(srcdir)/tm.texi $(srcdir)/gcov.texi
069f16fd 2193 $(MAKEINFO) $(MAKEINFOFLAGS) -I$(srcdir) -o gcc.info $(srcdir)/gcc.texi
630c76ba 2194
17b258fe 2195dvi: gcc.dvi cpp.dvi lang.dvi
627defc4 2196
64616031 2197# This works with GNU Make's default rule.
17b258fe 2198gcc.dvi: $(srcdir)/gcc.texi $(srcdir)/extend.texi $(srcdir)/install.texi \
2199 $(srcdir)/invoke.texi $(srcdir)/md.texi $(srcdir)/rtl.texi \
2200 $(srcdir)/tm.texi $(srcdir)/gcov.texi
2201 TEXINPUTS=${texidir}:$(srcdir):$$TEXINPUTS tex gcc.texi
2202 texindex gcc.??
2203 TEXINPUTS=${texidir}:$(srcdir):$$TEXINPUTS tex gcc.texi
2204
2205cpp.dvi: $(srcdir)/cpp.texi
2206 TEXINPUTS=${texidir}:$(srcdir):$$TEXINPUTS tex cpp.texi
2207 texindex cpp.??
2208 TEXINPUTS=${texidir}:$(srcdir):$$TEXINPUTS tex cpp.texi
2209
2210
2211INSTALL: $(srcdir)/install1.texi $(srcdir)/install.texi
3ed0d670 2212 cd $(srcdir); $(MAKEINFO) -D INSTALLONLY \
8aed3df8 2213 --no-split -o INSTALL install1.texi
2e9d8ccf 2214#\f
32e6d418 2215# Deletion of files made during compilation.
2216# There are four levels of this:
a8514488 2217# `mostlyclean', `clean', `distclean' and `maintainer-clean'.
32e6d418 2218# `mostlyclean' is useful while working on a particular type of machine.
c6396a0b 2219# It deletes most, but not all, of the files made by compilation.
32e6d418 2220# It does not delete libgcc.a or its parts, so it won't have to be recompiled.
c6396a0b 2221# `clean' deletes everything made by running `make all'.
79f818d0 2222# `distclean' also deletes the files made by config.
a8514488 2223# `maintainer-clean' also deletes everything that could be regenerated
1f42ecdc 2224# automatically, except for `configure'.
2225# We remove as much from the language subdirectories as we can
73027c94 2226# (less duplicated code).
32e6d418 2227
79f818d0 2228
b54842d8 2229mostlyclean: lang.mostlyclean
32e6d418 2230 -rm -f $(STAGESTUFF)
2231# Delete the temporary source copies for cross compilation.
2232 -rm -f $(HOST_PREFIX_1)rtl.c $(HOST_PREFIX_1)rtlanal.c
2233 -rm -f $(HOST_PREFIX_1)alloca.c $(HOST_PREFIX_1)malloc.c
2234 -rm -f $(HOST_PREFIX_1)obstack.c
2235# Delete the temp files made in the course of building libgcc.a.
c09ccbc2 2236 -rm -f tmplibgcc* tmpcopy xlimits.h libgcc1-test
32e6d418 2237 for name in $(LIB1FUNCS); do rm -f $${name}.c; done
997d68fe 2238# Delete other built files.
2239 -rm -f t-float.h-cross xsys-protos.hT fp-bit.c dp-bit.c
2240# Delete the stamp and temporary files.
2241 -rm -f s-* tmp-* stamp-* stmp-*
73027c94 2242 -rm -f */stamp-* */tmp-*
c6396a0b 2243# Delete debugging dump files.
32e6d418 2244 -rm -f *.greg *.lreg *.combine *.flow *.cse *.jump *.rtl *.tree *.loop
18aa2adf 2245 -rm -f *.dbr *.jump2 *.sched *.cse2 *.sched2 *.stack *.addressof
2246 -rm -f *.regmove *.mach *.bp *.gcse
73027c94 2247 -rm -f */*.greg */*.lreg */*.combine */*.flow */*.cse */*.jump */*.rtl
2248 -rm -f */*.tree */*.loop */*.dbr */*.jump2 */*.sched */*.cse2
18aa2adf 2249 -rm -f */*.sched2 */*.stack */*.regmove */*.gcse
c6396a0b 2250# Delete some files made during installation.
d82b9c93 2251 -rm -f specs gfloat.h float.h-* enquire SYSCALLS.c.X SYSCALLS.c
e98401fc 2252 -rm -f collect collect2 mips-tfile mips-tdump alloca.s
a5889b74 2253# Delete files generated for fixproto
15dece2a 2254 -rm -rf fix-header xsys-protos.h deduced.h tmp-deduced.h \
c9c7b9d8 2255 gen-protos fixproto.list fixtmp.* fixhdr.ready
c6396a0b 2256# Delete unwanted output files from TeX.
2257 -rm -f *.toc *.log *.vr *.fn *.cp *.tp *.ky *.pg
73027c94 2258 -rm -f */*.toc */*.log */*.vr */*.fn */*.cp */*.tp */*.ky */*.pg
79f818d0 2259# Delete sorted indices we don't actually use.
2260 -rm -f gcc.vrs gcc.kys gcc.tps gcc.pgs gcc.fns
c6396a0b 2261# Delete core dumps.
73027c94 2262 -rm -f core */core
2b55270a 2263 -rm -f *.bp */*.bp
32e6d418 2264
79f818d0 2265# Delete all files made by compilation
2266# that don't exist in the distribution.
b54842d8 2267clean: mostlyclean lang.clean
8bd8ea06 2268# It may not be quite desirable to delete unprotoize.c here,
2269# but the spec for `make clean' requires it.
2270# Using unprotoize.c is not quite right in the first place,
2271# but what better way is there?
745e3a0d 2272 -rm -f libgcc.a libgcc1.a libgcc1-asm.a libgcc2.a libgcc2.ready
17108b2b 2273 -rm -f libgcc1.null
131b361e 2274 -rm -f *.dvi
73027c94 2275 -rm -f */*.dvi
89e36a04 2276 -if [ -f md.pre-cpp ]; then \
2277 rm -f md ; \
2278 fi
2cfd79fe 2279# Delete the include directory.
997d68fe 2280 -rm -rf include
d73a48cc 2281# Delete files used by the "multilib" facility (including libgcc subdirs).
f1ad3130 2282 -rm -f multilib.h tmpmultilib*
d73a48cc 2283 -if [ "x$(MULTILIB_DIRNAMES)" != x ] ; then \
2284 rm -rf $(MULTILIB_DIRNAMES); \
2285 else if [ "x$(MULTILIB_OPTIONS)" != x ] ; then \
2286 rm -rf `echo $(MULTILIB_OPTIONS) | sed -e 's/\// /g'`; \
2287 fi ; fi
119f80e4 2288 -rm -fr stage1 stage2 stage3 stage4
32e6d418 2289
79f818d0 2290# Delete all files that users would normally create
2291# while building and installing GCC.
b54842d8 2292distclean: clean lang.distclean
764fc592 2293 -rm -f tm.h config.h auto-host.h auto-build.h tconfig.h hconfig.h
2294 -rm -f md cstamp-h
1f42ecdc 2295 -rm -f config.status config.run config.cache config.bak
160b6fa9 2296 -rm -f Make-lang Make-hooks Make-host Make-target
c3cc26e1 2297 -rm -f Makefile specs.h options.h gencheck.h *.oaux
58febf9e 2298 -rm -f gthr-default.h
c4ed51d6 2299 -rm -f */stage1 */stage2 */stage3 */stage4 */include
08d7a103 2300 -rm -f c-parse.output
b541ad9d 2301 -rm -f *.asm
ae115421 2302 -rm -f float.h
45e01ea1 2303 -rm -f site.exp site.bak testsuite/site.exp testsuite/site.bak
2304 -rm -f testsuite/{gcc,g++}.{log,sum}
c6396a0b 2305
2306# Delete anything likely to be found in the source directory
2307# that shouldn't be in the distribution.
73027c94 2308extraclean: distclean lang.extraclean
bbbdbddd 2309 -rm -rf =* ./"#"* *~* config/=* config/"#"* config/*~*
131b361e 2310 -rm -f patch* *.orig *.rej config/patch* config/*.orig config/*.rej
08d7a103 2311 -rm -f config/*/=* config/*/"#"* config/*/*~*
2312 -rm -f config/*/*.orig config/*/*.rej
300d5cb3 2313 -rm -f *.dvi *.ps *.oaux *.d *.[zZ] *.gz
13da1009 2314 -rm -f *.tar *.xtar *diff *.diff.* *.tar.* *.xtar.* *diffs
08d7a103 2315 -rm -f *lose config/*lose config/*/*lose
997d68fe 2316 -rm -f *.s *.s[0-9] *.i config/ChangeLog
73027c94 2317 -rm -f */=* */"#"* */*~*
2318 -rm -f */patch* */*.orig */*.rej
2319 -rm -f */*.dvi */*.oaux */*.d */*.[zZ] */*.gz
2320 -rm -f */*.tar */*.xtar */*diff */*.diff.* */*.tar.* */*.xtar.* */*diffs
2321 -rm -f */*lose */*.s */*.s[0-9] */*.i
32e6d418 2322
1f42ecdc 2323# Get rid of every file that's generated from some other file, except for `configure'.
32e6d418 2324# Most of these files ARE PRESENT in the GCC distribution.
1f42ecdc 2325maintainer-clean:
2326 @echo 'This command is intended for maintainers to use; it'
2327 @echo 'deletes files that may need special tools to rebuild.'
b54842d8 2328 $(MAKE) distclean lang.maintainer-clean
8757933b 2329 -rm -f c-parse.y c-gperf.h
32e6d418 2330 -rm -f c-parse.c c-parse.h c-parse.output
2331 -rm -f cexp.c cexp.output TAGS
c6396a0b 2332 -rm -f cpp.info* cpp.??s cpp.*aux
2333 -rm -f gcc.info* gcc.??s gcc.*aux
2e9d8ccf 2334#\f
32e6d418 2335# Entry points `install' and `uninstall'.
c6396a0b 2336# Also use `install-collect2' to install collect2 when the config files don't.
32e6d418 2337
3f69fed5 2338# The semicolon is to prevent the install.sh -> install default rule
876dc5b0 2339# from doing anything. Having it run true helps avoid problems and
2340# noise from versions of make which don't like to have null commands.
c2a18965 2341install: $(INSTALL_TARGET) ; @true
32e6d418 2342
2cfd79fe 2343# Copy the compiler files into directories where they will be run.
62268150 2344# Install the driver last so that the window when things are
2345# broken is small.
2289acd7 2346install-normal: install-common $(INSTALL_HEADERS) $(INSTALL_LIBGCC) \
8757933b 2347 install-man install-info lang.install-normal install-driver
32e6d418 2348
e77fd588 2349# Do nothing while making gcc with a cross-compiler. The person who
2350# makes gcc for the target machine has to know how to put a complete
2351# gcc together by hand.
2352install-build: force
2353 @echo You have to install gcc on your target machine by hand.
2354
32e6d418 2355# Run this on the target machine
2356# to finish installation of cross compiler.
2357install-cross-rest: install-float-h-cross
2358
2359# Install float.h for cross compiler.
2360# Run this on the target machine!
0d5bce1b 2361install-float-h-cross: installdirs
9f10de4b 2362# if [ -f enquire ] ; then true; else false; fi
2363# Note: don't use -. We should fail right away if enquire was not made.
2364 ./enquire -f > $(tmpdir)/float.h
32e6d418 2365 -rm -f $(libsubdir)/include/float.h
f32abccb 2366 $(INSTALL_DATA) $(tmpdir)/float.h $(libsubdir)/include/float.h
2367 -rm -f $(tmpdir)/float.h
32e6d418 2368 chmod a-x $(libsubdir)/include/float.h
2369
0d5bce1b 2370# Create the installation directories.
2371installdirs:
2372 -if [ -d $(prefix) ] ; then true ; else mkdir $(prefix) ; chmod a+rx $(prefix) ; fi
2373 -if [ -d $(exec_prefix) ] ; then true ; else mkdir $(exec_prefix) ; chmod a+rx $(exec_prefix) ; fi
47db7968 2374 -if [ -d $(libdir) ] ; then true ; else mkdir $(libdir) ; chmod a+rx $(libdir) ; fi
2375 -if [ -d $(libdir)/gcc-lib ] ; then true ; else mkdir $(libdir)/gcc-lib ; chmod a+rx $(libdir)/gcc-lib ; fi
444c3fb0 2376# This dir isn't currently searched by cpp.
47db7968 2377# -if [ -d $(libdir)/gcc-lib/include ] ; then true ; else mkdir $(libdir)/gcc-lib/include ; chmod a+rx $(libdir)/gcc-lib/include ; fi
c6367e90 2378 -fdir= ; for dir in `echo $(libsubdir) | tr '/' ' '`; do \
2379 fdir=$${fdir}/$${dir}; \
2380 if [ -d $${fdir} ] ; then true ; else mkdir $${fdir}; chmod a+rx $${fdir}; fi ; \
2381 done
47db7968 2382 -if [ -d $(bindir) ] ; then true ; else mkdir $(bindir) ; chmod a+rx $(bindir) ; fi
2383 -if [ -d $(includedir) ] ; then true ; else mkdir $(includedir) ; chmod a+rx $(includedir) ; fi
2384 -if [ -d $(tooldir) ] ; then true ; else mkdir $(tooldir) ; chmod a+rx $(tooldir) ; fi
2385 -if [ -d $(assertdir) ] ; then true ; else mkdir $(assertdir) ; chmod a+rx $(assertdir) ; fi
2386 -if [ -d $(infodir) ] ; then true ; else mkdir $(infodir) ; chmod a+rx $(infodir) ; fi
3cf6a465 2387# We don't use mkdir -p to create the parents of man1dir,
32e6d418 2388# because some systems don't support it.
3cf6a465 2389# Instead, we use this technique to create the immediate parent of man1dir.
2390 -parent=`echo $(man1dir)|sed -e 's@/[^/]*$$@@'`; \
47db7968 2391 if [ -d $$parent ] ; then true ; else mkdir $$parent ; chmod a+rx $$parent ; fi
3cf6a465 2392 -if [ -d $(man1dir) ] ; then true ; else mkdir $(man1dir) ; chmod a+rx $(man1dir) ; fi
32e6d418 2393
2394# Install the compiler executables built during cross compilation.
0d5bce1b 2395install-common: native installdirs $(EXTRA_PARTS) lang.install-common
32e6d418 2396 for file in $(COMPILERS); do \
2397 if [ -f $$file ] ; then \
2398 rm -f $(libsubdir)/$$file; \
2399 $(INSTALL_PROGRAM) $$file $(libsubdir)/$$file; \
2400 else true; \
2401 fi; \
2402 done
1a1e7b42 2403 for file in $(EXTRA_PASSES) $(EXTRA_PROGRAMS) $(USE_COLLECT2) ..; do \
32e6d418 2404 if [ x"$$file" != x.. ]; then \
2405 rm -f $(libsubdir)/$$file; \
2406 $(INSTALL_PROGRAM) $$file $(libsubdir)/$$file; \
2407 else true; fi; \
2408 done
1a1e7b42 2409 for file in $(EXTRA_PARTS) ..; do \
2410 if [ x"$$file" != x.. ]; then \
2411 rm -f $(libsubdir)/$$file; \
2412 $(INSTALL_DATA) $$file $(libsubdir)/$$file; \
0dbd1c74 2413 chmod a-x $(libsubdir)/$$file; \
1a1e7b42 2414 else true; fi; \
2415 done
8a4b1e01 2416# Don't mess with specs if it doesn't exist yet.
94c53b91 2417 -if [ -f specs ] ; then \
2418 rm -f $(libsubdir)/specs; \
8a4b1e01 2419 $(INSTALL_DATA) specs $(libsubdir)/specs; \
0dbd1c74 2420 chmod a-x $(libsubdir)/specs; \
8a4b1e01 2421 fi
62268150 2422# Install protoize if it was compiled.
2423 -if [ -f protoize$(exeext) ]; \
2424 then \
fc56a674 2425 if [ -f gcc-cross$(exeext) ] ; then \
2426 rm -f $(bindir)/$(PROTOIZE_CROSS_NAME)$(exeext); \
2427 $(INSTALL_PROGRAM) protoize$(exeext) $(bindir)/$(PROTOIZE_CROSS_NAME)$(exeext); \
2428 rm -f $(bindir)/$(UNPROTOIZE_CROSS_NAME)$(exeext); \
2429 $(INSTALL_PROGRAM) unprotoize$(exeext) $(bindir)/$(UNPROTOIZE_CROSS_NAME)$(exeext); \
2430 else \
2431 rm -f $(bindir)/$(PROTOIZE_INSTALL_NAME)$(exeext); \
2432 $(INSTALL_PROGRAM) protoize$(exeext) $(bindir)/$(PROTOIZE_INSTALL_NAME)$(exeext); \
2433 rm -f $(bindir)/$(UNPROTOIZE_INSTALL_NAME)$(exeext); \
2434 $(INSTALL_PROGRAM) unprotoize$(exeext) $(bindir)/$(UNPROTOIZE_INSTALL_NAME)$(exeext); \
2435 fi ; \
62268150 2436 rm -f $(libsubdir)/SYSCALLS.c.X; \
2437 $(INSTALL_DATA) SYSCALLS.c.X $(libsubdir)/SYSCALLS.c.X; \
2438 chmod a-x $(libsubdir)/SYSCALLS.c.X; \
2439 fi
2440 -rm -f $(libsubdir)/cpp$(exeext)
2441 $(INSTALL_PROGRAM) cpp$(exeext) $(libsubdir)/cpp$(exeext)
e2a2be99 2442# Install gcov if it was compiled.
2b55270a 2443 -if [ -f gcov$(exeext) ]; \
2444 then \
2445 rm -f $(bindir)/gcov$(exeext); \
2446 $(INSTALL_PROGRAM) gcov$(exeext) $(bindir)/gcov$(exeext); \
2447 chmod a+x $(bindir)/gcov$(exeext); \
2448 fi
62268150 2449
67cb4bc1 2450# Install the driver program as $(target_alias)-gcc
32e6d418 2451# and also as either gcc (if native) or $(tooldir)/bin/gcc.
7f6a6499 2452install-driver: xgcc$(exeext)
f403cbcb 2453 -if [ -f gcc-cross$(exeext) ] ; then \
2454 rm -f $(bindir)/$(GCC_CROSS_NAME)$(exeext); \
12d8e722 2455 $(INSTALL_PROGRAM) gcc-cross$(exeext) $(bindir)/$(GCC_CROSS_NAME)$(exeext); \
32e6d418 2456 if [ -d $(tooldir)/bin/. ] ; then \
f403cbcb 2457 rm -f $(tooldir)/bin/gcc$(exeext); \
2458 $(INSTALL_PROGRAM) gcc-cross$(exeext) $(tooldir)/bin/gcc$(exeext); \
32e6d418 2459 else true; fi; \
2460 else \
f403cbcb 2461 rm -f $(bindir)/$(GCC_INSTALL_NAME)$(exeext); \
2462 $(INSTALL_PROGRAM) xgcc$(exeext) $(bindir)/$(GCC_INSTALL_NAME)$(exeext); \
67cb4bc1 2463 rm -f $(bindir)/$(target_alias)-gcc-1$(exeext); \
ea4a6c81 2464 $(LN) $(bindir)/$(GCC_INSTALL_NAME)$(exeext) $(bindir)/$(target_alias)-gcc-1$(exeext); \
67cb4bc1 2465 mv $(bindir)/$(target_alias)-gcc-1$(exeext) $(bindir)/$(target_alias)-gcc$(exeext); \
32e6d418 2466 fi
32e6d418 2467
a2aa0fc1 2468# Install the info files.
dff6b323 2469# $(INSTALL_DATA) might be a relative pathname, so we can't cd into srcdir
509d95a7 2470# to do the install.
0d5bce1b 2471install-info: doc installdirs lang.install-info
a2aa0fc1 2472 -rm -f $(infodir)/cpp.info* $(infodir)/gcc.info*
17b258fe 2473 for f in cpp.info* gcc.info*; do \
509d95a7 2474 $(INSTALL_DATA) $$f $(infodir)/$$f; \
dff6b323 2475 done
509d95a7 2476 -if $(SHELL) -c 'install-info --version' >/dev/null 2>&1; then \
530e88cf 2477 if [ -f $(infodir)/dir ] ; then \
89980492 2478 for f in cpp.info gcc.info; do \
509d95a7 2479 install-info --dir-file=$(infodir)/dir $(infodir)/$$f; \
89980492 2480 done; \
530e88cf 2481 else true; fi; \
89980492 2482 else true; fi;
a2aa0fc1 2483 -chmod a-x $(infodir)/cpp.info* $(infodir)/gcc.info*
2484
32e6d418 2485# Install the man pages.
0d5bce1b 2486install-man: installdirs $(srcdir)/gcc.1 $(srcdir)/cccp.1 lang.install-man
0dbd1c74 2487 -if [ -f gcc-cross$(exeext) ] ; then \
3cf6a465 2488 rm -f $(man1dir)/$(GCC_CROSS_NAME)$(manext); \
2489 $(INSTALL_DATA) $(srcdir)/gcc.1 $(man1dir)/$(GCC_CROSS_NAME)$(manext); \
2490 chmod a-x $(man1dir)/$(GCC_CROSS_NAME)$(manext); \
b541ad9d 2491 else \
3cf6a465 2492 rm -f $(man1dir)/$(GCC_INSTALL_NAME)$(manext); \
2493 $(INSTALL_DATA) $(srcdir)/gcc.1 $(man1dir)/$(GCC_INSTALL_NAME)$(manext); \
2494 chmod a-x $(man1dir)/$(GCC_INSTALL_NAME)$(manext); \
b541ad9d 2495 fi
3cf6a465 2496 -rm -f $(man1dir)/cccp$(manext)
2497 -$(INSTALL_DATA) $(srcdir)/cccp.1 $(man1dir)/cccp$(manext)
2498 -chmod a-x $(man1dir)/cccp$(manext)
32e6d418 2499
2500# Install the library.
0d5bce1b 2501install-libgcc: libgcc.a installdirs
32e6d418 2502 -if [ -f libgcc.a ] ; then \
2503 rm -f $(libsubdir)/libgcc.a; \
2504 $(INSTALL_DATA) libgcc.a $(libsubdir)/libgcc.a; \
2505 if $(RANLIB_TEST) ; then \
2506 (cd $(libsubdir); $(RANLIB) libgcc.a); else true; fi; \
2507 chmod a-x $(libsubdir)/libgcc.a; \
2508 else true; fi
2509
f1ad3130 2510# Install multiple versions of libgcc.a.
0d5bce1b 2511install-multilib: stmp-multilib installdirs
f1ad3130 2512 for i in `$(GCC_FOR_TARGET) --print-multi-lib`; do \
2513 dir=`echo $$i | sed -e 's/;.*$$//'`; \
2514 if [ -d $(libsubdir)/$${dir} ]; then true; else mkdir $(libsubdir)/$${dir}; fi; \
cdc96909 2515 for f in libgcc.a $(EXTRA_MULTILIB_PARTS); do \
2516 rm -f $(libsubdir)/$${dir}/$${f}; \
2517 $(INSTALL_DATA) $${dir}/$${f} $(libsubdir)/$${dir}/$${f}; \
2518 done; \
f1ad3130 2519 if $(RANLIB_TEST); then \
2520 (cd $(libsubdir)/$${dir}; $(RANLIB) libgcc.a); else true; fi; \
2521 chmod a-x $(libsubdir)/$${dir}/libgcc.a; \
2522 done
2523
2cfd79fe 2524# Install all the header files built in the include subdirectory.
c8763215 2525install-headers: install-include-dir $(INSTALL_HEADERS_DIR) $(INSTALL_ASSERT_H)
2cfd79fe 2526# Fix symlinks to absolute paths in the installed include directory to
2527# point to the installed directory, not the build directory.
ea4a6c81 2528# Don't need to use LN_S here since we really do need ln -s and no substitutes.
2cfd79fe 2529 -files=`cd $(libsubdir)/include; find . -type l -print 2>/dev/null`; \
2530 if [ $$? -eq 0 ]; then \
2531 dir=`cd include; pwd`; \
2532 for i in $$files; do \
2533 dest=`ls -ld $(libsubdir)/include/$$i | sed -n 's/.*-> //p'`; \
2534 if expr "$$dest" : "$$dir.*" > /dev/null; then \
2535 rm -f $(libsubdir)/include/$$i; \
5822e312 2536 ln -s `echo $$i | sed "s|/[^/]*|/..|g" | sed 's|/..$$||'``echo "$$dest" | sed "s|$$dir||"` $(libsubdir)/include/$$i; \
2cfd79fe 2537 fi; \
2538 done; \
2539 fi
32e6d418 2540
2cfd79fe 2541# Create or recreate the gcc private include file directory.
0d5bce1b 2542install-include-dir: installdirs
2cfd79fe 2543 -rm -rf $(libsubdir)/include
2544 mkdir $(libsubdir)/include
2545 -chmod a+rx $(libsubdir)/include
2546
2547# Install the include directory using tar.
a5889b74 2548install-headers-tar: stmp-headers $(STMP_FIXPROTO) install-include-dir
651b0150 2549 (cd include; \
b948f736 2550 tar -cf - .; exit 0) | (cd $(libsubdir)/include; tar $(TAROUTOPTS) - )
16db1e2d 2551# /bin/sh on some systems returns the status of the first tar,
2552# and that can lose with GNU tar which always writes a full block.
2553# So use `exit 0' to ignore its exit status.
2cfd79fe 2554
2555# Install the include directory using cpio.
a5889b74 2556install-headers-cpio: stmp-headers $(STMP_FIXPROTO) install-include-dir
813fb313 2557 (cd include; find . -print) | (cd include; cpio -pdum $(libsubdir)/include)
32e6d418 2558
35df828f 2559# Put assert.h where it won't override GNU libc's assert.h.
2560# It goes in a dir that is searched after GNU libc's headers;
2561# thus, the following conditionals are no longer needed.
2562# But it's not worth deleting them now.
2563## Don't replace the assert.h already there if it is not from GCC.
2564## This code would be simpler if it tested for -f ... && ! grep ...
2565## but supposedly the ! operator is missing in sh on some systems.
0d5bce1b 2566install-assert-h: assert.h installdirs
eb5a0caa 2567 if [ -f $(assertdir)/assert.h ]; \
2568 then \
95856242 2569 if grep "__eprintf" $(assertdir)/assert.h >/dev/null; \
a953974c 2570 then \
eb5a0caa 2571 rm -f $(assertdir)/assert.h; \
2572 $(INSTALL_DATA) $(srcdir)/assert.h $(assertdir)/assert.h; \
04873c54 2573 chmod a-x $(assertdir)/assert.h; \
eb5a0caa 2574 else true; \
2575 fi; \
2ba284c3 2576 else \
db9a0b19 2577 rm -f $(assertdir)/assert.h; \
2578 $(INSTALL_DATA) $(srcdir)/assert.h $(assertdir)/assert.h; \
04873c54 2579 chmod a-x $(assertdir)/assert.h; \
2ba284c3 2580 fi
32e6d418 2581
0c787992 2582# Use this target to install the program `collect2' under the name `collect2'.
0d5bce1b 2583install-collect2: collect2 installdirs
0c787992 2584 $(INSTALL_PROGRAM) collect2$(exeext) $(libsubdir)/collect2$(exeext)
c6396a0b 2585# Install the driver program as $(libsubdir)/gcc for collect2.
f403cbcb 2586 $(INSTALL_PROGRAM) xgcc$(exeext) $(libsubdir)/gcc$(exeext)
c6396a0b 2587
32e6d418 2588# Cancel installation by deleting the installed files.
73027c94 2589uninstall: lang.uninstall
32e6d418 2590 -rm -rf $(libsubdir)
f403cbcb 2591 -rm -rf $(bindir)/$(GCC_INSTALL_NAME)$(exeext)
2592 -rm -rf $(bindir)/$(GCC_CROSS_NAME)$(exeext)
2593 -rm -rf $(bindir)/protoize$(exeext)
2594 -rm -rf $(bindir)/unprotoize$(exeext)
9e042f31 2595 -rm -rf $(bindir)/gcov$(exeext)
3cf6a465 2596 -rm -rf $(man1dir)/$(GCC_INSTALL_NAME)$(manext)
2597 -rm -rf $(man1dir)/$(GCC_CROSS_NAME)$(manext)
2598 -rm -rf $(man1dir)/cccp$(manext)
2599 -rm -rf $(man1dir)/protoize$(manext)
2600 -rm -rf $(man1dir)/unprotoize$(manext)
9e042f31 2601 -rm -f $(infodir)/cpp.info* $(infodir)/gcc.info*
2e9d8ccf 2602#\f
6c08487b 2603# These targets are for the dejagnu testsuites. The file site.exp
2604# contains global variables that all the testsuites will use.
2605
2606# Set to $(target_alias)/ for cross.
2607target_subdir = @target_subdir@
2608
2609site.exp: ./config.status Makefile
2610 @echo "Making a new config file..."
2611 -@rm -f ./tmp?
2612 @touch site.exp
2613 -@mv site.exp site.bak
2614 @echo "## these variables are automatically generated by make ##" > ./tmp0
2615 @echo "# Do not edit here. If you wish to override these values" >> ./tmp0
2616 @echo "# add them to the last section" >> ./tmp0
2617 @echo "set rootme \"`pwd`\"" >> ./tmp0
2618 @echo "set srcdir \"`cd ${srcdir}; pwd`\"" >> ./tmp0
2619 @echo "set host_triplet $(host_canonical)" >> ./tmp0
2620 @echo "set build_triplet $(build_canonical)" >> ./tmp0
2621 @echo "set target_triplet $(target)" >> ./tmp0
2622 @echo "set target_alias $(target_alias)" >> ./tmp0
2623# CFLAGS is set even though it's empty to show we reserve the right to set it.
2624 @echo "set CFLAGS \"\"" >> ./tmp0
2625 @echo "set CXXFLAGS \"-I$(objdir)/../$(target_subdir)libio -I\$$srcdir/../libg++/src -I\$$srcdir/../libio -I\$$srcdir/../libstdc++ -I\$$srcdir/../libstdc++/stl -L$(objdir)/../$(target_subdir)libg++ -L$(objdir)/../$(target_subdir)libstdc++\"" >> ./tmp0
2626# If newlib has been configured, we need to pass -B to gcc so it can find
2627# newlib's crt0.o if it exists. This will cause a "path prefix not used"
2628# message if it doesn't, but the testsuite is supposed to ignore the message -
2629# it's too difficult to tell when to and when not to pass -B (not all targets
2630# have crt0's). We could only add the -B if ../newlib/crt0.o exists, but that
2631# seems like too selective a test.
2632# ??? Another way to solve this might be to rely on linker scripts. Then
2633# theoretically the -B won't be needed.
2634# We also need to pass -L ../ld so that the linker can find ldscripts.
2635 @if [ -d $(objdir)/../$(target_subdir)newlib ] ; then \
2636 echo "set newlib_cflags \"-I$(objdir)/../$(target_subdir)newlib/targ-include -I\$$srcdir/../newlib/libc/include\"" >> ./tmp0; \
2637 echo "set newlib_ldflags \"-B$(objdir)/../$(target_subdir)newlib/\"" >> ./tmp0; \
2638 echo "append CFLAGS \" \$$newlib_cflags\"" >> ./tmp0; \
2639 echo "append CXXFLAGS \" \$$newlib_cflags\"" >> ./tmp0; \
2640 echo "append LDFLAGS \" \$$newlib_ldflags\"" >> ./tmp0; \
2641 else true; \
2642 fi
2643 @if [ -d $(objdir)/../ld ] ; then \
2644 echo "append LDFLAGS \" -L$(objdir)/../ld\"" >> ./tmp0; \
2645 else true; \
2646 fi
16ee23c7 2647 echo "set tmpdir $(objdir)/testsuite" >> ./tmp0
6c08487b 2648 @echo "set srcdir \"\$${srcdir}/testsuite\"" >> ./tmp0
2649 @echo "## All variables above are generated by configure. Do Not Edit ##" >> ./tmp0
2650 @cat ./tmp0 > site.exp
2651 @cat site.bak | sed \
2652 -e '1,/^## All variables above are.*##/ d' >> site.exp
2653 -@rm -f ./tmp?
2654
5c872430 2655CHECK_TARGETS = check-gcc check-g++ check-g77 check-objc
6c08487b 2656
2657check: $(CHECK_TARGETS)
2658
20ab2c9c 2659testsuite/site.exp: site.exp
6c08487b 2660 if [ -d testsuite ]; then \
2661 true; \
2662 else \
2663 mkdir testsuite; \
2664 fi
2665 rm -rf testsuite/site.exp
2666 cp site.exp testsuite/site.exp
20ab2c9c 2667
2668check-g++: testsuite/site.exp
2669 -rootme=`pwd`; export rootme; \
6c08487b 2670 srcdir=`cd ${srcdir}; pwd` ; export srcdir ; \
2671 cd testsuite; \
2672 EXPECT=${EXPECT} ; export EXPECT ; \
2673 if [ -f $${rootme}/../expect/expect ] ; then \
2674 TCL_LIBRARY=$${srcdir}/../tcl/library ; \
2675 export TCL_LIBRARY ; fi ; \
2676 $(RUNTEST) --tool g++ $(RUNTESTFLAGS)
2677
20ab2c9c 2678check-gcc: testsuite/site.exp
2679 -rootme=`pwd`; export rootme; \
6c08487b 2680 srcdir=`cd ${srcdir}; pwd` ; export srcdir ; \
2681 cd testsuite; \
2682 EXPECT=${EXPECT} ; export EXPECT ; \
2683 if [ -f $${rootme}/../expect/expect ] ; then \
2684 TCL_LIBRARY=$${srcdir}/../tcl/library ; \
2685 export TCL_LIBRARY ; fi ; \
2686 $(RUNTEST) --tool gcc $(RUNTESTFLAGS)
2687
4230ead8 2688check-g77: testsuite/site.exp
2689 -rootme=`pwd`; export rootme; \
2690 srcdir=`cd ${srcdir}; pwd` ; export srcdir ; \
2691 cd testsuite; \
2692 EXPECT=${EXPECT} ; export EXPECT ; \
2693 if [ -f $${rootme}/../expect/expect ] ; then \
2694 TCL_LIBRARY=$${srcdir}/../tcl/library ; \
2695 export TCL_LIBRARY ; fi ; \
2696 $(RUNTEST) --tool g77 $(RUNTESTFLAGS)
2697
5c872430 2698check-objc: testsuite/site.exp
2699 -rootme=`pwd`; export rootme; \
2700 srcdir=`cd ${srcdir}; pwd` ; export srcdir ; \
2701 cd testsuite; \
2702 EXPECT=${EXPECT} ; export EXPECT ; \
2703 if [ -f $${rootme}/../expect/expect ] ; then \
2704 TCL_LIBRARY=$${srcdir}/../tcl/library ; \
2705 export TCL_LIBRARY ; fi ; \
2706 $(RUNTEST) --tool objc $(RUNTESTFLAGS)
2707
32e6d418 2708# These exist for maintenance purposes.
2709
2710# Update the tags table.
2711TAGS: force
2712 cd $(srcdir); \
997d68fe 2713 mkdir tmp-tags; \
2714 mv -f c-parse.[ch] cexp.c =*.[chy] tmp-tags; \
32e6d418 2715 etags *.y *.h *.c; \
997d68fe 2716 mv tmp-tags/* .; \
2717 rmdir tmp-tags
32e6d418 2718
997d68fe 2719# Create the distribution tar.gz file.
2720dist: tmp-gcc.xtar
2721 gzip --best < tmp-gcc.xtar > tmp-gcc.xtar.gz
2722 mv tmp-gcc.xtar.gz gcc-$(version).tar.gz
32e6d418 2723
997d68fe 2724tmp-gcc.xtar: distdir
6c76e6ec 2725# Make the distribution.
997d68fe 2726 tar -chf tmp-gcc.xtar gcc-$(version)
2727
2728distdir-cvs: force
a4867808 2729 if [ -d $(srcdir)/CVS ]; then cd $(srcdir) && cvs -r update; fi
6c76e6ec 2730
73027c94 2731# This target exists to do the initial work before the language specific
2732# stuff gets done.
0f557c81 2733distdir-start: doc $(srcdir)/INSTALL $(srcdir)/c-parse.y $(srcdir)/c-gperf.h \
997d68fe 2734 $(srcdir)/c-parse.c $(srcdir)/cexp.c $(srcdir)/config.in \
823f5e65 2735 $(srcdir)/version.c TAGS
2deaa28d 2736 @if grep -s "for version ${mainversion}" gcc.texi > /dev/null; \
630c76ba 2737 then true; \
0dce1b01 2738 else echo "You must update the version number in \`gcc.texi'"; sleep 10;\
630c76ba 2739 fi
131b361e 2740# Update the version number in README
2741 awk '$$1 " " $$2 " " $$3 == "This directory contains" \
2742 { $$6 = version; print $$0 } \
2743 $$1 " " $$2 " " $$3 != "This directory contains"' \
a4867808 2744 version=$(version) $(srcdir)/README > tmp.README
131b361e 2745 mv tmp.README README
c6396a0b 2746 -rm -rf gcc-$(version) tmp
32e6d418 2747# Put all the files in a temporary subdirectory
2748# which has the name that we want to have in the tar file.
c6396a0b 2749 mkdir tmp
2750 mkdir tmp/config
3bc8e4d6 2751 mkdir tmp/ginclude
a4867808 2752 mkdir tmp/objc
2753 for file in `(cd $(srcdir) && echo *[0-9a-zA-Z+])`; do \
2754 test -f $(srcdir)/$$file && $(LN_S) $(srcdir)/$$file tmp; \
c6396a0b 2755 done
a4867808 2756 if test "$(srcdir)" != "." ; then \
2757 for file in c-parse.c cexp.c ; do \
2758 test -f ./$$file && $(LN_S) ../$$file tmp; \
2759 done; \
2760 fi
2761 for file in `(cd $(srcdir)/config && echo *[0-9a-zA-Z+])`; do \
2762 if test -d $(srcdir)/config/$$file \
2763 && test "$$file" != RCS && test "$$file" != CVS; then \
2764 mkdir tmp/config/$$file; \
2765 for subfile in `(cd $(srcdir)/config/$$file && echo *[0-9a-zA-Z+])`; do \
2766 $(LN_S) $(srcdir)/config/$$file/$$subfile tmp/config/$$file; \
8a32ef6f 2767 done; \
8a32ef6f 2768 else \
a4867808 2769 $(LN_S) $(srcdir)/config/$$file tmp/config; \
8a32ef6f 2770 fi; \
32e6d418 2771 done
a4867808 2772 for file in `(cd $(srcdir)/ginclude && echo *[0-9a-zA-Z+])`; do \
2773 $(LN_S) $(srcdir)/ginclude/$$file tmp/ginclude; \
3bc8e4d6 2774 done
a4867808 2775 for file in `(cd $(srcdir)/objc && echo *[0-9a-zA-Z+])`; do \
2776 $(LN_S) $(srcdir)/objc/$$file tmp/objc; \
4f1fd857 2777 done
a4867808 2778 $(LN_S) .gdbinit tmp
73027c94 2779
2780# Finish making `distdir', after the languages have done their thing.
2781distdir-finish:
c6396a0b 2782 mv tmp gcc-$(version)
3bc8e4d6 2783# Get rid of everything we don't want in the distribution. We'd want
2784# this to use Makefile.in, but it doesn't have the `lang.foo' targets
2785# expanded.
997d68fe 2786 cd gcc-$(version); make extraclean VERSION_DEP=
32e6d418 2787
997d68fe 2788distdir: distdir-cvs distdir-start lang.distdir distdir-finish
73027c94 2789
2deaa28d 2790# make diff oldversion=M.N
2791# creates a diff file between an older distribution and this one.
2792# The -P option assumes this is GNU diff.
2793diff:
6a4a0b58 2794 diff -rc2P -x c-parse.y -x c-parse.c -x c-parse.h -x c-gperf.h \
823f5e65 2795 -x cexp.c -x -x TAGS -x INSTALL \
997d68fe 2796 -x configure -x config.in \
73027c94 2797 -x "gcc.??" -x "gcc.??s" -x gcc.aux -x "gcc.info*" \
2798 -x "cpp.??" -x "cpp.??s" -x cpp.aux -x "cpp.info*" \
2799 $(LANG_DIFF_EXCLUDES) \
997d68fe 2800 gcc-$(oldversion) gcc-$(version) > gcc-$(oldversion)-$(version).diff
2deaa28d 2801
58622ee7 2802bootstrap bootstrap-lean: force
41f63c60 2803# Only build the C compiler for stage1, because that is the only one that
2804# we can guarantee will build with the native compiler, and also it is the
2805# only thing useful for building stage2.
e754efc9 2806 $(MAKE) CC="$(CC)" libdir=$(libdir) LANGUAGES="$(BOOT_LANGUAGES)"
32e6d418 2807 $(MAKE) stage1
c6396a0b 2808# This used to define ALLOCA as empty, but that would lead to bad results
2809# for a subsequent `make install' since that would not have ALLOCA empty.
2810# To prevent `make install' from compiling alloca.o and then relinking cc1
2811# because alloca.o is newer, we permit these recursive makes to compile
2812# alloca.o. Then cc1 is newer, so it won't have to be relinked.
12626b99 2813 $(MAKE) CC="stage1/xgcc$(exeext) -Bstage1/ -B$(build_tooldir)/bin/" CFLAGS="$(WARN_CFLAGS) $(BOOT_CFLAGS)" LDFLAGS="$(BOOT_LDFLAGS)" libdir=$(libdir) STAGE_PREFIX=stage1/ LANGUAGES="$(LANGUAGES)"
32e6d418 2814 $(MAKE) stage2
58622ee7 2815 -if test $@ = bootstrap-lean; then rm -rf stage1; else true; fi
12626b99 2816 $(MAKE) CC="stage2/xgcc$(exeext) -Bstage2/ -B$(build_tooldir)/bin/" CFLAGS="$(WARN_CFLAGS) $(BOOT_CFLAGS)" LDFLAGS="$(BOOT_LDFLAGS)" libdir=$(libdir) STAGE_PREFIX=stage2/ LANGUAGES="$(LANGUAGES)"
732395de 2817
e4051ec5 2818bootstrap2 bootstrap2-lean: force
12626b99 2819 $(MAKE) CC="stage1/xgcc$(exeext) -Bstage1/ -B$(build_tooldir)/bin/" CFLAGS="$(WARN_CFLAGS) $(BOOT_CFLAGS)" LDFLAGS="$(BOOT_LDFLAGS)" libdir=$(libdir) STAGE_PREFIX=stage1/ LANGUAGES="$(LANGUAGES)"
32e6d418 2820 $(MAKE) stage2
e4051ec5 2821 -if test $@ = bootstrap2-lean; then rm -rf stage1; else true; fi
12626b99 2822 $(MAKE) CC="stage2/xgcc$(exeext) -Bstage2/ -B$(build_tooldir)/bin/" CFLAGS="$(WARN_CFLAGS) $(BOOT_CFLAGS)" LDFLAGS="$(BOOT_LDFLAGS)" libdir=$(libdir) STAGE_PREFIX=stage2/ LANGUAGES="$(LANGUAGES)"
32e6d418 2823
e4051ec5 2824bootstrap3 bootstrap3-lean: force
12626b99 2825 $(MAKE) CC="stage2/xgcc$(exeext) -Bstage2/ -B$(build_tooldir)/bin/" CFLAGS="$(WARN_CFLAGS) $(BOOT_CFLAGS)" LDFLAGS="$(BOOT_LDFLAGS)" libdir=$(libdir) STAGE_PREFIX=stage2/ LANGUAGES="$(LANGUAGES)"
32e6d418 2826
e4051ec5 2827bootstrap4 bootstrap4-lean: force
12626b99 2828 $(MAKE) CC="stage3/xgcc$(exeext) -Bstage3/ -B$(build_tooldir)/bin/" CFLAGS="$(WARN_CFLAGS) $(BOOT_CFLAGS)" LDFLAGS="$(BOOT_LDFLAGS)" libdir=$(libdir) STAGE_PREFIX=stage3/ LANGUAGES="$(LANGUAGES)"
58622ee7 2829
48c6936b 2830# Compare the object files in the current directory with those in the
2831# stage2 directory.
2832
639b13ee 2833# ./ avoids bug in some versions of tail.
d7fba489 2834compare compare3 compare4 compare-lean compare3-lean compare4-lean: force
20becaef 2835 -rm -f .bad_compare
d7fba489 2836 case "$@" in compare | compare-lean ) stage=2 ;; * ) stage=`echo $@ | sed -e 's,^compare\([0-9][0-9]*\).*,\1,'` ;; esac; \
62268150 2837 for file in *$(objext); do \
639b13ee 2838 tail +16c ./$$file > tmp-foo1; \
d7fba489 2839 tail +16c stage$$stage/$$file > tmp-foo2 \
20becaef 2840 && (cmp tmp-foo1 tmp-foo2 > /dev/null 2>&1 || echo $$file differs >> .bad_compare) || true; \
48c6936b 2841 done
d7fba489 2842 case "$@" in compare | compare-lean ) stage=2 ;; * ) stage=`echo $@ | sed -e 's,^compare\([0-9][0-9]*\).*,\1,'` ;; esac; \
73027c94 2843 for dir in tmp-foo $(SUBDIRS); do \
62268150 2844 if [ "`echo $$dir/*$(objext)`" != "$$dir/*$(objext)" ] ; then \
2845 for file in $$dir/*$(objext); do \
73027c94 2846 tail +16c ./$$file > tmp-foo1; \
d7fba489 2847 tail +16c stage$$stage/$$file > tmp-foo2 \
20becaef 2848 && (cmp tmp-foo1 tmp-foo2 > /dev/null 2>&1 || echo $$file differs >> .bad_compare) || true; \
9771451c 2849 done; \
3806ffea 2850 else true; fi; \
73027c94 2851 done
48c6936b 2852 -rm -f tmp-foo*
77333ad9 2853 case "$@" in compare | compare-lean ) stage=2 ;; * ) stage=`echo $@ | sed -e 's,^compare\([0-9][0-9]*\).*,\1,'` ;; esac; \
20becaef 2854 if [ -f .bad_compare ]; then \
2855 echo "Bootstrap comparison failure!"; \
2856 cat .bad_compare; \
2857 exit 1; \
d7fba489 2858 else \
2859 case "$@" in \
2860 *-lean ) rm -rf stage$$stage ;; \
05bdc491 2861 *) ;; \
d7fba489 2862 esac; true; \
20becaef 2863 fi
48c6936b 2864
d7fba489 2865# Compare the object files in the current directory with those in the
2866# stage2 directory. Use gnu cmp (diffutils v2.4 or later) to avoid
2867# running tail and the overhead of twice copying each object file.
2868
2869gnucompare gnucompare3 gnucompare4 gnucompare-lean gnucompare3-lean gnucompare4-lean: force
732395de 2870 -rm -f .bad_compare
d7fba489 2871 case "$@" in gnucompare | gnucompare-lean ) stage=2 ;; * ) stage=`echo $@ | sed -e 's,^gnucompare\([0-9][0-9]*\).*,\1,'` ;; esac; \
732395de 2872 for file in *$(objext); do \
d7fba489 2873 (cmp --ignore-initial=16 $$file stage$$stage/$$file > /dev/null 2>&1 || echo $$file differs >> .bad_compare) || true; \
732395de 2874 done
d7fba489 2875 case "$@" in gnucompare | gnucompare-lean ) stage=2 ;; * ) stage=`echo $@ | sed -e 's,^gnucompare\([0-9][0-9]*\).*,\1,'` ;; esac; \
732395de 2876 for dir in tmp-foo $(SUBDIRS); do \
2877 if [ "`echo $$dir/*$(objext)`" != "$$dir/*$(objext)" ] ; then \
2878 for file in $$dir/*$(objext); do \
d7fba489 2879 (cmp --ignore-initial=16 $$file stage$$stage/$$file > /dev/null 2>&1 || echo $$file differs >> .bad_compare) || true; \
732395de 2880 done; \
3806ffea 2881 else true; fi; \
732395de 2882 done
77333ad9 2883 case "$@" in gnucompare | gnucompare-lean ) stage=2 ;; * ) stage=`echo $@ | sed -e 's,^gnucompare\([0-9][0-9]*\).*,\1,'` ;; esac; \
732395de 2884 if [ -f .bad_compare ]; then \
2885 echo "Bootstrap comparison failure!"; \
2886 cat .bad_compare; \
2887 exit 1; \
d7fba489 2888 else \
2889 case "$@" in \
2890 *-lean ) rm -rf stage$$stage ;; \
2891 esac; true; \
732395de 2892 fi
2893
32e6d418 2894# Copy the object files from a particular stage into a subdirectory.
73027c94 2895stage1-start:
c6396a0b 2896 -if [ -d stage1 ] ; then true ; else mkdir stage1 ; fi
73027c94 2897 -for dir in . $(SUBDIRS) ; \
2898 do \
21fde8a9 2899 if [ -d stage1/$$dir ] ; then true ; else mkdir stage1/$$dir ; fi ; \
73027c94 2900 done
32e6d418 2901 -mv $(STAGESTUFF) stage1
b541ad9d 2902# Copy as/ld if they exist to stage dir, so that running xgcc from the stage
2903# dir will work properly.
ea4a6c81 2904 -if [ -f as$(exeext) ] ; then $(LN_S) ../as$(exeext) stage1 ; else true ; fi
2905 -if [ -f ld$(exeext) ] ; then $(LN_S) ../ld$(exeext) stage1 ; else true ; fi
2906 -if [ -f collect-ld$(exeext) ] ; then $(LN_S) ../collect-ld$(exeext) stage1 ; else true ; fi
32e6d418 2907 -rm -f stage1/libgcc.a
2908 -cp libgcc.a stage1
2909 -if $(RANLIB_TEST) ; then $(RANLIB) stage1/libgcc.a; else true; fi
3efc89f0 2910 -for f in .. $(EXTRA_MULTILIB_PARTS); do if [ x$${f} != x.. ]; then \
2911 cp stage1/$${f} . ; \
7561ae90 2912 else true; \
3efc89f0 2913 fi; done
73027c94 2914stage1: force stage1-start lang.stage1
32e6d418 2915
73027c94 2916stage2-start:
c6396a0b 2917 -if [ -d stage2 ] ; then true ; else mkdir stage2 ; fi
73027c94 2918 -for dir in . $(SUBDIRS) ; \
2919 do \
21fde8a9 2920 if [ -d stage2/$$dir ] ; then true ; else mkdir stage2/$$dir ; fi ; \
73027c94 2921 done
32e6d418 2922 -mv $(STAGESTUFF) stage2
b541ad9d 2923# Copy as/ld if they exist to stage dir, so that running xgcc from the stage
2924# dir will work properly.
ea4a6c81 2925 -if [ -f as$(exeext) ] ; then $(LN_S) ../as$(exeext) stage2 ; else true ; fi
2926 -if [ -f ld$(exeext) ] ; then $(LN_S) ../ld$(exeext) stage2 ; else true ; fi
2927 -if [ -f collect-ld ] ; then $(LN_S) ../collect-ld$(exeext) stage2 ; else true ; fi
32e6d418 2928 -rm -f stage2/libgcc.a
2929 -cp libgcc.a stage2
2930 -if $(RANLIB_TEST) ; then $(RANLIB) stage2/libgcc.a; else true; fi
3efc89f0 2931 -for f in .. $(EXTRA_MULTILIB_PARTS); do if [ x$${f} != x.. ]; then \
2932 cp stage2/$${f} . ; \
7561ae90 2933 else true; \
3efc89f0 2934 fi; done
73027c94 2935stage2: force stage2-start lang.stage2
32e6d418 2936
73027c94 2937stage3-start:
2388f67d 2938 -if [ -d stage3 ] ; then true ; else mkdir stage3 ; fi
73027c94 2939 -for dir in . $(SUBDIRS) ; \
2940 do \
21fde8a9 2941 if [ -d stage3/$$dir ] ; then true ; else mkdir stage3/$$dir ; fi ; \
73027c94 2942 done
32e6d418 2943 -mv $(STAGESTUFF) stage3
b541ad9d 2944# Copy as/ld if they exist to stage dir, so that running xgcc from the stage
2945# dir will work properly.
ea4a6c81 2946 -if [ -f as$(exeext) ] ; then $(LN_S) ../as$(exeext) stage3 ; else true ; fi
2947 -if [ -f ld$(exeext) ] ; then $(LN_S) ../ld$(exeext) stage3 ; else true ; fi
2948 -if [ -f collect-ld$(exeext) ] ; then $(LN_S) ../collect-ld$(exeext) stage3 ; else true ; fi
32e6d418 2949 -rm -f stage3/libgcc.a
2950 -cp libgcc.a stage3
2951 -if $(RANLIB_TEST) ; then $(RANLIB) stage3/libgcc.a; else true; fi
3efc89f0 2952 -for f in .. $(EXTRA_MULTILIB_PARTS); do if [ x$${f} != x.. ]; then \
2953 cp stage3/$${f} . ; \
7561ae90 2954 else true; \
3efc89f0 2955 fi; done
73027c94 2956stage3: force stage3-start lang.stage3
32e6d418 2957
73027c94 2958stage4-start:
2388f67d 2959 -if [ -d stage4 ] ; then true ; else mkdir stage4 ; fi
73027c94 2960 -for dir in . $(SUBDIRS) ; \
2961 do \
21fde8a9 2962 if [ -d stage4/$$dir ] ; then true ; else mkdir stage4/$$dir ; fi ; \
73027c94 2963 done
32e6d418 2964 -mv $(STAGESTUFF) stage4
b541ad9d 2965# Copy as/ld if they exist to stage dir, so that running xgcc from the stage
2966# dir will work properly.
ea4a6c81 2967 -if [ -f as$(exeext) ] ; then $(LN_S) ../as$(exeext) stage4 ; else true ; fi
2968 -if [ -f ld$(exeext) ] ; then $(LN_S) ../ld$(exeext) stage4 ; else true ; fi
2969 -if [ -f collect-ld$(exeext) ] ; then $(LN_S) ../collect-ld$(exeext) stage4 ; else true ; fi
32e6d418 2970 -rm -f stage4/libgcc.a
2971 -cp libgcc.a stage4
2972 -if $(RANLIB_TEST) ; then $(RANLIB) stage4/libgcc.a; else true; fi
3efc89f0 2973 -for f in .. $(EXTRA_MULTILIB_PARTS); do if [ x$${f} != x.. ]; then \
2974 cp stage4/$${f} . ; \
7561ae90 2975 else true; \
3efc89f0 2976 fi; done
73027c94 2977stage4: force stage4-start lang.stage4
32e6d418 2978
2979# Copy just the executable files from a particular stage into a subdirectory,
2980# and delete the object files. Use this if you're just verifying a version
2981# that is pretty sure to work, and you are short of disk space.
62268150 2982risky-stage1: stage1
7cc2ce68 2983 -make clean
32e6d418 2984
62268150 2985risky-stage2: stage2
32e6d418 2986 -make clean
2987
62268150 2988risky-stage3: stage3
32e6d418 2989 -make clean
2990
62268150 2991risky-stage4: stage4
32e6d418 2992 -make clean
2993
2994#In GNU Make, ignore whether `stage*' exists.
a8514488 2995.PHONY: stage1 stage2 stage3 stage4 clean maintainer-clean TAGS bootstrap
32e6d418 2996.PHONY: risky-stage1 risky-stage2 risky-stage3 risky-stage4
2997
2998force:
d54b81e0 2999
3000# ---
3001# The enquire rules are still useful for building new float-anything.h.
3002# Special flags for compiling enquire.
3003# We disable optimization to make floating point more reliable.
3004ENQUIRE_CFLAGS = -DNO_MEM -DNO_LONG_DOUBLE_IO -O0
3005ENQUIRE_LDFLAGS = $(LDFLAGS)
3006
3007# Enquire target (This is a variable so that a target can choose not to
3008# build it.)
3009ENQUIRE = enquire
3010
3011# Test to see whether <float.h> exists in the system header files,
3012# and is not derived from GCC.
3013FLOAT_H_TEST = \
3014 [ -f $(SYSTEM_HEADER_DIR)/float.h ] && \
3015 if grep 'ifndef _FLOAT_H___' $(SYSTEM_HEADER_DIR)/float.h >/dev/null; \
3016 then false; \
3017 else :; fi
3018# We pretend to not having a usable <float.h>, hence disable the FLOAT_H_TEST
3019# to ensure, we're emitting a full blown <float.h> ourselves.
3020FLOAT_H_TEST = false
3021
3022# Used to compile enquire with standard cc, but have forgotten why.
3023# Let's try with GCC.
3024enquire: enquire.o $(GCC_PARTS)
3025 $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(ENQUIRE_LDFLAGS) enquire.o -o $@
3026enquire.o: $(srcdir)/enquire.c $(GCC_PASSES) stmp-int-hdrs
3027 if $(FLOAT_H_TEST); then \
3028 rm -f include/float.h; \
3029 SYS_FLOAT_H_WRAP=1; \
3030 else :; \
3031 SYS_FLOAT_H_WRAP=0; \
3032 fi; \
3033 $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(ALL_CPPFLAGS) $(ENQUIRE_CFLAGS) \
3034 -DSYS_FLOAT_H_WRAP=$$SYS_FLOAT_H_WRAP \
3035 -I. -c $(srcdir)/enquire.c
3036
3037# Create float.h source for the native machine.
3038# Make it empty if we can use the system float.h without changes.
3039float.h-nat: enquire
3040 -./enquire -f > tmp-float.h
3041 grep '#define [^_]' tmp-float.h >/dev/null || true > tmp-float.h
3042 mv tmp-float.h float.h-nat
3043
3044# Create a dummy float.h source for a cross-compiler.
3045# ??? This isn't used anymore. Should we create config/float-unkn.h
3046# and make that the default float_format in configure?
3047float.h-cross:
3048 echo "#ifndef __GCC_FLOAT_NOT_NEEDED" > t-float.h-cross
3049 echo "#error float.h values not known for cross-compiler" >> t-float.h-cross
3050 echo "#endif" >> t-float.h-cross
3051 mv t-float.h-cross float.h-cross
3052