]> git.ipfire.org Git - thirdparty/gcc.git/blame - gcc/Makefile.in
* haifa-sched.c: Include "system.h" to get <stdlib.h> and <stdio.h>.
[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.
8757933b 42LANGUAGES = c proto gcov @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.
94ca3aab 340USE_COLLECT2 = ld
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).
d1871a55 381GCC_PASSES=xgcc cc1 cpp $(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 \
d95fa18c 614 insn-attr.h insn-attrtab.c insn-opinit.c \
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) \
621 genattr$(build_exeext) genopinit$(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.
73027c94 751all.build: native xgcc $(EXTRA_PARTS) lang.all.build
32e6d418 752# This is what must be made before installing GCC and converting libraries.
73027c94 753start.encap: native xgcc 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.
0dbd1c74 758native: config.status auto-config.h cpp $(LANGUAGES) \
3ded972d 759 $(EXTRA_PASSES) $(EXTRA_PROGRAMS) $(USE_COLLECT2)
32e6d418 760
761# Define the names for selecting languages in LANGUAGES.
762C c: cc1
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`
3b9b6fde 778libgcc1-test.o: libgcc1-test.c native xgcc
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.
0dbd1c74 793xgcc: gcc.o version.o choose-temp.o pexecute.o prefix.o version.o \
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.
17108b2b 799specs: xgcc
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.
77a164d8 806gcc-cross: xgcc
62268150 807 cp xgcc$(exeext) gcc-cross$(exeext)
32e6d418 808
b54842d8 809cc1: $(P) $(C_OBJS) $(OBJS) $(LIBDEPS)
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)
32e6d418 871 echo "__foo () {}" > dummy.c
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
66a1f274 1241c-decl.o : c-decl.c $(CONFIG_H) $(TREE_H) c-tree.h c-lex.h flags.h output.h
1242c-typeck.o : c-typeck.c $(CONFIG_H) $(TREE_H) c-tree.h flags.h output.h
32e6d418 1243c-lang.o : c-lang.c $(CONFIG_H) $(TREE_H)
3ad7bb1c 1244c-lex.o : c-lex.c $(CONFIG_H) $(TREE_H) $(RTL_H) c-lex.h c-tree.h \
1245 $(srcdir)/c-parse.h input.h flags.h $(srcdir)/c-gperf.h c-pragma.h
32e6d418 1246c-aux-info.o : c-aux-info.c $(CONFIG_H) $(TREE_H) c-tree.h flags.h
1247c-convert.o : c-convert.c $(CONFIG_H) $(TREE_H) flags.h
2feda28e 1248c-pragma.o: c-pragma.c $(CONFIG_H) $(TREE_H) except.h function.h \
1249 defaults.h c-pragma.h
1294913b 1250c-iterate.o: c-iterate.c $(CONFIG_H) $(TREE_H) $(RTL_H) c-tree.h flags.h
32e6d418 1251
79f818d0 1252# To make a configuration always use collect2, set USE_COLLECT2 to ld.
1253ld: collect2
f403cbcb 1254 rm -f ld$(exeext)
ea4a6c81 1255 $(LN) collect2$(exeext) ld$(exeext)
79f818d0 1256
94ca3aab 1257collect2: collect2.o tlink.o hash.o cplus-dem.o underscore.o version.o \
6c468b11 1258 choose-temp.o $(LIBDEPS)
e77fd588 1259# Don't try modifying collect2 (aka ld) in place--it might be linking this.
62268150 1260 -rm -f collect2$(exeext)
94ca3aab 1261 $(CC) $(ALL_CFLAGS) $(LDFLAGS) -o $@ collect2.o tlink.o hash.o \
6c468b11 1262 cplus-dem.o underscore.o version.o choose-temp.o $(LIBS)
32e6d418 1263
ad87de1e 1264collect2.o : collect2.c $(CONFIG_H) gansidecl.h gstab.h obstack.h $(DEMANGLE_H)
5e03c63d 1265 $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \
67cb4bc1 1266 -DTARGET_MACHINE=\"$(target_alias)\" $(MAYBE_USE_COLLECT2) \
5e03c63d 1267 -c `echo $(srcdir)/collect2.c | sed 's,^\./,,'`
32e6d418 1268
ad87de1e 1269tlink.o: tlink.c $(DEMANGLE_H) hash.h $(CONFIG_H)
94ca3aab 1270hash.o: hash.c hash.h
ad87de1e 1271cplus-dem.o: cplus-dem.c $(DEMANGLE_H)
d2f0b724 1272
7306ddcf 1273underscore.c: stamp-under ; @true
1274
1275stamp-under: $(GCC_PASSES)
c20b28d5 1276 echo "int xxy_us_dummy;" >tmp-dum.c
1277 $(GCC_FOR_TARGET) -S tmp-dum.c
1278 echo '/*WARNING: This file is automatically generated!*/' >tmp-under.c
1279 if grep _xxy_us_dummy tmp-dum.s > /dev/null ; then \
1280 echo "int prepends_underscore = 1;" >>tmp-under.c; \
d2f0b724 1281 else \
c20b28d5 1282 echo "int prepends_underscore = 0;" >>tmp-under.c; \
d2f0b724 1283 fi
c20b28d5 1284 $(srcdir)/move-if-change tmp-under.c underscore.c
1285 -rm -f tmp-dum.c tmp-dum.s
7306ddcf 1286 touch stamp-under
d2f0b724 1287
32e6d418 1288# A file used by all variants of C.
1289
1290c-common.o : c-common.c $(CONFIG_H) $(TREE_H) c-tree.h c-lex.h flags.h
1291
1292# Language-independent files.
1293
4813bdd4 1294DRIVER_DEFINES = \
32e6d418 1295 -DSTANDARD_STARTFILE_PREFIX=\"$(libdir)/\" \
c6396a0b 1296 -DSTANDARD_EXEC_PREFIX=\"$(libdir)/gcc-lib/\" \
7df9e578 1297 -DDEFAULT_TARGET_VERSION=\"$(version)\" \
67cb4bc1 1298 -DDEFAULT_TARGET_MACHINE=\"$(target_alias)\" \
4813bdd4 1299 -DTOOLDIR_BASE_PREFIX=\"$(exec_prefix)/\"
ad87de1e 1300gcc.o: gcc.c $(CONFIG_H) gansidecl.h multilib.h Makefile $(lang_specs_files)
4813bdd4 1301 $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \
1302 $(DRIVER_DEFINES) \
32e6d418 1303 -c `echo $(srcdir)/gcc.c | sed 's,^\./,,'`
1304
1305dumpvers: dumpvers.c
1306
1307version.o: version.c
ad87de1e 1308obstack.o: obstack.c $(CONFIG_H)
1309choose-temp.o: choose-temp.c $(CONFIG_H) gansidecl.h
1310pexecute.o: pexecute.c $(CONFIG_H) gansidecl.h
1311prefix.o: prefix.c $(CONFIG_H) gansidecl.h Makefile
0dbd1c74 1312 $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \
1313 -DPREFIX=\"$(prefix)\" \
1314 -c `echo $(srcdir)/prefix.c | sed 's,^\./,,'`
32e6d418 1315
beb68ac1 1316convert.o: convert.c $(CONFIG_H) $(TREE_H) flags.h convert.h
1317
335ebf8f 1318tree.o : tree.c $(CONFIG_H) $(TREE_H) flags.h function.h
32e6d418 1319print-tree.o : print-tree.c $(CONFIG_H) $(TREE_H)
a6a1ab64 1320stor-layout.o : stor-layout.c $(CONFIG_H) $(TREE_H) flags.h function.h
32e6d418 1321fold-const.o : fold-const.c $(CONFIG_H) $(TREE_H) flags.h
b54842d8 1322toplev.o : toplev.c $(CONFIG_H) $(TREE_H) $(RTL_H) \
636fef92 1323 flags.h input.h insn-attr.h xcoffout.h defaults.h output.h \
1324 $(lang_options_files)
b600804e 1325 $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $(MAYBE_USE_COLLECT2) \
67cb4bc1 1326 -DTARGET_NAME=\"$(target_alias)\" \
fe918d35 1327 -c `echo $(srcdir)/toplev.c | sed 's,^\./,,'`
32e6d418 1328
1329rtl.o : rtl.c $(CONFIG_H) $(RTL_H)
1330
1331print-rtl.o : print-rtl.c $(CONFIG_H) $(RTL_H)
1332rtlanal.o : rtlanal.c $(CONFIG_H) $(RTL_H)
1333
35325097 1334varasm.o : varasm.c $(CONFIG_H) $(TREE_H) $(RTL_H) flags.h function.h \
66a1f274 1335 defaults.h insn-codes.h expr.h hard-reg-set.h regs.h xcoffout.h \
b54842d8 1336 output.h c-pragma.h
32e6d418 1337function.o : function.c $(CONFIG_H) $(RTL_H) $(TREE_H) flags.h function.h \
1338 insn-flags.h insn-codes.h expr.h regs.h hard-reg-set.h insn-config.h \
b54842d8 1339 $(RECOG_H) output.h
32e6d418 1340stmt.o : stmt.c $(CONFIG_H) $(RTL_H) $(TREE_H) flags.h function.h \
037a5228 1341 insn-flags.h insn-config.h insn-codes.h hard-reg-set.h expr.h except.h \
b54842d8 1342 loop.h $(RECOG_H)
037a5228 1343except.o : except.c $(CONFIG_H) $(RTL_H) $(TREE_H) flags.h function.h \
1344 insn-flags.h insn-codes.h expr.h regs.h hard-reg-set.h insn-config.h \
ad87de1e 1345 $(RECOG_H) output.h except.h
93ad9ce9 1346expr.o : expr.c $(CONFIG_H) $(RTL_H) $(TREE_H) flags.h function.h regs.h \
ad87de1e 1347 insn-flags.h insn-codes.h expr.h insn-config.h $(RECOG_H) output.h \
2f7ce20a 1348 typeclass.h hard-reg-set.h
32e6d418 1349calls.o : calls.c $(CONFIG_H) $(RTL_H) $(TREE_H) flags.h expr.h insn-codes.h \
0dbd1c74 1350 insn-flags.h regs.h
32e6d418 1351expmed.o : expmed.c $(CONFIG_H) $(RTL_H) $(TREE_H) flags.h \
ad87de1e 1352 insn-flags.h insn-config.h insn-codes.h expr.h $(RECOG_H) real.h
32e6d418 1353explow.o : explow.c $(CONFIG_H) $(RTL_H) $(TREE_H) flags.h hard-reg-set.h \
ad87de1e 1354 insn-config.h expr.h $(RECOG_H) insn-flags.h insn-codes.h
32e6d418 1355optabs.o : optabs.c $(CONFIG_H) $(RTL_H) $(TREE_H) flags.h \
ad87de1e 1356 insn-flags.h insn-config.h insn-codes.h expr.h $(RECOG_H) reload.h
32e6d418 1357dbxout.o : dbxout.c $(CONFIG_H) $(TREE_H) $(RTL_H) flags.h regs.h \
e7748130 1358 insn-config.h reload.h gstab.h xcoffout.h defaults.h output.h
f95d8264 1359sdbout.o : sdbout.c $(CONFIG_H) $(TREE_H) $(RTL_H) flags.h except.h \
1360 function.h expr.h output.h hard-reg-set.h regs.h defaults.h real.h \
b54842d8 1361 insn-config.h obstack.h xcoffout.h c-pragma.h
32e6d418 1362dwarfout.o : dwarfout.c $(CONFIG_H) $(TREE_H) $(RTL_H) dwarf.h flags.h \
8a19d0d5 1363 insn-config.h reload.h output.h defaults.h
632478b5 1364dwarf2out.o : dwarf2out.c $(CONFIG_H) $(TREE_H) $(RTL_H) dwarf2.h flags.h \
26966038 1365 insn-config.h insn-codes.h reload.h output.h defaults.h hard-reg-set.h \
1366 regs.h expr.h
79f818d0 1367xcoffout.o : xcoffout.c $(CONFIG_H) $(TREE_H) $(RTL_H) xcoffout.h flags.h
0dbd1c74 1368emit-rtl.o : emit-rtl.c $(CONFIG_H) $(RTL_H) $(TREE_H) flags.h except.h \
26966038 1369 function.h regs.h insn-config.h insn-codes.h $(RECOG_H) real.h expr.h \
1370 obstack.h
6d9f2c4c 1371real.o : real.c $(CONFIG_H) $(TREE_H)
c6396a0b 1372getpwd.o : getpwd.c $(CONFIG_H)
32e6d418 1373
1374integrate.o : integrate.c $(CONFIG_H) $(RTL_H) $(TREE_H) flags.h integrate.h \
beed1a9f 1375 insn-flags.h insn-config.h insn-codes.h expr.h real.h regs.h function.h \
b54842d8 1376 output.h $(RECOG_H) except.h
32e6d418 1377
1378jump.o : jump.c $(CONFIG_H) $(RTL_H) flags.h hard-reg-set.h regs.h \
26966038 1379 insn-config.h insn-codes.h insn-flags.h $(RECOG_H) expr.h real.h except.h
32e6d418 1380stupid.o : stupid.c $(CONFIG_H) $(RTL_H) regs.h hard-reg-set.h flags.h
1381
1382cse.o : cse.c $(CONFIG_H) $(RTL_H) regs.h hard-reg-set.h flags.h real.h \
26966038 1383 insn-config.h insn-codes.h $(RECOG_H) expr.h
2b55270a 1384profile.o : profile.c $(CONFIG_H) $(RTL_H) flags.h insn-flags.h gcov-io.h \
ad87de1e 1385 $(TREE_H) output.h regs.h
32e6d418 1386loop.o : loop.c $(CONFIG_H) $(RTL_H) flags.h loop.h insn-config.h \
ad87de1e 1387 insn-flags.h insn-codes.h regs.h hard-reg-set.h $(RECOG_H) expr.h real.h
26966038 1388unroll.o : unroll.c $(CONFIG_H) $(RTL_H) insn-config.h insn-codes.h \
1389 integrate.h regs.h $(RECOG_H) flags.h expr.h loop.h
32e6d418 1390flow.o : flow.c $(CONFIG_H) $(RTL_H) flags.h insn-config.h \
8f220b93 1391 $(BASIC_BLOCK_H) regs.h hard-reg-set.h output.h
335ebf8f 1392combine.o : combine.c $(CONFIG_H) $(RTL_H) flags.h \
32e6d418 1393 insn-config.h insn-flags.h insn-codes.h insn-attr.h regs.h expr.h \
ad87de1e 1394 $(BASIC_BLOCK_H) $(RECOG_H) real.h hard-reg-set.h
32e6d418 1395regclass.o : regclass.c $(CONFIG_H) $(RTL_H) hard-reg-set.h flags.h \
b54842d8 1396 $(BASIC_BLOCK_H) regs.h insn-config.h $(RECOG_H) reload.h real.h
8f220b93 1397local-alloc.o : local-alloc.c $(CONFIG_H) $(RTL_H) flags.h $(BASIC_BLOCK_H) \
ad87de1e 1398 regs.h hard-reg-set.h insn-config.h $(RECOG_H) output.h
8f220b93 1399bitmap.o : bitmap.c $(CONFIG_H) $(RTL_H) flags.h $(BASIC_BLOCK_H) regs.h
8a4b1e01 1400global.o : global.c $(CONFIG_H) $(RTL_H) flags.h \
8f220b93 1401 $(BASIC_BLOCK_H) regs.h hard-reg-set.h insn-config.h output.h
32e6d418 1402
64016d24 1403reload.o : reload.c $(CONFIG_H) $(RTL_H) flags.h output.h expr.h\
ad87de1e 1404 reload.h $(RECOG_H) hard-reg-set.h insn-config.h insn-codes.h regs.h real.h
067fa30b 1405reload1.o : reload1.c $(CONFIG_H) $(RTL_H) real.h flags.h expr.h \
32e6d418 1406 reload.h regs.h hard-reg-set.h insn-config.h insn-flags.h insn-codes.h \
ad87de1e 1407 $(BASIC_BLOCK_H) $(RECOG_H) output.h
32e6d418 1408caller-save.o : caller-save.c $(CONFIG_H) $(RTL_H) flags.h \
ad87de1e 1409 regs.h hard-reg-set.h insn-codes.h insn-config.h $(BASIC_BLOCK_H) $(RECOG_H) \
f8de8de7 1410 reload.h expr.h
32e6d418 1411reorg.o : reorg.c $(CONFIG_H) $(RTL_H) conditions.h hard-reg-set.h \
26966038 1412 $(BASIC_BLOCK_H) regs.h insn-config.h insn-codes.h insn-attr.h \
1413 insn-flags.h $(RECOG_H) flags.h output.h expr.h
ea0cb7ae 1414alias.o : alias.c $(CONFIG_H) $(RTL_H) flags.h hard-reg-set.h regs.h \
1415 insn-codes.h
26966038 1416regmove.o : regmove.c $(CONFIG_H) $(RTL_H) insn-config.h insn-codes.h \
1417 recog.h output.h reload.h regs.h hard-reg-set.h flags.h expr.h insn-flags.h
46c1a957 1418$(SCHED_PREFIX)sched.o : $(SCHED_PREFIX)sched.c $(CONFIG_H) $(RTL_H) \
1419 $(BASIC_BLOCK_H) regs.h hard-reg-set.h flags.h insn-config.h \
1420 insn-attr.h system.h
335ebf8f 1421final.o : final.c $(CONFIG_H) $(RTL_H) $(TREE_H) flags.h regs.h \
ad87de1e 1422 $(RECOG_H) conditions.h insn-config.h insn-attr.h except.h real.h output.h \
fe918d35 1423 hard-reg-set.h insn-flags.h insn-codes.h gstab.h xcoffout.h defaults.h
32e6d418 1424recog.o : recog.c $(CONFIG_H) $(RTL_H) \
ad87de1e 1425 regs.h $(RECOG_H) hard-reg-set.h flags.h insn-config.h insn-attr.h \
32e6d418 1426 insn-flags.h insn-codes.h real.h
1427reg-stack.o : reg-stack.c $(CONFIG_H) $(RTL_H) $(TREE_H) \
d9bf0cf4 1428 regs.h hard-reg-set.h flags.h insn-config.h insn-flags.h
48c6936b 1429
5e7432f7 1430$(out_object_file): $(out_file) $(CONFIG_H) $(TREE_H) \
32e6d418 1431 $(RTL_H) regs.h hard-reg-set.h real.h insn-config.h conditions.h \
1432 insn-flags.h output.h insn-attr.h insn-codes.h
b600804e 1433 $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $(out_file)
32e6d418 1434
f213fcf9 1435# Build auxiliary files that support ecoff format.
1436mips-tfile: mips-tfile.o version.o $(LIBDEPS)
62268150 1437 $(CC) $(CFLAGS) $(LDFLAGS) -o $@ mips-tfile.o version.o $(LIBS)
f213fcf9 1438
1439mips-tfile.o : mips-tfile.c $(CONFIG_H) $(RTL_H)
1440
1441mips-tdump: mips-tdump.o version.o $(LIBDEPS)
62268150 1442 $(CC) $(CFLAGS) $(LDFLAGS) -o $@ mips-tdump.o version.o $(LIBS)
f213fcf9 1443
1444mips-tdump.o : mips-tdump.c $(CONFIG_H) $(RTL_H)
1445
636b182c 1446# Build file to support OSF/rose half-pic format.
1447halfpic.o: halfpic.c $(CONFIG_H) $(RTL_H) $(TREE_H)
1448
32e6d418 1449# Normally this target is not used; but it is used if you
1450# define ALLOCA=alloca.o. In that case, you must get a suitable alloca.c
1451# from the GNU Emacs distribution.
32e6d418 1452alloca.o: alloca.c
32e6d418 1453 $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $(ALLOCA_FLAGS) \
cc2af6ca 1454 -c `echo $(srcdir)/alloca.c | sed 's,^\./,,'`
32e6d418 1455 $(ALLOCA_FINISH)
2e9d8ccf 1456#\f
32e6d418 1457# Generate header and source files from the machine description,
1458# and compile them.
1459
1460.PRECIOUS: insn-config.h insn-flags.h insn-codes.h \
1461 insn-emit.c insn-recog.c insn-extract.c insn-output.c insn-peep.c \
1462 insn-attr.h insn-attrtab.c
1463
1464# The following pair of rules has this effect:
1465# genconfig is run only if the md has changed since genconfig was last run;
1466# but the file insn-config.h is touched only when its contents actually change.
1467
1468# Each of the other insn-* files is handled by a similar pair of rules.
1469
3f69fed5 1470# This causes an anomaly in the results of make -n
1471# because insn-* is older than stamp-*
1472# and thus make -n thinks that insn-* will be updated
1473# and force recompilation of things that depend on it.
9ac790c5 1474# We use move-if-change precisely to avoid such recompilation.
3f69fed5 1475# But there is no way to teach make -n that it will be avoided.
1476
32e6d418 1477# Each of the insn-*.[ch] rules has a semicolon at the end,
1478# for otherwise the system Make on SunOS 4.1 never tries
876dc5b0 1479# to recompile insn-*.o. To avoid problems and extra noise from
1480# versions of make which don't like empty commands (nothing after the
1481# trailing `;'), we call true for each.
32e6d418 1482
c2a18965 1483insn-config.h: stamp-config ; @true
c20b28d5 1484stamp-config : $(md_file) genconfig $(srcdir)/move-if-change
1485 ./genconfig $(md_file) > tmp-config.h
32e6d418 1486 $(srcdir)/move-if-change tmp-config.h insn-config.h
1487 touch stamp-config
1488
c2a18965 1489insn-flags.h: stamp-flags ; @true
c20b28d5 1490stamp-flags : $(md_file) genflags $(srcdir)/move-if-change
1491 ./genflags $(md_file) > tmp-flags.h
32e6d418 1492 $(srcdir)/move-if-change tmp-flags.h insn-flags.h
1493 touch stamp-flags
1494
c2a18965 1495insn-codes.h: stamp-codes ; @true
c20b28d5 1496stamp-codes : $(md_file) gencodes $(srcdir)/move-if-change
1497 ./gencodes $(md_file) > tmp-codes.h
32e6d418 1498 $(srcdir)/move-if-change tmp-codes.h insn-codes.h
1499 touch stamp-codes
1500
1501insn-emit.o : insn-emit.c $(CONFIG_H) $(RTL_H) expr.h real.h output.h \
1502 insn-config.h insn-flags.h insn-codes.h
1503 $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) -c insn-emit.c
1504
c2a18965 1505insn-emit.c: stamp-emit ; @true
c20b28d5 1506stamp-emit : $(md_file) genemit $(srcdir)/move-if-change
1507 ./genemit $(md_file) > tmp-emit.c
32e6d418 1508 $(srcdir)/move-if-change tmp-emit.c insn-emit.c
1509 touch stamp-emit
1510
ad87de1e 1511insn-recog.o : insn-recog.c $(CONFIG_H) $(RTL_H) insn-config.h $(RECOG_H) \
32e6d418 1512 real.h output.h flags.h
1513 $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) -c insn-recog.c
1514
c2a18965 1515insn-recog.c: stamp-recog ; @true
c20b28d5 1516stamp-recog : $(md_file) genrecog $(srcdir)/move-if-change
1517 ./genrecog $(md_file) > tmp-recog.c
32e6d418 1518 $(srcdir)/move-if-change tmp-recog.c insn-recog.c
1519 touch stamp-recog
1520
bdb66cef 1521insn-opinit.o : insn-opinit.c $(CONFIG_H) $(RTL_H) insn-codes.h insn-flags.h \
ad87de1e 1522 insn-config.h flags.h $(RECOG_H) expr.h reload.h
bdb66cef 1523 $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) -c insn-opinit.c
1524
1525insn-opinit.c: stamp-opinit ; @true
c20b28d5 1526stamp-opinit : $(md_file) genopinit $(srcdir)/move-if-change
1527 ./genopinit $(md_file) > tmp-opinit.c
bdb66cef 1528 $(srcdir)/move-if-change tmp-opinit.c insn-opinit.c
1529 touch stamp-opinit
1530
32e6d418 1531insn-extract.o : insn-extract.c $(CONFIG_H) $(RTL_H)
1532 $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) -c insn-extract.c
1533
c2a18965 1534insn-extract.c: stamp-extract ; @true
c20b28d5 1535stamp-extract : $(md_file) genextract $(srcdir)/move-if-change
1536 ./genextract $(md_file) > tmp-extract.c
32e6d418 1537 $(srcdir)/move-if-change tmp-extract.c insn-extract.c
1538 touch stamp-extract
1539
1540insn-peep.o : insn-peep.c $(CONFIG_H) $(RTL_H) regs.h output.h real.h
1541 $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) -c insn-peep.c
1542
c2a18965 1543insn-peep.c: stamp-peep ; @true
c20b28d5 1544stamp-peep : $(md_file) genpeep $(srcdir)/move-if-change
1545 ./genpeep $(md_file) > tmp-peep.c
32e6d418 1546 $(srcdir)/move-if-change tmp-peep.c insn-peep.c
1547 touch stamp-peep
1548
1549insn-attrtab.o : insn-attrtab.c $(CONFIG_H) $(RTL_H) regs.h real.h output.h \
1550 insn-attr.h insn-config.h
1551 $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) -c insn-attrtab.c
1552
c2a18965 1553insn-attr.h: stamp-attr ; @true
c20b28d5 1554stamp-attr : $(md_file) genattr $(srcdir)/move-if-change
1555 ./genattr $(md_file) > tmp-attr.h
32e6d418 1556 $(srcdir)/move-if-change tmp-attr.h insn-attr.h
1557 touch stamp-attr
1558
c2a18965 1559insn-attrtab.c: stamp-attrtab ; @true
c20b28d5 1560stamp-attrtab : $(md_file) genattrtab $(srcdir)/move-if-change
1561 if cmp -s $(PREMADE_ATTRTAB_MD) $(md_file); \
8bd8ea06 1562 then \
1563 echo Using $(PREMADE_ATTRTAB); \
ab866dde 1564 cp $(PREMADE_ATTRTAB) tmp-attrtab.c; \
8bd8ea06 1565 else \
c20b28d5 1566 ./genattrtab $(md_file) > tmp-attrtab.c; \
8bd8ea06 1567 fi
32e6d418 1568 $(srcdir)/move-if-change tmp-attrtab.c insn-attrtab.c
1569 touch stamp-attrtab
1570
1571insn-output.o : insn-output.c $(CONFIG_H) $(RTL_H) regs.h real.h conditions.h \
ad87de1e 1572 hard-reg-set.h insn-config.h insn-flags.h insn-attr.h output.h $(RECOG_H) \
32e6d418 1573 insn-codes.h
1574 $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) -c insn-output.c
1575
c2a18965 1576insn-output.c: stamp-output ; @true
c20b28d5 1577stamp-output : $(md_file) genoutput $(srcdir)/move-if-change
1578 ./genoutput $(md_file) > tmp-output.c
32e6d418 1579 $(srcdir)/move-if-change tmp-output.c insn-output.c
1580 touch stamp-output
3ad7bb1c 1581
1582genrtl.o : genrtl.c $(CONFIG_H) $(RTL_H)
1583genrtl.c genrtl.h : stamp-genrtl
7cc452c1 1584 @true # force gnu make to recheck modification times.
1585
3ad7bb1c 1586stamp-genrtl: gengenrtl $(srcdir)/move-if-change $(RTL_BASE_H)
1587 ./gengenrtl tmp-genrtl.h tmp-genrtl.c
1588 $(srcdir)/move-if-change tmp-genrtl.h genrtl.h
1589 $(srcdir)/move-if-change tmp-genrtl.c genrtl.c
1590 touch stamp-genrtl
1591
2e9d8ccf 1592#\f
32e6d418 1593# Compile the programs that generate insn-* from the machine description.
1594# They are compiled with $(HOST_CC), and associated libraries,
1595# since they need to run on this machine
1596# even if GCC is being compiled to run on some other machine.
1597
1598# $(CONFIG_H) is omitted from the deps of the gen*.o
1599# because these programs don't really depend on anything
1600# about the target machine. They do depend on config.h itself,
1601# since that describes the host machine.
1602
89e36a04 1603# Pass the md file through cpp if the target requests it.
2c352995 1604$(MD_FILE): $(MD_DEPS)
1605 rm -f $@
c20b28d5 1606 $(MD_CPP) $(MD_CPPFLAGS) $(md_file) | sed 's/^# /; /g' > tmp-$@
c92e16d4 1607 mv tmp-$@ $@
89e36a04 1608
32e6d418 1609genconfig : genconfig.o $(HOST_RTL) $(HOST_LIBDEPS)
62268150 1610 $(HOST_CC) $(HOST_CFLAGS) $(HOST_LDFLAGS) -o $@ \
32e6d418 1611 genconfig.o $(HOST_RTL) $(HOST_LIBS)
1612
c20b28d5 1613genconfig.o : genconfig.c $(RTL_H) $(build_xm_file)
32e6d418 1614 $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(srcdir)/genconfig.c
1615
1616genflags : genflags.o $(HOST_RTL) $(HOST_LIBDEPS)
62268150 1617 $(HOST_CC) $(HOST_CFLAGS) $(HOST_LDFLAGS) -o $@ \
32e6d418 1618 genflags.o $(HOST_RTL) $(HOST_LIBS)
1619
c20b28d5 1620genflags.o : genflags.c $(RTL_H) $(build_xm_file)
32e6d418 1621 $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(srcdir)/genflags.c
1622
1623gencodes : gencodes.o $(HOST_RTL) $(HOST_LIBDEPS)
62268150 1624 $(HOST_CC) $(HOST_CFLAGS) $(HOST_LDFLAGS) -o $@ \
32e6d418 1625 gencodes.o $(HOST_RTL) $(HOST_LIBS)
1626
c20b28d5 1627gencodes.o : gencodes.c $(RTL_H) $(build_xm_file)
32e6d418 1628 $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(srcdir)/gencodes.c
1629
1630genemit : genemit.o $(HOST_RTL) $(HOST_LIBDEPS)
62268150 1631 $(HOST_CC) $(HOST_CFLAGS) $(HOST_LDFLAGS) -o $@ \
32e6d418 1632 genemit.o $(HOST_RTL) $(HOST_LIBS)
1633
c20b28d5 1634genemit.o : genemit.c $(RTL_H) $(build_xm_file)
32e6d418 1635 $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(srcdir)/genemit.c
1636
bdb66cef 1637genopinit : genopinit.o $(HOST_RTL) $(HOST_LIBDEPS)
62268150 1638 $(HOST_CC) $(HOST_CFLAGS) $(HOST_LDFLAGS) -o $@ \
bdb66cef 1639 genopinit.o $(HOST_RTL) $(HOST_LIBS)
1640
c20b28d5 1641genopinit.o : genopinit.c $(RTL_H) $(build_xm_file)
bdb66cef 1642 $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(srcdir)/genopinit.c
1643
32e6d418 1644genrecog : genrecog.o $(HOST_RTL) $(HOST_LIBDEPS)
62268150 1645 $(HOST_CC) $(HOST_CFLAGS) $(HOST_LDFLAGS) -o $@ \
32e6d418 1646 genrecog.o $(HOST_RTL) $(HOST_LIBS)
1647
c20b28d5 1648genrecog.o : genrecog.c $(RTL_H) $(build_xm_file)
32e6d418 1649 $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(srcdir)/genrecog.c
1650
1651genextract : genextract.o $(HOST_RTL) $(HOST_LIBDEPS)
62268150 1652 $(HOST_CC) $(HOST_CFLAGS) $(HOST_LDFLAGS) -o $@ \
32e6d418 1653 genextract.o $(HOST_RTL) $(HOST_LIBS)
1654
c20b28d5 1655genextract.o : genextract.c $(RTL_H) $(build_xm_file) insn-config.h
32e6d418 1656 $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(srcdir)/genextract.c
1657
1658genpeep : genpeep.o $(HOST_RTL) $(HOST_LIBDEPS)
62268150 1659 $(HOST_CC) $(HOST_CFLAGS) $(HOST_LDFLAGS) -o $@ \
32e6d418 1660 genpeep.o $(HOST_RTL) $(HOST_LIBS)
1661
c20b28d5 1662genpeep.o : genpeep.c $(RTL_H) $(build_xm_file)
32e6d418 1663 $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(srcdir)/genpeep.c
1664
1665genattr : genattr.o $(HOST_RTL) $(HOST_LIBDEPS)
62268150 1666 $(HOST_CC) $(HOST_CFLAGS) $(HOST_LDFLAGS) -o $@ \
32e6d418 1667 genattr.o $(HOST_RTL) $(HOST_LIBS)
1668
c20b28d5 1669genattr.o : genattr.c $(RTL_H) $(build_xm_file)
32e6d418 1670 $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(srcdir)/genattr.c
1671
262d46de 1672genattrtab : genattrtab.o $(HOST_RTL) $(HOST_PRINT) $(HOST_RTLANAL) $(HOST_LIBDEPS)
62268150 1673 $(HOST_CC) $(HOST_CFLAGS) $(HOST_LDFLAGS) -o $@ \
262d46de 1674 genattrtab.o $(HOST_RTL) $(HOST_PRINT) $(HOST_RTLANAL) $(HOST_LIBS)
32e6d418 1675
c20b28d5 1676genattrtab.o : genattrtab.c $(RTL_H) $(build_xm_file) insn-config.h
32e6d418 1677 $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(srcdir)/genattrtab.c
1678
1679genoutput : genoutput.o $(HOST_RTL) $(HOST_LIBDEPS)
62268150 1680 $(HOST_CC) $(HOST_CFLAGS) $(HOST_LDFLAGS) -o $@ \
32e6d418 1681 genoutput.o $(HOST_RTL) $(HOST_LIBS)
1682
c20b28d5 1683genoutput.o : genoutput.c $(RTL_H) $(build_xm_file)
32e6d418 1684 $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(srcdir)/genoutput.c
3ad7bb1c 1685
1686gengenrtl : gengenrtl.o $(HOST_LIBDEPS)
1687 $(HOST_CC) $(HOST_CFLAGS) $(HOST_LDFLAGS) -o $@ \
1688 gengenrtl.o $(HOST_LIBS)
1689
1690gengenrtl.o : gengenrtl.c $(RTL_BASE_H)
1691 $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(srcdir)/gengenrtl.c
1692
2e9d8ccf 1693#\f
32e6d418 1694# Compile the libraries to be used by gen*.
1695# If we are not cross-building, gen* use the same .o's that cc1 will use,
1696# and HOST_PREFIX_1 is `foobar', just to ensure these rules don't conflict
1697# with the rules for rtl.o, alloca.o, etc.
1698$(HOST_PREFIX_1)rtl.o: $(srcdir)/rtl.c $(CONFIG_H) $(RTL_H)
1699 rm -f $(HOST_PREFIX)rtl.c
e77fd588 1700 sed -e 's/config[.]h/hconfig.h/' $(srcdir)/rtl.c > $(HOST_PREFIX)rtl.c
32e6d418 1701 $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(HOST_PREFIX)rtl.c
1702
262d46de 1703$(HOST_PREFIX_1)print-rtl.o: $(srcdir)/print-rtl.c $(CONFIG_H) $(RTL_H)
1704 rm -f $(HOST_PREFIX)print-rtl.c
e77fd588 1705 sed -e 's/config[.]h/hconfig.h/' $(srcdir)/print-rtl.c > $(HOST_PREFIX)print-rtl.c
262d46de 1706 $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(HOST_PREFIX)print-rtl.c
1707
32e6d418 1708$(HOST_PREFIX_1)rtlanal.o: $(srcdir)/rtlanal.c $(CONFIG_H) $(RTL_H)
1709 rm -f $(HOST_PREFIX)rtlanal.c
e77fd588 1710 sed -e 's/config[.]h/hconfig.h/' $(srcdir)/rtlanal.c > $(HOST_PREFIX)rtlanal.c
32e6d418 1711 $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(HOST_PREFIX)rtlanal.c
1712
1713$(HOST_PREFIX_1)alloca.o: alloca.c
1714 rm -f $(HOST_PREFIX)alloca.c
1715 cp $(srcdir)/alloca.c $(HOST_PREFIX)alloca.c
1716 $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(HOST_PREFIX)alloca.c
1717
1718$(HOST_PREFIX_1)obstack.o: obstack.c
1719 rm -f $(HOST_PREFIX)obstack.c
e77fd588 1720 sed -e 's/config[.]h/hconfig.h/' $(srcdir)/obstack.c > $(HOST_PREFIX)obstack.c
32e6d418 1721 $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(HOST_PREFIX)obstack.c
1722
1723$(HOST_PREFIX_1)malloc.o: malloc.c
1724 rm -f $(HOST_PREFIX)malloc.c
e77fd588 1725 sed -e 's/config[.]h/hconfig.h/' $(srcdir)/malloc.c > $(HOST_PREFIX)malloc.c
32e6d418 1726 $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(HOST_PREFIX)malloc.c
1727
1728# This satisfies the dependency that we get if you cross-compile a compiler
1729# that does not need to compile alloca, malloc or whatever.
1730$(HOST_PREFIX_1):
1731 touch $(HOST_PREFIX_1)
649d8da6 1732
2e9d8ccf 1733#\f
32e6d418 1734# Remake cpp and protoize.
1735
1736# Making the preprocessor
3e4227af 1737cpp: $(CCCP)
f403cbcb 1738 -rm -f cpp$(exeext)
ea4a6c81 1739 $(LN) $(CCCP)$(exeext) cpp$(exeext)
0dbd1c74 1740cccp: cccp.o cexp.o version.o prefix.o $(LIBDEPS)
1741 $(CC) $(ALL_CFLAGS) $(LDFLAGS) -o $@ cccp.o cexp.o prefix.o \
62268150 1742 version.o $(LIBS)
0f557c81 1743cexp.o: $(srcdir)/cexp.c $(CONFIG_H)
32e6d418 1744 $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) -c $(srcdir)/cexp.c
1745$(srcdir)/cexp.c: $(srcdir)/cexp.y
1746 cd $(srcdir); $(BISON) -o cexp.c cexp.y
62268150 1747
d6b50af2 1748cccp.o: cccp.c $(CONFIG_H) pcp.h version.c config.status
32e6d418 1749# The reason we use $(libdir)/g++-include rather than using libsubdir
1750# is for compatibility with the current version of libg++.
1751 $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \
c6396a0b 1752 -DGCC_INCLUDE_DIR=\"$(libsubdir)/include\" \
3bf5d4dc 1753 -DGPLUSPLUS_INCLUDE_DIR=\"$(gxx_include_dir)\" \
ac2f5cba 1754 -DOLD_GPLUSPLUS_INCLUDE_DIR=\"$(old_gxx_include_dir)\" \
9a4f2cdd 1755 -DLOCAL_INCLUDE_DIR=\"$(includedir)\" \
c6396a0b 1756 -DCROSS_INCLUDE_DIR=\"$(libsubdir)/sys-include\" \
46073b39 1757 -DTOOL_INCLUDE_DIR=\"$(tooldir)/include\" \
32e6d418 1758 -c `echo $(srcdir)/cccp.c | sed 's,^\./,,'`
1759
3e4227af 1760cppmain: cppmain.o cpplib.o cpphash.o cppalloc.o cpperror.o cppexp.o \
0dbd1c74 1761 prefix.o version.o $(LIBDEPS)
62268150 1762 $(CC) $(ALL_CFLAGS) $(LDFLAGS) -o $@ cppmain.o cpplib.o cpphash.o \
0dbd1c74 1763 cppalloc.o cpperror.o cppexp.o prefix.o version.o $(LIBS)
3e4227af 1764
f03d7bcd 1765cppmain.o: cppmain.c $(CONFIG_H) cpplib.h
1766
7d1e7284 1767cpplib.o: cpplib.c $(CONFIG_H) cpplib.h cpphash.h config.status
3e4227af 1768 $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \
1769 -DGCC_INCLUDE_DIR=\"$(libsubdir)/include\" \
1770 -DGPLUSPLUS_INCLUDE_DIR=\"$(gxx_include_dir)\" \
ac2f5cba 1771 -DOLD_GPLUSPLUS_INCLUDE_DIR=\"$(old_gxx_include_dir)\" \
3e4227af 1772 -DLOCAL_INCLUDE_DIR=\"$(includedir)\" \
1773 -DCROSS_INCLUDE_DIR=\"$(libsubdir)/sys-include\" \
1774 -DTOOL_INCLUDE_DIR=\"$(tooldir)/include\" \
1775 -c `echo $(srcdir)/cpplib.c | sed 's,^\./,,'`
1776
7d1e7284 1777cpperror.o: cpperror.c $(CONFIG_H) cpplib.h
1778
1779cppexp.o: cppexp.c $(CONFIG_H) cpplib.h
1780
1781cpphash.o: cpphash.c cpplib.h cpphash.h
1782
885be33e 1783cppalloc.o: cppalloc.c $(CONFIG_H)
1784
876dc5b0 1785# Note for the stamp targets, we run the program `true' instead of
1786# having an empty command (nothing following the semicolon).
1787
732b8330 1788proto: config.status protoize unprotoize SYSCALLS.c.X
32e6d418 1789
c90a87d1 1790protoize: protoize.o getopt.o getopt1.o getpwd.o version.o \
1791 pexecute.o choose-temp.o $(LIBDEPS)
62268150 1792 $(CC) $(ALL_CFLAGS) $(LDFLAGS) -o $@ \
c90a87d1 1793 protoize.o getopt.o getopt1.o getpwd.o version.o \
1794 pexecute.o choose-temp.o $(LIBS)
ab866dde 1795
c90a87d1 1796unprotoize: unprotoize.o getopt.o getopt1.o getpwd.o version.o \
1797 pexecute.o choose-temp.o $(LIBDEPS)
62268150 1798 $(CC) $(ALL_CFLAGS) $(LDFLAGS) -o $@ \
c90a87d1 1799 unprotoize.o getopt.o getopt1.o getpwd.o version.o \
1800 pexecute.o choose-temp.o $(LIBS)
ab866dde 1801
122c82ed 1802protoize.o: protoize.c getopt.h $(CONFIG_H)
32e6d418 1803 $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \
1804 -DGCC_INCLUDE_DIR=\"$(libsubdir)/include\" \
3bf5d4dc 1805 -DGPLUSPLUS_INCLUDE_DIR=\"$(gxx_include_dir)\" \
32e6d418 1806 -DCROSS_INCLUDE_DIR=\"$(libsubdir)/sys-include\" \
46073b39 1807 -DTOOL_INCLUDE_DIR=\"$(tooldir)/include\" \
9a4f2cdd 1808 -DLOCAL_INCLUDE_DIR=\"$(includedir)\" \
32e6d418 1809 -DSTD_PROTO_DIR=\"$(libsubdir)\" \
122c82ed 1810 $(srcdir)/protoize.c
1811
1812unprotoize.o: unprotoize.c protoize.c getopt.h $(CONFIG_H)
32e6d418 1813 $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \
1814 -DGCC_INCLUDE_DIR=\"$(libsubdir)/include\" \
3bf5d4dc 1815 -DGPLUSPLUS_INCLUDE_DIR=\"$(gxx_include_dir)\" \
32e6d418 1816 -DCROSS_INCLUDE_DIR=\"$(libsubdir)/sys-include\" \
46073b39 1817 -DTOOL_INCLUDE_DIR=\"$(tooldir)/include\" \
9a4f2cdd 1818 -DLOCAL_INCLUDE_DIR=\"$(includedir)\" \
32e6d418 1819 -DSTD_PROTO_DIR=\"$(libsubdir)\" \
122c82ed 1820 $(srcdir)/unprotoize.c
32e6d418 1821
62268150 1822getopt.o: getopt.c getopt.h
32e6d418 1823 $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $(srcdir)/getopt.c
62268150 1824getopt1.o: getopt1.c getopt.h
32e6d418 1825 $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $(srcdir)/getopt1.c
1826
32e6d418 1827# This info describes the target machine, so compile with GCC just built.
62268150 1828SYSCALLS.c.X: $(srcdir)/sys-types.h $(srcdir)/sys-protos.h $(GCC_PASSES) \
1829 stmp-int-hdrs
f678532a 1830 -rm -f SYSCALLS.c tmp-SYSCALLS.s
79f818d0 1831 cat $(srcdir)/sys-types.h $(srcdir)/sys-protos.h > SYSCALLS.c
32e6d418 1832 $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \
f678532a 1833 -aux-info $@ -S -o tmp-SYSCALLS.s SYSCALLS.c
1834 -rm -f SYSCALLS.c tmp-SYSCALLS.s
0b20f012 1835
a5889b74 1836
0b20f012 1837test-protoize-simple: ./protoize ./unprotoize $(GCC_PASSES)
c548e550 1838 -rm -f tmp-proto.[cso]
262d46de 1839 cp $(srcdir)/protoize.c tmp-proto.c
1840 chmod u+w tmp-proto.c
c548e550 1841 ./protoize -N -B ./ -x getopt.h -c "-B./ -Wall -Wwrite-strings \
1842 $(CFLAGS) $(INCLUDES) \
0b20f012 1843 -DGCC_INCLUDE_DIR=0 \
1844 -DGPLUSPLUS_INCLUDE_DIR=0 \
1845 -DCROSS_INCLUDE_DIR=0 \
46073b39 1846 -DTOOL_INCLUDE_DIR=0 \
262d46de 1847 -DSTD_PROTO_DIR=0" tmp-proto.c
1a754c64 1848 @echo '**********' Expect 400 lines of differences.
c548e550 1849 -diff $(srcdir)/protoize.c tmp-proto.c > tmp-proto.diff
1850 -wc -l tmp-proto.diff
1851 ./unprotoize -N -x getopt.h -c "-B./ -Wall -Wwrite-strings \
1852 $(CFLAGS) $(INCLUDES) \
0b20f012 1853 -DGCC_INCLUDE_DIR=0 \
1854 -DGPLUSPLUS_INCLUDE_DIR=0 \
1855 -DCROSS_INCLUDE_DIR=0 \
46073b39 1856 -DTOOL_INCLUDE_DIR=0 \
262d46de 1857 -DSTD_PROTO_DIR=0" tmp-proto.c
0b20f012 1858 @echo Expect zero differences.
262d46de 1859 diff $(srcdir)/protoize.c tmp-proto.c | cat
62268150 1860 -rm -f tmp-proto.[cs] tmp-proto$(objext)
2b55270a 1861
1862gcov.o: gcov.c gcov-io.h
1863
1864gcov: gcov.o $(LIBDEPS)
1865 $(CC) $(ALL_CFLAGS) $(LDFLAGS) gcov.o $(LIBS) -o $@
2e9d8ccf 1866#\f
2cfd79fe 1867# Build the include directory. The stamp files are stmp-* rather than
1868# stamp-* so that mostlyclean does not force the include directory to
1869# be rebuilt.
1870
690a93ea 1871# Build the include directory except for float.h (which depends upon
1872# enquire).
8757933b 1873stmp-int-hdrs: stmp-fixinc $(USER_H) xlimits.h
2cfd79fe 1874# Copy in the headers provided with gcc.
1875# The sed command gets just the last file name component;
1876# this is necessary because VPATH could add a dirname.
1877# Using basename would be simpler, but some systems don't have it.
220345e0 1878# The touch command is here to workaround an AIX/Linux NFS bug.
c8763215 1879 for file in .. $(USER_H); do \
1880 if [ X$$file != X.. ]; then \
1881 realfile=`echo $$file | sed -e 's|.*/\([^/]*\)$$|\1|'`; \
220345e0 1882 touch include/$$realfile; \
1941d7da 1883 rm -f include/$$realfile; \
1884 cp $$file include; \
1885 chmod a+r include/$$realfile; \
c8763215 1886 fi; \
2cfd79fe 1887 done
b5850e21 1888 rm -f include/limits.h
2cfd79fe 1889 cp xlimits.h include/limits.h
1890 chmod a+r include/limits.h
2cfd79fe 1891# Install the README
b5850e21 1892 rm -f include/README
2cfd79fe 1893 cp $(srcdir)/README-fixinc include/README
1894 chmod a+r include/README
690a93ea 1895 touch stmp-int-hdrs
1896
0dbd1c74 1897# Build the complete include directory, including float.h.
690a93ea 1898stmp-headers: stmp-int-hdrs gfloat.h
1899 rm -f include/float.h
0dbd1c74 1900 if [ -s gfloat.h ]; then \
1901 cp gfloat.h include/float.h && \
1902 chmod a+r include/float.h; \
1903 else :; fi
2cfd79fe 1904 touch stmp-headers
1905
1906# Build fixed copies of system files.
62268150 1907stmp-fixinc: $(FIXINCLUDES) gsyslimits.h
2cfd79fe 1908 rm -rf include
1909 mkdir include
92d223d1 1910 if [ x$(FIXINCLUDES) != xMakefile.in ]; \
6848a9c6 1911 then \
1912 for dir in $(SYSTEM_HEADER_DIR) $(OTHER_FIXINCLUDES_DIRS); do \
1913 if [ -d $$dir ]; \
1914 then \
cee3b7e3 1915 $(SHELL) $(srcdir)/$(FIXINCLUDES) include $$dir; \
6848a9c6 1916 else true; fi; \
92d223d1 1917 done; \
6848a9c6 1918 else true; \
1919 fi
b7d4d520 1920 rm -f include/syslimits.h
1921 if [ -f include/limits.h ]; then \
1922 mv include/limits.h include/syslimits.h; \
1923 else \
1924 cp $(srcdir)/gsyslimits.h include/syslimits.h; \
1925 fi
1926 chmod a+r include/syslimits.h
9e74f24f 1927 touch stmp-fixinc
7c4f0e88 1928
a5889b74 1929# Files related to the fixproto script.
1930
047c2b8b 1931deduced.h: $(GCC_PASSES) $(srcdir)/scan-types.sh stmp-int-hdrs
f55e1a13 1932 CC="$(GCC_FOR_TARGET) $(GCC_CFLAGS) $(ALL_CPPFLAGS) -I. -I$(srcdir) -Iinclude -I${SYSTEM_HEADER_DIR}"; \
a5889b74 1933 export CC; \
6518b023 1934 $(SHELL) $(srcdir)/scan-types.sh "$(srcdir)" >tmp-deduced.h
a5889b74 1935 mv tmp-deduced.h deduced.h
1936
ff8281e4 1937gen-protos: gen-protos.o scan.o cppalloc.o $(HOST_LIBDEPS)
62268150 1938 ${HOST_CC} $(HOST_CFLAGS) $(HOST_LDFLAGS) -o $@ \
ff8281e4 1939 gen-protos.o scan.o cppalloc.o $(HOST_LIBS)
a5889b74 1940
c20b28d5 1941gen-protos.o: gen-protos.c scan.h $(build_xm_file)
c68462d9 1942 $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(srcdir)/gen-protos.c
1943
c20b28d5 1944scan.o: scan.c scan.h $(build_xm_file)
c68462d9 1945 $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(srcdir)/scan.c
9541a717 1946
047c2b8b 1947xsys-protos.h: $(GCC_PASSES) $(srcdir)/sys-protos.h deduced.h gen-protos Makefile
c92e16d4 1948 cat deduced.h $(srcdir)/sys-protos.h > tmp-fixtmp.c
1949 mv tmp-fixtmp.c fixtmp.c
2f9d2927 1950 $(GCC_FOR_TARGET) fixtmp.c -w -U__SIZE_TYPE__ -U__PTRDIFF_TYPE__ -U__WCHAR_TYPE__ -E \
6fc3eafd 1951 | sed -e 's/ / /g' -e 's/ *(/ (/g' -e 's/ [ ]*/ /g' -e 's/( )/()/' \
c92e16d4 1952 | ./gen-protos >xsys-protos.hT
1953 mv xsys-protos.hT xsys-protos.h
d7c4552e 1954 rm -rf fixtmp.c
a5889b74 1955
62268150 1956fix-header: fix-header.o scan-decls.o scan.o xsys-protos.h $(HOST_LIBDEPS) \
0dbd1c74 1957 cpplib.o cpphash.o cppalloc.o cppexp.o cpperror.o prefix.o version.o
62268150 1958 $(HOST_CC) $(HOST_CFLAGS) $(HOST_LDFLAGS) -o $@ fix-header.o \
0dbd1c74 1959 scan-decls.o scan.o cpplib.o cpphash.o cppalloc.o prefix.o \
1960 version.o cppexp.o $(HOST_LIBS)
a5889b74 1961
9d6a1aa2 1962fix-header.o: fix-header.c obstack.h scan.h xsys-protos.h $(build_xm_file)
c68462d9 1963 $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(srcdir)/fix-header.c
1964
caf36bd8 1965scan-decls.o: scan-decls.c scan.h cpplib.h $(build_xm_file)
c68462d9 1966 $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(srcdir)/scan-decls.c
a5889b74 1967
047c2b8b 1968# stmp-fixproto depends on this, not on fix-header directly.
1969# The idea is to make sure fix-header gets built,
1970# but not rerun fixproto after each stage
1971# just because fix-header's mtime has changed.
1972fixhdr.ready: fix-header
1973 -if [ -f fixhdr.ready ] ; then \
1974 true; \
1975 else \
1976 touch fixhdr.ready; \
1977 fi
1978
7bf27989 1979# stmp-headers is to make sure fixincludes has already finished.
276709eb 1980# The if statement is so that we don't run fixproto a second time
1981# if it has already been run on the files in `include'.
6a0b7b7c 1982stmp-fixproto: fixhdr.ready fixproto stmp-headers
2deaa28d 1983 @echo "Various warnings and error messages from fixproto are normal"
4fbc622f 1984 -if [ -d include ] ; then true; else mkdir include; fi
b948f736 1985 -if [ -f include/fixed ] ; then true; \
276709eb 1986 else \
6f1f992e 1987 : This line works around a 'make' bug in BSDI 1.1.; \
ff8281e4 1988 FIXPROTO_DEFINES="$(FIXPROTO_DEFINES)"; export FIXPROTO_DEFINES; \
1989 $(SHELL) ${srcdir}/fixproto include include $(SYSTEM_HEADER_DIR); \
276709eb 1990 touch include/fixed; \
1991 fi
a5889b74 1992 touch stmp-fixproto
2e9d8ccf 1993#\f
32e6d418 1994# Remake the info files.
1995
627defc4 1996doc: info
17b258fe 1997info: cpp.info gcc.info lang.info
32e6d418 1998
17b258fe 1999cpp.info: $(srcdir)/cpp.texi
2000 $(MAKEINFO) $(MAKEINFOFLAGS) -I$(srcdir) $(srcdir)/cpp.texi -o cpp.info
32e6d418 2001
17b258fe 2002gcc.info: $(srcdir)/gcc.texi $(srcdir)/extend.texi $(srcdir)/install.texi \
2003 $(srcdir)/invoke.texi $(srcdir)/md.texi $(srcdir)/rtl.texi \
2004 $(srcdir)/tm.texi $(srcdir)/gcov.texi
2005 $(MAKEINFO) $(MAKEINFOFLAGS) -I$(srcdir) $(srcdir)/gcc.texi -o gcc.info
630c76ba 2006
17b258fe 2007dvi: gcc.dvi cpp.dvi lang.dvi
627defc4 2008
64616031 2009# This works with GNU Make's default rule.
17b258fe 2010gcc.dvi: $(srcdir)/gcc.texi $(srcdir)/extend.texi $(srcdir)/install.texi \
2011 $(srcdir)/invoke.texi $(srcdir)/md.texi $(srcdir)/rtl.texi \
2012 $(srcdir)/tm.texi $(srcdir)/gcov.texi
2013 TEXINPUTS=${texidir}:$(srcdir):$$TEXINPUTS tex gcc.texi
2014 texindex gcc.??
2015 TEXINPUTS=${texidir}:$(srcdir):$$TEXINPUTS tex gcc.texi
2016
2017cpp.dvi: $(srcdir)/cpp.texi
2018 TEXINPUTS=${texidir}:$(srcdir):$$TEXINPUTS tex cpp.texi
2019 texindex cpp.??
2020 TEXINPUTS=${texidir}:$(srcdir):$$TEXINPUTS tex cpp.texi
2021
2022
2023INSTALL: $(srcdir)/install1.texi $(srcdir)/install.texi
2024 $(MAKEINFO) -D INSTALLONLY --no-header --no-split \
2025 $(srcdir)/install1.texi -o INSTALL
2e9d8ccf 2026#\f
32e6d418 2027# Deletion of files made during compilation.
2028# There are four levels of this:
a8514488 2029# `mostlyclean', `clean', `distclean' and `maintainer-clean'.
32e6d418 2030# `mostlyclean' is useful while working on a particular type of machine.
c6396a0b 2031# It deletes most, but not all, of the files made by compilation.
32e6d418 2032# It does not delete libgcc.a or its parts, so it won't have to be recompiled.
c6396a0b 2033# `clean' deletes everything made by running `make all'.
79f818d0 2034# `distclean' also deletes the files made by config.
a8514488 2035# `maintainer-clean' also deletes everything that could be regenerated
1f42ecdc 2036# automatically, except for `configure'.
2037# We remove as much from the language subdirectories as we can
73027c94 2038# (less duplicated code).
32e6d418 2039
79f818d0 2040
b54842d8 2041mostlyclean: lang.mostlyclean
32e6d418 2042 -rm -f $(STAGESTUFF)
2043# Delete the temporary source copies for cross compilation.
2044 -rm -f $(HOST_PREFIX_1)rtl.c $(HOST_PREFIX_1)rtlanal.c
2045 -rm -f $(HOST_PREFIX_1)alloca.c $(HOST_PREFIX_1)malloc.c
2046 -rm -f $(HOST_PREFIX_1)obstack.c
2047# Delete the temp files made in the course of building libgcc.a.
c09ccbc2 2048 -rm -f tmplibgcc* tmpcopy xlimits.h libgcc1-test
32e6d418 2049 for name in $(LIB1FUNCS); do rm -f $${name}.c; done
2050# Delete other temporary files.
e5b63666 2051 -rm -f tmp-float.h tmp-gcc.xtar.gz
f678532a 2052 -rm -f tmp-foo1 tmp-foo2 tmp-proto.* tmp-unproto.1 tmp-SYSCALLS.s
8757933b 2053 -rm -f tmp-c-parse.y tmp-gperf.h
c92e16d4 2054 -rm -f tmp-specs t-float.h-cross tmp-xlimits.h
2055 -rm -f tmp-fixtmp.c xsys-protos.hT
32e6d418 2056# Delete the stamp files.
2057 -rm -f stamp-* tmp-*
73027c94 2058 -rm -f */stamp-* */tmp-*
c6396a0b 2059# Delete debugging dump files.
32e6d418 2060 -rm -f *.greg *.lreg *.combine *.flow *.cse *.jump *.rtl *.tree *.loop
0dbd1c74 2061 -rm -f *.dbr *.jump2 *.sched *.cse2 *.sched2 *.stack *.addressof *.regmove
73027c94 2062 -rm -f */*.greg */*.lreg */*.combine */*.flow */*.cse */*.jump */*.rtl
2063 -rm -f */*.tree */*.loop */*.dbr */*.jump2 */*.sched */*.cse2
b4c5e619 2064 -rm -f */*.sched2 */*.stack */*.regmove
c6396a0b 2065# Delete some files made during installation.
d82b9c93 2066 -rm -f specs gfloat.h float.h-* enquire SYSCALLS.c.X SYSCALLS.c
e98401fc 2067 -rm -f collect collect2 mips-tfile mips-tdump alloca.s
a5889b74 2068# Delete files generated for fixproto
15dece2a 2069 -rm -rf fix-header xsys-protos.h deduced.h tmp-deduced.h \
c9c7b9d8 2070 gen-protos fixproto.list fixtmp.* fixhdr.ready
c6396a0b 2071# Delete unwanted output files from TeX.
2072 -rm -f *.toc *.log *.vr *.fn *.cp *.tp *.ky *.pg
73027c94 2073 -rm -f */*.toc */*.log */*.vr */*.fn */*.cp */*.tp */*.ky */*.pg
79f818d0 2074# Delete sorted indices we don't actually use.
2075 -rm -f gcc.vrs gcc.kys gcc.tps gcc.pgs gcc.fns
c6396a0b 2076# Delete core dumps.
73027c94 2077 -rm -f core */core
2b55270a 2078 -rm -f *.bp */*.bp
32e6d418 2079
79f818d0 2080# Delete all files made by compilation
2081# that don't exist in the distribution.
b54842d8 2082clean: mostlyclean lang.clean
8bd8ea06 2083# It may not be quite desirable to delete unprotoize.c here,
2084# but the spec for `make clean' requires it.
2085# Using unprotoize.c is not quite right in the first place,
2086# but what better way is there?
745e3a0d 2087 -rm -f libgcc.a libgcc1.a libgcc1-asm.a libgcc2.a libgcc2.ready
17108b2b 2088 -rm -f libgcc1.null
131b361e 2089 -rm -f *.dvi
73027c94 2090 -rm -f */*.dvi
89e36a04 2091 -if [ -f md.pre-cpp ]; then \
2092 rm -f md ; \
2093 fi
2cfd79fe 2094# Delete the include directory.
8757933b 2095 -rm -rf stmp-* include
73027c94 2096 -rm -f */stmp-*
d73a48cc 2097# Delete files used by the "multilib" facility (including libgcc subdirs).
f1ad3130 2098 -rm -f multilib.h tmpmultilib*
d73a48cc 2099 -if [ "x$(MULTILIB_DIRNAMES)" != x ] ; then \
2100 rm -rf $(MULTILIB_DIRNAMES); \
2101 else if [ "x$(MULTILIB_OPTIONS)" != x ] ; then \
2102 rm -rf `echo $(MULTILIB_OPTIONS) | sed -e 's/\// /g'`; \
2103 fi ; fi
119f80e4 2104 -rm -fr stage1 stage2 stage3 stage4
32e6d418 2105
79f818d0 2106# Delete all files that users would normally create
2107# while building and installing GCC.
b54842d8 2108distclean: clean lang.distclean
0dbd1c74 2109 -rm -f tm.h config.h auto-config.h tconfig.h hconfig.h md cstamp-h
1f42ecdc 2110 -rm -f config.status config.run config.cache config.bak
160b6fa9 2111 -rm -f Make-lang Make-hooks Make-host Make-target
636fef92 2112 -rm -f Makefile specs.h options.h *.oaux
58febf9e 2113 -rm -f gthr-default.h
c4ed51d6 2114 -rm -f */stage1 */stage2 */stage3 */stage4 */include
08d7a103 2115 -rm -f c-parse.output
b541ad9d 2116 -rm -f *.asm
ae115421 2117 -rm -f float.h
45e01ea1 2118 -rm -f site.exp site.bak testsuite/site.exp testsuite/site.bak
2119 -rm -f testsuite/{gcc,g++}.{log,sum}
c6396a0b 2120
2121# Delete anything likely to be found in the source directory
2122# that shouldn't be in the distribution.
73027c94 2123extraclean: distclean lang.extraclean
bbbdbddd 2124 -rm -rf =* ./"#"* *~* config/=* config/"#"* config/*~*
131b361e 2125 -rm -f patch* *.orig *.rej config/patch* config/*.orig config/*.rej
08d7a103 2126 -rm -f config/*/=* config/*/"#"* config/*/*~*
2127 -rm -f config/*/*.orig config/*/*.rej
300d5cb3 2128 -rm -f *.dvi *.ps *.oaux *.d *.[zZ] *.gz
13da1009 2129 -rm -f *.tar *.xtar *diff *.diff.* *.tar.* *.xtar.* *diffs
08d7a103 2130 -rm -f *lose config/*lose config/*/*lose
3a0781a0 2131 -rm -f *.s *.s[0-9] *.i install1.texi config/ChangeLog
73027c94 2132 -rm -f */=* */"#"* */*~*
2133 -rm -f */patch* */*.orig */*.rej
2134 -rm -f */*.dvi */*.oaux */*.d */*.[zZ] */*.gz
2135 -rm -f */*.tar */*.xtar */*diff */*.diff.* */*.tar.* */*.xtar.* */*diffs
2136 -rm -f */*lose */*.s */*.s[0-9] */*.i
32e6d418 2137
1f42ecdc 2138# Get rid of every file that's generated from some other file, except for `configure'.
32e6d418 2139# Most of these files ARE PRESENT in the GCC distribution.
1f42ecdc 2140maintainer-clean:
2141 @echo 'This command is intended for maintainers to use; it'
2142 @echo 'deletes files that may need special tools to rebuild.'
b54842d8 2143 $(MAKE) distclean lang.maintainer-clean
8757933b 2144 -rm -f c-parse.y c-gperf.h
32e6d418 2145 -rm -f c-parse.c c-parse.h c-parse.output
2146 -rm -f cexp.c cexp.output TAGS
c6396a0b 2147 -rm -f cpp.info* cpp.??s cpp.*aux
2148 -rm -f gcc.info* gcc.??s gcc.*aux
2e9d8ccf 2149#\f
32e6d418 2150# Entry points `install' and `uninstall'.
c6396a0b 2151# Also use `install-collect2' to install collect2 when the config files don't.
32e6d418 2152
3f69fed5 2153# The semicolon is to prevent the install.sh -> install default rule
876dc5b0 2154# from doing anything. Having it run true helps avoid problems and
2155# noise from versions of make which don't like to have null commands.
c2a18965 2156install: $(INSTALL_TARGET) ; @true
32e6d418 2157
2cfd79fe 2158# Copy the compiler files into directories where they will be run.
62268150 2159# Install the driver last so that the window when things are
2160# broken is small.
2289acd7 2161install-normal: install-common $(INSTALL_HEADERS) $(INSTALL_LIBGCC) \
8757933b 2162 install-man install-info lang.install-normal install-driver
32e6d418 2163
e77fd588 2164# Do nothing while making gcc with a cross-compiler. The person who
2165# makes gcc for the target machine has to know how to put a complete
2166# gcc together by hand.
2167install-build: force
2168 @echo You have to install gcc on your target machine by hand.
2169
32e6d418 2170# Run this on the target machine
2171# to finish installation of cross compiler.
2172install-cross-rest: install-float-h-cross
2173
2174# Install float.h for cross compiler.
2175# Run this on the target machine!
0d5bce1b 2176install-float-h-cross: installdirs
9f10de4b 2177# if [ -f enquire ] ; then true; else false; fi
2178# Note: don't use -. We should fail right away if enquire was not made.
2179 ./enquire -f > $(tmpdir)/float.h
32e6d418 2180 -rm -f $(libsubdir)/include/float.h
f32abccb 2181 $(INSTALL_DATA) $(tmpdir)/float.h $(libsubdir)/include/float.h
2182 -rm -f $(tmpdir)/float.h
32e6d418 2183 chmod a-x $(libsubdir)/include/float.h
2184
0d5bce1b 2185# Create the installation directories.
2186installdirs:
2187 -if [ -d $(prefix) ] ; then true ; else mkdir $(prefix) ; chmod a+rx $(prefix) ; fi
2188 -if [ -d $(exec_prefix) ] ; then true ; else mkdir $(exec_prefix) ; chmod a+rx $(exec_prefix) ; fi
47db7968 2189 -if [ -d $(libdir) ] ; then true ; else mkdir $(libdir) ; chmod a+rx $(libdir) ; fi
2190 -if [ -d $(libdir)/gcc-lib ] ; then true ; else mkdir $(libdir)/gcc-lib ; chmod a+rx $(libdir)/gcc-lib ; fi
444c3fb0 2191# This dir isn't currently searched by cpp.
47db7968 2192# -if [ -d $(libdir)/gcc-lib/include ] ; then true ; else mkdir $(libdir)/gcc-lib/include ; chmod a+rx $(libdir)/gcc-lib/include ; fi
67cb4bc1 2193 -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
2194 -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
2195 -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 2196 -if [ -d $(bindir) ] ; then true ; else mkdir $(bindir) ; chmod a+rx $(bindir) ; fi
2197 -if [ -d $(includedir) ] ; then true ; else mkdir $(includedir) ; chmod a+rx $(includedir) ; fi
2198 -if [ -d $(tooldir) ] ; then true ; else mkdir $(tooldir) ; chmod a+rx $(tooldir) ; fi
2199 -if [ -d $(assertdir) ] ; then true ; else mkdir $(assertdir) ; chmod a+rx $(assertdir) ; fi
2200 -if [ -d $(infodir) ] ; then true ; else mkdir $(infodir) ; chmod a+rx $(infodir) ; fi
32e6d418 2201# We don't use mkdir -p to create the parents of mandir,
2202# because some systems don't support it.
2203# Instead, we use this technique to create the immediate parent of mandir.
2388f67d 2204 -parent=`echo $(mandir)|sed -e 's@/[^/]*$$@@'`; \
47db7968 2205 if [ -d $$parent ] ; then true ; else mkdir $$parent ; chmod a+rx $$parent ; fi
2206 -if [ -d $(mandir) ] ; then true ; else mkdir $(mandir) ; chmod a+rx $(mandir) ; fi
32e6d418 2207
2208# Install the compiler executables built during cross compilation.
0d5bce1b 2209install-common: native installdirs $(EXTRA_PARTS) lang.install-common
32e6d418 2210 for file in $(COMPILERS); do \
2211 if [ -f $$file ] ; then \
2212 rm -f $(libsubdir)/$$file; \
2213 $(INSTALL_PROGRAM) $$file $(libsubdir)/$$file; \
2214 else true; \
2215 fi; \
2216 done
1a1e7b42 2217 for file in $(EXTRA_PASSES) $(EXTRA_PROGRAMS) $(USE_COLLECT2) ..; do \
32e6d418 2218 if [ x"$$file" != x.. ]; then \
2219 rm -f $(libsubdir)/$$file; \
2220 $(INSTALL_PROGRAM) $$file $(libsubdir)/$$file; \
2221 else true; fi; \
2222 done
1a1e7b42 2223 for file in $(EXTRA_PARTS) ..; do \
2224 if [ x"$$file" != x.. ]; then \
2225 rm -f $(libsubdir)/$$file; \
2226 $(INSTALL_DATA) $$file $(libsubdir)/$$file; \
0dbd1c74 2227 chmod a-x $(libsubdir)/$$file; \
1a1e7b42 2228 else true; fi; \
2229 done
8a4b1e01 2230# Don't mess with specs if it doesn't exist yet.
94c53b91 2231 -if [ -f specs ] ; then \
2232 rm -f $(libsubdir)/specs; \
8a4b1e01 2233 $(INSTALL_DATA) specs $(libsubdir)/specs; \
0dbd1c74 2234 chmod a-x $(libsubdir)/specs; \
8a4b1e01 2235 fi
62268150 2236# Install protoize if it was compiled.
2237 -if [ -f protoize$(exeext) ]; \
2238 then \
2239 rm -f $(bindir)/protoize$(exeext); \
2240 $(INSTALL_PROGRAM) protoize$(exeext) $(bindir)/protoize$(exeext); \
2241 rm -f $(bindir)/unprotoize$(exeext); \
2242 $(INSTALL_PROGRAM) unprotoize$(exeext) $(bindir)/unprotoize$(exeext); \
2243 rm -f $(libsubdir)/SYSCALLS.c.X; \
2244 $(INSTALL_DATA) SYSCALLS.c.X $(libsubdir)/SYSCALLS.c.X; \
2245 chmod a-x $(libsubdir)/SYSCALLS.c.X; \
2246 fi
2247 -rm -f $(libsubdir)/cpp$(exeext)
2248 $(INSTALL_PROGRAM) cpp$(exeext) $(libsubdir)/cpp$(exeext)
e2a2be99 2249# Install gcov if it was compiled.
2b55270a 2250 -if [ -f gcov$(exeext) ]; \
2251 then \
2252 rm -f $(bindir)/gcov$(exeext); \
2253 $(INSTALL_PROGRAM) gcov$(exeext) $(bindir)/gcov$(exeext); \
2254 chmod a+x $(bindir)/gcov$(exeext); \
2255 fi
62268150 2256
67cb4bc1 2257# Install the driver program as $(target_alias)-gcc
32e6d418 2258# and also as either gcc (if native) or $(tooldir)/bin/gcc.
62268150 2259install-driver: xgcc
f403cbcb 2260 -if [ -f gcc-cross$(exeext) ] ; then \
2261 rm -f $(bindir)/$(GCC_CROSS_NAME)$(exeext); \
12d8e722 2262 $(INSTALL_PROGRAM) gcc-cross$(exeext) $(bindir)/$(GCC_CROSS_NAME)$(exeext); \
32e6d418 2263 if [ -d $(tooldir)/bin/. ] ; then \
f403cbcb 2264 rm -f $(tooldir)/bin/gcc$(exeext); \
2265 $(INSTALL_PROGRAM) gcc-cross$(exeext) $(tooldir)/bin/gcc$(exeext); \
32e6d418 2266 else true; fi; \
2267 else \
f403cbcb 2268 rm -f $(bindir)/$(GCC_INSTALL_NAME)$(exeext); \
2269 $(INSTALL_PROGRAM) xgcc$(exeext) $(bindir)/$(GCC_INSTALL_NAME)$(exeext); \
67cb4bc1 2270 rm -f $(bindir)/$(target_alias)-gcc-1$(exeext); \
ea4a6c81 2271 $(LN) $(bindir)/$(GCC_INSTALL_NAME)$(exeext) $(bindir)/$(target_alias)-gcc-1$(exeext); \
67cb4bc1 2272 mv $(bindir)/$(target_alias)-gcc-1$(exeext) $(bindir)/$(target_alias)-gcc$(exeext); \
32e6d418 2273 fi
32e6d418 2274
a2aa0fc1 2275# Install the info files.
dff6b323 2276# $(INSTALL_DATA) might be a relative pathname, so we can't cd into srcdir
2277# to do the install. The sed rule was copied from stmp-int-hdrs.
0d5bce1b 2278install-info: doc installdirs lang.install-info
a2aa0fc1 2279 -rm -f $(infodir)/cpp.info* $(infodir)/gcc.info*
17b258fe 2280 for f in cpp.info* gcc.info*; do \
dff6b323 2281 realfile=`echo $$f | sed -e 's|.*/\([^/]*\)$$|\1|'`; \
2282 $(INSTALL_DATA) $$f $(infodir)/$$realfile; \
2283 done
a2aa0fc1 2284 -chmod a-x $(infodir)/cpp.info* $(infodir)/gcc.info*
2285
32e6d418 2286# Install the man pages.
0d5bce1b 2287install-man: installdirs $(srcdir)/gcc.1 $(srcdir)/cccp.1 lang.install-man
0dbd1c74 2288 -if [ -f gcc-cross$(exeext) ] ; then \
b541ad9d 2289 rm -f $(mandir)/$(GCC_CROSS_NAME)$(manext); \
2290 $(INSTALL_DATA) $(srcdir)/gcc.1 $(mandir)/$(GCC_CROSS_NAME)$(manext); \
2291 chmod a-x $(mandir)/$(GCC_CROSS_NAME)$(manext); \
2292 else \
2293 rm -f $(mandir)/$(GCC_INSTALL_NAME)$(manext); \
2294 $(INSTALL_DATA) $(srcdir)/gcc.1 $(mandir)/$(GCC_INSTALL_NAME)$(manext); \
2295 chmod a-x $(mandir)/$(GCC_INSTALL_NAME)$(manext); \
2296 fi
c6396a0b 2297 -rm -f $(mandir)/cccp$(manext)
ab866dde 2298 -$(INSTALL_DATA) $(srcdir)/cccp.1 $(mandir)/cccp$(manext)
2299 -chmod a-x $(mandir)/cccp$(manext)
32e6d418 2300
2301# Install the library.
0d5bce1b 2302install-libgcc: libgcc.a installdirs
32e6d418 2303 -if [ -f libgcc.a ] ; then \
2304 rm -f $(libsubdir)/libgcc.a; \
2305 $(INSTALL_DATA) libgcc.a $(libsubdir)/libgcc.a; \
2306 if $(RANLIB_TEST) ; then \
2307 (cd $(libsubdir); $(RANLIB) libgcc.a); else true; fi; \
2308 chmod a-x $(libsubdir)/libgcc.a; \
2309 else true; fi
2310
f1ad3130 2311# Install multiple versions of libgcc.a.
0d5bce1b 2312install-multilib: stmp-multilib installdirs
f1ad3130 2313 for i in `$(GCC_FOR_TARGET) --print-multi-lib`; do \
2314 dir=`echo $$i | sed -e 's/;.*$$//'`; \
2315 if [ -d $(libsubdir)/$${dir} ]; then true; else mkdir $(libsubdir)/$${dir}; fi; \
cdc96909 2316 for f in libgcc.a $(EXTRA_MULTILIB_PARTS); do \
2317 rm -f $(libsubdir)/$${dir}/$${f}; \
2318 $(INSTALL_DATA) $${dir}/$${f} $(libsubdir)/$${dir}/$${f}; \
2319 done; \
f1ad3130 2320 if $(RANLIB_TEST); then \
2321 (cd $(libsubdir)/$${dir}; $(RANLIB) libgcc.a); else true; fi; \
2322 chmod a-x $(libsubdir)/$${dir}/libgcc.a; \
2323 done
2324
2cfd79fe 2325# Install all the header files built in the include subdirectory.
c8763215 2326install-headers: install-include-dir $(INSTALL_HEADERS_DIR) $(INSTALL_ASSERT_H)
2cfd79fe 2327# Fix symlinks to absolute paths in the installed include directory to
2328# point to the installed directory, not the build directory.
ea4a6c81 2329# Don't need to use LN_S here since we really do need ln -s and no substitutes.
2cfd79fe 2330 -files=`cd $(libsubdir)/include; find . -type l -print 2>/dev/null`; \
2331 if [ $$? -eq 0 ]; then \
2332 dir=`cd include; pwd`; \
2333 for i in $$files; do \
2334 dest=`ls -ld $(libsubdir)/include/$$i | sed -n 's/.*-> //p'`; \
2335 if expr "$$dest" : "$$dir.*" > /dev/null; then \
2336 rm -f $(libsubdir)/include/$$i; \
5822e312 2337 ln -s `echo $$i | sed "s|/[^/]*|/..|g" | sed 's|/..$$||'``echo "$$dest" | sed "s|$$dir||"` $(libsubdir)/include/$$i; \
2cfd79fe 2338 fi; \
2339 done; \
2340 fi
32e6d418 2341
2cfd79fe 2342# Create or recreate the gcc private include file directory.
0d5bce1b 2343install-include-dir: installdirs
2cfd79fe 2344 -rm -rf $(libsubdir)/include
2345 mkdir $(libsubdir)/include
2346 -chmod a+rx $(libsubdir)/include
2347
2348# Install the include directory using tar.
a5889b74 2349install-headers-tar: stmp-headers $(STMP_FIXPROTO) install-include-dir
651b0150 2350 (cd include; \
b948f736 2351 tar -cf - .; exit 0) | (cd $(libsubdir)/include; tar $(TAROUTOPTS) - )
16db1e2d 2352# /bin/sh on some systems returns the status of the first tar,
2353# and that can lose with GNU tar which always writes a full block.
2354# So use `exit 0' to ignore its exit status.
2cfd79fe 2355
2356# Install the include directory using cpio.
a5889b74 2357install-headers-cpio: stmp-headers $(STMP_FIXPROTO) install-include-dir
813fb313 2358 (cd include; find . -print) | (cd include; cpio -pdum $(libsubdir)/include)
32e6d418 2359
35df828f 2360# Put assert.h where it won't override GNU libc's assert.h.
2361# It goes in a dir that is searched after GNU libc's headers;
2362# thus, the following conditionals are no longer needed.
2363# But it's not worth deleting them now.
2364## Don't replace the assert.h already there if it is not from GCC.
2365## This code would be simpler if it tested for -f ... && ! grep ...
2366## but supposedly the ! operator is missing in sh on some systems.
0d5bce1b 2367install-assert-h: assert.h installdirs
eb5a0caa 2368 if [ -f $(assertdir)/assert.h ]; \
2369 then \
95856242 2370 if grep "__eprintf" $(assertdir)/assert.h >/dev/null; \
a953974c 2371 then \
eb5a0caa 2372 rm -f $(assertdir)/assert.h; \
2373 $(INSTALL_DATA) $(srcdir)/assert.h $(assertdir)/assert.h; \
04873c54 2374 chmod a-x $(assertdir)/assert.h; \
eb5a0caa 2375 else true; \
2376 fi; \
2ba284c3 2377 else \
db9a0b19 2378 rm -f $(assertdir)/assert.h; \
2379 $(INSTALL_DATA) $(srcdir)/assert.h $(assertdir)/assert.h; \
04873c54 2380 chmod a-x $(assertdir)/assert.h; \
2ba284c3 2381 fi
32e6d418 2382
c6396a0b 2383# Use this target to install the program `collect2' under the name `ld'.
0d5bce1b 2384install-collect2: collect2 installdirs
f403cbcb 2385 $(INSTALL_PROGRAM) collect2$(exeext) $(libsubdir)/ld$(exeext)
c6396a0b 2386# Install the driver program as $(libsubdir)/gcc for collect2.
f403cbcb 2387 $(INSTALL_PROGRAM) xgcc$(exeext) $(libsubdir)/gcc$(exeext)
c6396a0b 2388
32e6d418 2389# Cancel installation by deleting the installed files.
73027c94 2390uninstall: lang.uninstall
32e6d418 2391 -rm -rf $(libsubdir)
f403cbcb 2392 -rm -rf $(bindir)/$(GCC_INSTALL_NAME)$(exeext)
2393 -rm -rf $(bindir)/$(GCC_CROSS_NAME)$(exeext)
2394 -rm -rf $(bindir)/protoize$(exeext)
2395 -rm -rf $(bindir)/unprotoize$(exeext)
b541ad9d 2396 -rm -rf $(mandir)/$(GCC_INSTALL_NAME)$(manext)
2397 -rm -rf $(mandir)/$(GCC_CROSS_NAME)$(manext)
c6396a0b 2398 -rm -rf $(mandir)/cccp$(manext)
32e6d418 2399 -rm -rf $(mandir)/protoize$(manext)
2400 -rm -rf $(mandir)/unprotoize$(manext)
2e9d8ccf 2401#\f
6c08487b 2402# These targets are for the dejagnu testsuites. The file site.exp
2403# contains global variables that all the testsuites will use.
2404
2405# Set to $(target_alias)/ for cross.
2406target_subdir = @target_subdir@
2407
2408site.exp: ./config.status Makefile
2409 @echo "Making a new config file..."
2410 -@rm -f ./tmp?
2411 @touch site.exp
2412 -@mv site.exp site.bak
2413 @echo "## these variables are automatically generated by make ##" > ./tmp0
2414 @echo "# Do not edit here. If you wish to override these values" >> ./tmp0
2415 @echo "# add them to the last section" >> ./tmp0
2416 @echo "set rootme \"`pwd`\"" >> ./tmp0
2417 @echo "set srcdir \"`cd ${srcdir}; pwd`\"" >> ./tmp0
2418 @echo "set host_triplet $(host_canonical)" >> ./tmp0
2419 @echo "set build_triplet $(build_canonical)" >> ./tmp0
2420 @echo "set target_triplet $(target)" >> ./tmp0
2421 @echo "set target_alias $(target_alias)" >> ./tmp0
2422# CFLAGS is set even though it's empty to show we reserve the right to set it.
2423 @echo "set CFLAGS \"\"" >> ./tmp0
2424 @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
2425# If newlib has been configured, we need to pass -B to gcc so it can find
2426# newlib's crt0.o if it exists. This will cause a "path prefix not used"
2427# message if it doesn't, but the testsuite is supposed to ignore the message -
2428# it's too difficult to tell when to and when not to pass -B (not all targets
2429# have crt0's). We could only add the -B if ../newlib/crt0.o exists, but that
2430# seems like too selective a test.
2431# ??? Another way to solve this might be to rely on linker scripts. Then
2432# theoretically the -B won't be needed.
2433# We also need to pass -L ../ld so that the linker can find ldscripts.
2434 @if [ -d $(objdir)/../$(target_subdir)newlib ] ; then \
2435 echo "set newlib_cflags \"-I$(objdir)/../$(target_subdir)newlib/targ-include -I\$$srcdir/../newlib/libc/include\"" >> ./tmp0; \
2436 echo "set newlib_ldflags \"-B$(objdir)/../$(target_subdir)newlib/\"" >> ./tmp0; \
2437 echo "append CFLAGS \" \$$newlib_cflags\"" >> ./tmp0; \
2438 echo "append CXXFLAGS \" \$$newlib_cflags\"" >> ./tmp0; \
2439 echo "append LDFLAGS \" \$$newlib_ldflags\"" >> ./tmp0; \
2440 else true; \
2441 fi
2442 @if [ -d $(objdir)/../ld ] ; then \
2443 echo "append LDFLAGS \" -L$(objdir)/../ld\"" >> ./tmp0; \
2444 else true; \
2445 fi
2446 @if [ $(build_canonical) != $(host_canonical) ] ; then \
2447 echo "set tmpdir /tmp" >> ./tmp0 ; \
2448 else echo "set tmpdir $(objdir)/testsuite" >> ./tmp0 ; \
2449 fi
2450 @echo "set srcdir \"\$${srcdir}/testsuite\"" >> ./tmp0
2451 @echo "## All variables above are generated by configure. Do Not Edit ##" >> ./tmp0
2452 @cat ./tmp0 > site.exp
2453 @cat site.bak | sed \
2454 -e '1,/^## All variables above are.*##/ d' >> site.exp
2455 -@rm -f ./tmp?
2456
4230ead8 2457CHECK_TARGETS = check-gcc check-g++ check-g77
6c08487b 2458
2459check: $(CHECK_TARGETS)
2460
20ab2c9c 2461testsuite/site.exp: site.exp
6c08487b 2462 if [ -d testsuite ]; then \
2463 true; \
2464 else \
2465 mkdir testsuite; \
2466 fi
2467 rm -rf testsuite/site.exp
2468 cp site.exp testsuite/site.exp
20ab2c9c 2469
2470check-g++: testsuite/site.exp
2471 -rootme=`pwd`; export rootme; \
6c08487b 2472 srcdir=`cd ${srcdir}; pwd` ; export srcdir ; \
2473 cd testsuite; \
2474 EXPECT=${EXPECT} ; export EXPECT ; \
2475 if [ -f $${rootme}/../expect/expect ] ; then \
2476 TCL_LIBRARY=$${srcdir}/../tcl/library ; \
2477 export TCL_LIBRARY ; fi ; \
2478 $(RUNTEST) --tool g++ $(RUNTESTFLAGS)
2479
20ab2c9c 2480check-gcc: testsuite/site.exp
2481 -rootme=`pwd`; export rootme; \
6c08487b 2482 srcdir=`cd ${srcdir}; pwd` ; export srcdir ; \
2483 cd testsuite; \
2484 EXPECT=${EXPECT} ; export EXPECT ; \
2485 if [ -f $${rootme}/../expect/expect ] ; then \
2486 TCL_LIBRARY=$${srcdir}/../tcl/library ; \
2487 export TCL_LIBRARY ; fi ; \
2488 $(RUNTEST) --tool gcc $(RUNTESTFLAGS)
2489
4230ead8 2490check-g77: testsuite/site.exp
2491 -rootme=`pwd`; export rootme; \
2492 srcdir=`cd ${srcdir}; pwd` ; export srcdir ; \
2493 cd testsuite; \
2494 EXPECT=${EXPECT} ; export EXPECT ; \
2495 if [ -f $${rootme}/../expect/expect ] ; then \
2496 TCL_LIBRARY=$${srcdir}/../tcl/library ; \
2497 export TCL_LIBRARY ; fi ; \
2498 $(RUNTEST) --tool g77 $(RUNTESTFLAGS)
2499
32e6d418 2500# These exist for maintenance purposes.
2501
2502# Update the tags table.
2503TAGS: force
2504 cd $(srcdir); \
2505 mkdir temp; \
0dbd1c74 2506 mv -f c-parse.[ch] cexp.c =*.[chy] temp; \
32e6d418 2507 etags *.y *.h *.c; \
2508 mv temp/* .; \
2509 rmdir temp
2510
2511# Create the distribution tar file.
e5b63666 2512#dist: gcc-$(version).tar.gz
2513dist: gcc.xtar.gz
32e6d418 2514
e5b63666 2515gcc.xtar.gz: gcc.xtar
b89eb617 2516 gzip --best < gcc.xtar > tmp-gcc.xtar.gz
e5b63666 2517 mv tmp-gcc.xtar.gz gcc.xtar.gz
32e6d418 2518
e5b63666 2519#gcc-$(version).tar.gz: gcc-$(version).tar
2520# gzip < gcc-$(version).tar > gcc-$(version).tar.gz
32e6d418 2521
2522#gcc-$(version).tar:
6c76e6ec 2523gcc.xtar: distdir
2524# Make the distribution.
b948f736 2525 tar -chf gcc.xtar gcc-$(version)
6c76e6ec 2526
73027c94 2527# This target exists to do the initial work before the language specific
2528# stuff gets done.
0f557c81 2529distdir-start: doc $(srcdir)/INSTALL $(srcdir)/c-parse.y $(srcdir)/c-gperf.h \
ad87de1e 2530 $(srcdir)/c-parse.c $(srcdir)/cexp.c $(srcdir)/config.in
2deaa28d 2531 @if grep -s "for version ${mainversion}" gcc.texi > /dev/null; \
630c76ba 2532 then true; \
0dce1b01 2533 else echo "You must update the version number in \`gcc.texi'"; sleep 10;\
630c76ba 2534 fi
131b361e 2535# Update the version number in README
2536 awk '$$1 " " $$2 " " $$3 == "This directory contains" \
2537 { $$6 = version; print $$0 } \
2538 $$1 " " $$2 " " $$3 != "This directory contains"' \
2539 version=$(version) README > tmp.README
2540 mv tmp.README README
c6396a0b 2541 -rm -rf gcc-$(version) tmp
32e6d418 2542# Put all the files in a temporary subdirectory
2543# which has the name that we want to have in the tar file.
c6396a0b 2544 mkdir tmp
2545 mkdir tmp/config
3bc8e4d6 2546 mkdir tmp/ginclude
c6396a0b 2547 for file in *[0-9a-zA-Z+]; do \
ea4a6c81 2548 $(LN) $$file tmp; \
c6396a0b 2549 done
2550 cd config; \
2551 for file in *[0-9a-zA-Z+]; do \
57e88ef9 2552 if test -d $$file && test "$$file" != RCS; then \
8a32ef6f 2553 mkdir ../tmp/config/$$file; \
2554 cd $$file; \
2555 for subfile in *[0-9a-zA-Z+]; do \
ea4a6c81 2556 $(LN) $$subfile ../../tmp/config/$$file; \
8a32ef6f 2557 done; \
2558 cd ..; \
2559 else \
ea4a6c81 2560 $(LN) $$file ../tmp/config; \
8a32ef6f 2561 fi; \
32e6d418 2562 done
3bc8e4d6 2563 cd ginclude; \
2564 for file in *[0-9a-zA-Z+]; do \
ea4a6c81 2565 $(LN) $$file ../tmp/ginclude; \
3bc8e4d6 2566 done
4f1fd857 2567 cd objc; \
2568 for file in *[0-9a-zA-Z+]; do \
ea4a6c81 2569 $(LN) $$file ../tmp/objc; \
4f1fd857 2570 done
ea4a6c81 2571 $(LN) .gdbinit tmp
73027c94 2572
2573# Finish making `distdir', after the languages have done their thing.
2574distdir-finish:
c6396a0b 2575 mv tmp gcc-$(version)
3bc8e4d6 2576# Get rid of everything we don't want in the distribution. We'd want
2577# this to use Makefile.in, but it doesn't have the `lang.foo' targets
2578# expanded.
2579 cd gcc-$(version); make extraclean
32e6d418 2580
73027c94 2581distdir: distdir-start lang.distdir distdir-finish
2582
2deaa28d 2583# make diff oldversion=M.N
2584# creates a diff file between an older distribution and this one.
2585# The -P option assumes this is GNU diff.
2586diff:
6a4a0b58 2587 diff -rc2P -x c-parse.y -x c-parse.c -x c-parse.h -x c-gperf.h \
fa5144f7 2588 -x cexp.c -x objc-parse.y -x objc-parse.c \
2589 -x TAGS \
73027c94 2590 -x "gcc.??" -x "gcc.??s" -x gcc.aux -x "gcc.info*" \
2591 -x "cpp.??" -x "cpp.??s" -x cpp.aux -x "cpp.info*" \
2592 $(LANG_DIFF_EXCLUDES) \
2deaa28d 2593 gcc-$(oldversion) gcc-$(version) > diffs
2594
58622ee7 2595bootstrap bootstrap-lean: force
41f63c60 2596# Only build the C compiler for stage1, because that is the only one that
2597# we can guarantee will build with the native compiler, and also it is the
2598# only thing useful for building stage2.
e754efc9 2599 $(MAKE) CC="$(CC)" libdir=$(libdir) LANGUAGES="$(BOOT_LANGUAGES)"
32e6d418 2600 $(MAKE) stage1
c6396a0b 2601# This used to define ALLOCA as empty, but that would lead to bad results
2602# for a subsequent `make install' since that would not have ALLOCA empty.
2603# To prevent `make install' from compiling alloca.o and then relinking cc1
2604# because alloca.o is newer, we permit these recursive makes to compile
2605# alloca.o. Then cc1 is newer, so it won't have to be relinked.
a727632e 2606 $(MAKE) CC="stage1/xgcc -Bstage1/" CFLAGS="$(WARN_CFLAGS) $(BOOT_CFLAGS)" LDFLAGS="$(BOOT_LDFLAGS)" libdir=$(libdir) STAGE_PREFIX=stage1/ LANGUAGES="$(LANGUAGES)"
32e6d418 2607 $(MAKE) stage2
58622ee7 2608 -if test $@ = bootstrap-lean; then rm -rf stage1; else true; fi
a727632e 2609 $(MAKE) CC="stage2/xgcc -Bstage2/" CFLAGS="$(WARN_CFLAGS) $(BOOT_CFLAGS)" LDFLAGS="$(BOOT_LDFLAGS)" libdir=$(libdir) STAGE_PREFIX=stage2/ LANGUAGES="$(LANGUAGES)"
732395de 2610
32e6d418 2611bootstrap2: force
a727632e 2612 $(MAKE) CC="stage1/xgcc -Bstage1/" CFLAGS="$(WARN_CFLAGS) $(BOOT_CFLAGS)" LDFLAGS="$(BOOT_LDFLAGS)" libdir=$(libdir) STAGE_PREFIX=stage1/ LANGUAGES="$(LANGUAGES)"
32e6d418 2613 $(MAKE) stage2
a727632e 2614 $(MAKE) CC="stage2/xgcc -Bstage2/" CFLAGS="$(WARN_CFLAGS) $(BOOT_CFLAGS)" LDFLAGS="$(BOOT_LDFLAGS)" libdir=$(libdir) STAGE_PREFIX=stage2/ LANGUAGES="$(LANGUAGES)"
32e6d418 2615
2616bootstrap3: force
a727632e 2617 $(MAKE) CC="stage2/xgcc -Bstage2/" CFLAGS="$(WARN_CFLAGS) $(BOOT_CFLAGS)" LDFLAGS="$(BOOT_LDFLAGS)" libdir=$(libdir) STAGE_PREFIX=stage2/ LANGUAGES="$(LANGUAGES)"
32e6d418 2618
58622ee7 2619bootstrap4: force
a727632e 2620 $(MAKE) CC="stage3/xgcc -Bstage3/" CFLAGS="$(WARN_CFLAGS) $(BOOT_CFLAGS)" LDFLAGS="$(BOOT_LDFLAGS)" libdir=$(libdir) STAGE_PREFIX=stage3/ LANGUAGES="$(LANGUAGES)"
58622ee7 2621
48c6936b 2622# Compare the object files in the current directory with those in the
2623# stage2 directory.
2624
639b13ee 2625# ./ avoids bug in some versions of tail.
d7fba489 2626compare compare3 compare4 compare-lean compare3-lean compare4-lean: force
20becaef 2627 -rm -f .bad_compare
d7fba489 2628 case "$@" in compare | compare-lean ) stage=2 ;; * ) stage=`echo $@ | sed -e 's,^compare\([0-9][0-9]*\).*,\1,'` ;; esac; \
62268150 2629 for file in *$(objext); do \
639b13ee 2630 tail +16c ./$$file > tmp-foo1; \
d7fba489 2631 tail +16c stage$$stage/$$file > tmp-foo2 \
20becaef 2632 && (cmp tmp-foo1 tmp-foo2 > /dev/null 2>&1 || echo $$file differs >> .bad_compare) || true; \
48c6936b 2633 done
d7fba489 2634 case "$@" in compare | compare-lean ) stage=2 ;; * ) stage=`echo $@ | sed -e 's,^compare\([0-9][0-9]*\).*,\1,'` ;; esac; \
73027c94 2635 for dir in tmp-foo $(SUBDIRS); do \
62268150 2636 if [ "`echo $$dir/*$(objext)`" != "$$dir/*$(objext)" ] ; then \
2637 for file in $$dir/*$(objext); do \
73027c94 2638 tail +16c ./$$file > tmp-foo1; \
d7fba489 2639 tail +16c stage$$stage/$$file > tmp-foo2 \
20becaef 2640 && (cmp tmp-foo1 tmp-foo2 > /dev/null 2>&1 || echo $$file differs >> .bad_compare) || true; \
9771451c 2641 done; \
2642 fi; \
73027c94 2643 done
48c6936b 2644 -rm -f tmp-foo*
77333ad9 2645 case "$@" in compare | compare-lean ) stage=2 ;; * ) stage=`echo $@ | sed -e 's,^compare\([0-9][0-9]*\).*,\1,'` ;; esac; \
20becaef 2646 if [ -f .bad_compare ]; then \
2647 echo "Bootstrap comparison failure!"; \
2648 cat .bad_compare; \
2649 exit 1; \
d7fba489 2650 else \
2651 case "$@" in \
2652 *-lean ) rm -rf stage$$stage ;; \
05bdc491 2653 *) ;; \
d7fba489 2654 esac; true; \
20becaef 2655 fi
48c6936b 2656
d7fba489 2657# Compare the object files in the current directory with those in the
2658# stage2 directory. Use gnu cmp (diffutils v2.4 or later) to avoid
2659# running tail and the overhead of twice copying each object file.
2660
2661gnucompare gnucompare3 gnucompare4 gnucompare-lean gnucompare3-lean gnucompare4-lean: force
732395de 2662 -rm -f .bad_compare
d7fba489 2663 case "$@" in gnucompare | gnucompare-lean ) stage=2 ;; * ) stage=`echo $@ | sed -e 's,^gnucompare\([0-9][0-9]*\).*,\1,'` ;; esac; \
732395de 2664 for file in *$(objext); do \
d7fba489 2665 (cmp --ignore-initial=16 $$file stage$$stage/$$file > /dev/null 2>&1 || echo $$file differs >> .bad_compare) || true; \
732395de 2666 done
d7fba489 2667 case "$@" in gnucompare | gnucompare-lean ) stage=2 ;; * ) stage=`echo $@ | sed -e 's,^gnucompare\([0-9][0-9]*\).*,\1,'` ;; esac; \
732395de 2668 for dir in tmp-foo $(SUBDIRS); do \
2669 if [ "`echo $$dir/*$(objext)`" != "$$dir/*$(objext)" ] ; then \
2670 for file in $$dir/*$(objext); do \
d7fba489 2671 (cmp --ignore-initial=16 $$file stage$$stage/$$file > /dev/null 2>&1 || echo $$file differs >> .bad_compare) || true; \
732395de 2672 done; \
2673 fi; \
2674 done
77333ad9 2675 case "$@" in gnucompare | gnucompare-lean ) stage=2 ;; * ) stage=`echo $@ | sed -e 's,^gnucompare\([0-9][0-9]*\).*,\1,'` ;; esac; \
732395de 2676 if [ -f .bad_compare ]; then \
2677 echo "Bootstrap comparison failure!"; \
2678 cat .bad_compare; \
2679 exit 1; \
d7fba489 2680 else \
2681 case "$@" in \
2682 *-lean ) rm -rf stage$$stage ;; \
2683 esac; true; \
732395de 2684 fi
2685
32e6d418 2686# Copy the object files from a particular stage into a subdirectory.
73027c94 2687stage1-start:
c6396a0b 2688 -if [ -d stage1 ] ; then true ; else mkdir stage1 ; fi
73027c94 2689 -for dir in . $(SUBDIRS) ; \
2690 do \
21fde8a9 2691 if [ -d stage1/$$dir ] ; then true ; else mkdir stage1/$$dir ; fi ; \
73027c94 2692 done
32e6d418 2693 -mv $(STAGESTUFF) stage1
b541ad9d 2694# Copy as/ld if they exist to stage dir, so that running xgcc from the stage
2695# dir will work properly.
ea4a6c81 2696 -if [ -f as$(exeext) ] ; then $(LN_S) ../as$(exeext) stage1 ; else true ; fi
2697 -if [ -f ld$(exeext) ] ; then $(LN_S) ../ld$(exeext) stage1 ; else true ; fi
2698 -if [ -f collect-ld$(exeext) ] ; then $(LN_S) ../collect-ld$(exeext) stage1 ; else true ; fi
32e6d418 2699 -rm -f stage1/libgcc.a
2700 -cp libgcc.a stage1
2701 -if $(RANLIB_TEST) ; then $(RANLIB) stage1/libgcc.a; else true; fi
3efc89f0 2702 -for f in .. $(EXTRA_MULTILIB_PARTS); do if [ x$${f} != x.. ]; then \
2703 cp stage1/$${f} . ; \
7561ae90 2704 else true; \
3efc89f0 2705 fi; done
73027c94 2706stage1: force stage1-start lang.stage1
32e6d418 2707
73027c94 2708stage2-start:
c6396a0b 2709 -if [ -d stage2 ] ; then true ; else mkdir stage2 ; fi
73027c94 2710 -for dir in . $(SUBDIRS) ; \
2711 do \
21fde8a9 2712 if [ -d stage2/$$dir ] ; then true ; else mkdir stage2/$$dir ; fi ; \
73027c94 2713 done
32e6d418 2714 -mv $(STAGESTUFF) stage2
b541ad9d 2715# Copy as/ld if they exist to stage dir, so that running xgcc from the stage
2716# dir will work properly.
ea4a6c81 2717 -if [ -f as$(exeext) ] ; then $(LN_S) ../as$(exeext) stage2 ; else true ; fi
2718 -if [ -f ld$(exeext) ] ; then $(LN_S) ../ld$(exeext) stage2 ; else true ; fi
2719 -if [ -f collect-ld ] ; then $(LN_S) ../collect-ld$(exeext) stage2 ; else true ; fi
32e6d418 2720 -rm -f stage2/libgcc.a
2721 -cp libgcc.a stage2
2722 -if $(RANLIB_TEST) ; then $(RANLIB) stage2/libgcc.a; else true; fi
3efc89f0 2723 -for f in .. $(EXTRA_MULTILIB_PARTS); do if [ x$${f} != x.. ]; then \
2724 cp stage2/$${f} . ; \
7561ae90 2725 else true; \
3efc89f0 2726 fi; done
73027c94 2727stage2: force stage2-start lang.stage2
32e6d418 2728
73027c94 2729stage3-start:
2388f67d 2730 -if [ -d stage3 ] ; then true ; else mkdir stage3 ; fi
73027c94 2731 -for dir in . $(SUBDIRS) ; \
2732 do \
21fde8a9 2733 if [ -d stage3/$$dir ] ; then true ; else mkdir stage3/$$dir ; fi ; \
73027c94 2734 done
32e6d418 2735 -mv $(STAGESTUFF) stage3
b541ad9d 2736# Copy as/ld if they exist to stage dir, so that running xgcc from the stage
2737# dir will work properly.
ea4a6c81 2738 -if [ -f as$(exeext) ] ; then $(LN_S) ../as$(exeext) stage3 ; else true ; fi
2739 -if [ -f ld$(exeext) ] ; then $(LN_S) ../ld$(exeext) stage3 ; else true ; fi
2740 -if [ -f collect-ld$(exeext) ] ; then $(LN_S) ../collect-ld$(exeext) stage3 ; else true ; fi
32e6d418 2741 -rm -f stage3/libgcc.a
2742 -cp libgcc.a stage3
2743 -if $(RANLIB_TEST) ; then $(RANLIB) stage3/libgcc.a; else true; fi
3efc89f0 2744 -for f in .. $(EXTRA_MULTILIB_PARTS); do if [ x$${f} != x.. ]; then \
2745 cp stage3/$${f} . ; \
7561ae90 2746 else true; \
3efc89f0 2747 fi; done
73027c94 2748stage3: force stage3-start lang.stage3
32e6d418 2749
73027c94 2750stage4-start:
2388f67d 2751 -if [ -d stage4 ] ; then true ; else mkdir stage4 ; fi
73027c94 2752 -for dir in . $(SUBDIRS) ; \
2753 do \
21fde8a9 2754 if [ -d stage4/$$dir ] ; then true ; else mkdir stage4/$$dir ; fi ; \
73027c94 2755 done
32e6d418 2756 -mv $(STAGESTUFF) stage4
b541ad9d 2757# Copy as/ld if they exist to stage dir, so that running xgcc from the stage
2758# dir will work properly.
ea4a6c81 2759 -if [ -f as$(exeext) ] ; then $(LN_S) ../as$(exeext) stage4 ; else true ; fi
2760 -if [ -f ld$(exeext) ] ; then $(LN_S) ../ld$(exeext) stage4 ; else true ; fi
2761 -if [ -f collect-ld$(exeext) ] ; then $(LN_S) ../collect-ld$(exeext) stage4 ; else true ; fi
32e6d418 2762 -rm -f stage4/libgcc.a
2763 -cp libgcc.a stage4
2764 -if $(RANLIB_TEST) ; then $(RANLIB) stage4/libgcc.a; else true; fi
3efc89f0 2765 -for f in .. $(EXTRA_MULTILIB_PARTS); do if [ x$${f} != x.. ]; then \
2766 cp stage4/$${f} . ; \
7561ae90 2767 else true; \
3efc89f0 2768 fi; done
73027c94 2769stage4: force stage4-start lang.stage4
32e6d418 2770
2771# Copy just the executable files from a particular stage into a subdirectory,
2772# and delete the object files. Use this if you're just verifying a version
2773# that is pretty sure to work, and you are short of disk space.
62268150 2774risky-stage1: stage1
7cc2ce68 2775 -make clean
32e6d418 2776
62268150 2777risky-stage2: stage2
32e6d418 2778 -make clean
2779
62268150 2780risky-stage3: stage3
32e6d418 2781 -make clean
2782
62268150 2783risky-stage4: stage4
32e6d418 2784 -make clean
2785
2786#In GNU Make, ignore whether `stage*' exists.
a8514488 2787.PHONY: stage1 stage2 stage3 stage4 clean maintainer-clean TAGS bootstrap
32e6d418 2788.PHONY: risky-stage1 risky-stage2 risky-stage3 risky-stage4
2789
2790force: