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