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