]> git.ipfire.org Git - thirdparty/gcc.git/blame - gcc/Makefile.in
(print_operand, default case): Handle SFmode regs.
[thirdparty/gcc.git] / gcc / Makefile.in
CommitLineData
32e6d418 1# Makefile for GNU C compiler.
80c77755 2# Copyright (C) 1987, 88, 90, 91, 92, 93, 1994 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
18#the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
19
20# The targets for external use include:
21# all, doc, proto, install, install-cross, install-cross-rest,
c6396a0b 22# uninstall, TAGS, mostlyclean, clean, distclean, realclean,
32e6d418 23# stage1, stage2, stage3, stage4.
24
c6396a0b 25# Suppress smart makes who think they know how to automake Yacc files
26.y.c:
27
32e6d418 28# Variables that exist for you to override.
29# See below for how to change them for certain systems.
30
73027c94 31# List of language subdirectories.
32# This is overridden by configure.
33SUBDIRS =
34
32e6d418 35# Selection of languages to be made.
73027c94 36# This is overridden by configure.
37LANGUAGES = c objective-c proto
32e6d418 38
39ALLOCA =
1ab99fde 40ALLOCA_FLAGS =
94c53b91 41ALLOCA_FINISH = true
32e6d418 42
43# Various ways of specifying flags for compilations:
44# CFLAGS is for the user to override to, e.g., do a bootstrap with -O2.
45# BOOT_CFLAGS is the value of CFLAGS to pass
46# to the stage2 and stage3 compilations
47# XCFLAGS is used for most compilations but not when using the GCC just built.
48XCFLAGS =
49CFLAGS = -g
50BOOT_CFLAGS = -O $(CFLAGS)
51# These exists to be overridden by the x-* and t-* files, respectively.
52X_CFLAGS =
53T_CFLAGS =
54
55X_CPPFLAGS =
56T_CPPFLAGS =
57
58CC = cc
59BISON = bison
3f1608f3 60BISONFLAGS =
73027c94 61LEX = flex
62LEXFLAGS =
32e6d418 63AR = ar
64OLDAR_FLAGS = qc
65AR_FLAGS = rc
66SHELL = /bin/sh
67# on sysV, define this as cp.
68INSTALL = install -c
69# These permit overriding just for certain files.
70INSTALL_PROGRAM = $(INSTALL)
71INSTALL_DATA = $(INSTALL)
72SYMLINK = ln -s
bc51108a 73MAKEINFO = makeinfo
f345940f 74TEXI2DVI = texi2dvi
73027c94 75# For GNUmake: let us decide what gets passed to recursive makes.
76MAKEOVERRIDES =
32e6d418 77
78# Define this as & to perform parallel make on a Sequent.
79# Note that this has some bugs, and it seems currently necessary
80# to compile all the gen* files first by hand to avoid erroneous results.
81P =
82
83# How to invoke ranlib.
84RANLIB = ranlib
85# Test to use to see whether ranlib exists on the system.
86RANLIB_TEST = [ -f /usr/bin/ranlib -o -f /bin/ranlib ]
87
88# Compiler to use for compiling libgcc1.a.
89# OLDCC should not be the GNU C compiler,
90# since that would compile typical libgcc1.a functions such as mulsi3
91# into infinite recursions.
92OLDCC = cc
93
94# CFLAGS for use with OLDCC, for compiling libgcc1.a.
95# NOTE: -O does not work on some Unix systems!
96CCLIBFLAGS = -O
97
c6396a0b 98# Version of ar to use when compiling libgcc1.a.
32e6d418 99OLDAR = ar
100
2cfd79fe 101# Target to use when installing include directory. Either
102# install-headers-tar or install-headers-cpio.
103INSTALL_HEADERS_DIR = install-headers-tar
104
b3781cc4 105# The GCC to use for compiling libgcc2.a, enquire, and cross-test.
106# Usually the one we just built.
32e6d418 107# Don't use this as a dependency--use $(GCC_PASSES) or $(GCC_PARTS).
79613d1b 108GCC_FOR_TARGET = ./xgcc -B./
32e6d418 109
110# This is used instead of ALL_CFLAGS when compiling with GCC_FOR_TARGET.
111# It omits XCFLAGS, and specifies -B./.
66820558 112# It also specifies -I./include to find, e.g., stddef.h.
113GCC_CFLAGS=$(INTERNAL_CFLAGS) $(X_CFLAGS) $(T_CFLAGS) $(CFLAGS) -I./include
32e6d418 114
115# Special flags for compiling enquire.
116# We disable optimization to make floating point more reliable.
c7341319 117ENQUIRE_CFLAGS = -DNO_MEM -DNO_LONG_DOUBLE_IO -O0
32e6d418 118ENQUIRE_LDFLAGS = $(LDFLAGS)
119
120# Tools to use when building a cross-compiler.
121# These are used because `configure' appends `cross-make'
122# to the makefile when making a cross-compiler.
123
124TARGET_TOOLPREFIX = $(tooldir)/bin/
125AR_FOR_TARGET = $(TARGET_TOOLPREFIX)ar
126AR_FOR_TARGET_FLAGS = rc
127RANLIB_FOR_TARGET = $(TARGET_TOOLPREFIX)ranlib
128RANLIB_TEST_FOR_TARGET = [ -f $(TARGET_TOOLPREFIX)ranlib ]
32e6d418 129
3f69fed5 130# Dir to search for system headers. Overridden by cross-make.
131SYSTEM_HEADER_DIR = /usr/include
132
61fad423 133# Control whether to run fixproto.
134STMP_FIXPROTO = stmp-fixproto
a5889b74 135
8bd8ea06 136# There may be a premade insn-attrtab.c for this machine.
137# (You could rebuild it with genattrtab as usual, but it takes a long time.)
138# PREMADE_ATTRTAB is the file name of the file to use.
139# PREMADE_ATTRTAB_MD is the md file it corresponds to.
140PREMADE_ATTRTAB_MD = Makefile # Guaranteed not to cmp equal to md.
141PREMADE_ATTRTAB =
142
32e6d418 143target= ... `configure' substitutes actual target name here.
144xmake_file= ... `configure' substitutes actual x- file name here.
145tmake_file= ... `configure' substitutes actual t- file name here.
18196d1e 146version=`sed -e 's/.*\"\([^ \"]*\)[ \"].*/\1/' < $(srcdir)/version.c`
2b19125c 147mainversion=`sed -e 's/.*\"\([0-9]*\.[0-9]*\).*/\1/' < $(srcdir)/version.c`
32e6d418 148
149# Directory where sources are, from where we are.
150srcdir = .
151# Common prefix for installation directories.
152# NOTE: This directory must exist when you start installation.
153prefix = /usr/local
2ffdcadf 154# Directory in which to put localized header files. On the systems with
155# gcc as the native cc, `local_prefix' may not be `prefix' which is
156# `/usr'.
a2aa0fc1 157# NOTE: local_prefix *should not* default from prefix.
158local_prefix = /usr/local
c6396a0b 159# Directory in which to put host dependent programs and libraries
160exec_prefix = $(prefix)
32e6d418 161# Directory in which to put the executable for the command `gcc'
c6396a0b 162bindir = $(exec_prefix)/bin
32e6d418 163# Directory in which to put the directories used by the compiler.
c6396a0b 164libdir = $(exec_prefix)/lib
32e6d418 165# Directory in which the compiler finds executables, libraries, etc.
c6396a0b 166libsubdir = $(libdir)/gcc-lib/$(target)/$(version)
3bf5d4dc 167# Directory in which the compiler finds g++ includes.
168gxx_include_dir= $(libdir)/g++-include
35df828f 169# Directory to search for site-specific includes.
9671ce48 170includedir = $(local_prefix)/include
db9a0b19 171# assertdir is overridden in cross-make.
9d8314a9 172# (But this currently agrees with what is in cross-make.)
173assertdir = $(tooldir)/include
a2aa0fc1 174# where the info files go
175infodir = $(prefix)/info
32e6d418 176# Extension (if any) to put in installed man-page filename.
177manext = .1
178# Directory in which to put man pages.
179mandir = $(prefix)/man/man1
180# Directory in which to find other cross-compilation tools and headers.
181# Used in install-cross.
556d8d24 182tooldir = $(exec_prefix)/$(target)
f32abccb 183# Dir for temp files.
184tmpdir = /tmp
32e6d418 185
186# Additional system libraries to link with.
187CLIB=
188
189# Change this to a null string if obstacks are installed in the
190# system library.
191OBSTACK=obstack.o
192
2289acd7 193# Specify the rule for actually making libgcc.a,
194LIBGCC = libgcc.a
195# and the rule for installing it.
196INSTALL_LIBGCC = install-libgcc
197
32e6d418 198# Specify the rule for actually making libgcc1.a.
c6396a0b 199# The value may be empty; that means to do absolutely nothing
200# with or for libgcc1.a.
32e6d418 201LIBGCC1 = libgcc1.a
202
b0d230b7 203# Specify the rule for making libgcc1.a for a cross-compiler.
204# The default rule assumes that libgcc1.a is supplied by the user.
205CROSS_LIBGCC1 = libgcc1.cross
206
32e6d418 207# Specify the rule for actually making libgcc2.a.
208LIBGCC2 = libgcc2.a
209
210# Options to use when compiling libgcc2.a.
211# -g1 causes output of debug info only for file-scope entities.
212# we use this here because that should be enough, and also
213# so that -g1 will be tested.
690a93ea 214LIBGCC2_CFLAGS = -O2 $(LIBGCC2_INCLUDES) $(GCC_CFLAGS) -g1
215
216# Additional options to use when compiling libgcc2.a.
217# Some targets override this to -Iinclude
218LIBGCC2_INCLUDES =
219
220# Things which must be built before building libgcc2.a.
221# Some targets override this to stmp-int-hdrs
222LIBGCC2_DEPS =
32e6d418 223
17886975 224# Enquire target (This is a variable so that a target can choose not to
225# build it.)
226ENQUIRE = enquire
227
228# Cross-test target (must also be overridable for a target)
229CROSS_TEST = cross-test
230
32e6d418 231# List of extra executables that should be compiled for this target machine
232# that are used for compiling from source code to object code.
233# The rules for compiling them should be in the t-* file for the machine.
234EXTRA_PASSES =
235
c6396a0b 236# Like EXTRA_PASSES, but these are used when linking.
237EXTRA_PROGRAMS =
238
239# List of extra object files that should be compiled for this target machine.
32e6d418 240# The rules for compiling them should be in the t-* file for the machine.
241EXTRA_PARTS =
242
c6396a0b 243# List of extra object files that should be compiled and linked with
244# compiler proper (cc1, cc1obj, cc1plus).
245EXTRA_OBJS =
246
630c76ba 247# List of additional header files to install.
248# Often this is edited directly by `configure'.
249EXTRA_HEADERS =
250
79f818d0 251# Set this to `ld' to enable use of collect2.
252# USE_COLLECT2 =
253# It is convenient for configure to add the assignment at the beginning,
254# so don't override it here.
255
32e6d418 256# List of extra C and assembler files to add to libgcc1.a.
257# Assembler files should have names ending in `.asm'.
258LIB1FUNCS_EXTRA =
259
260# List of extra C and assembler files to add to libgcc2.a.
261# Assembler files should have names ending in `.asm'.
262LIB2FUNCS_EXTRA =
263
2cfd79fe 264# Default float.h source to use for cross-compiler.
265CROSS_FLOAT_H=float.h-cross
266
32e6d418 267# Program to convert libraries.
268LIBCONVERT =
269
270# Control whether header files are installed.
32e6d418 271INSTALL_HEADERS=install-headers
272
ed2f1f67 273# Options for tar when copying trees. So HPUX can override it.
274TAROUTOPTS = xpBf
275
32e6d418 276# Select which version of fixincludes to use (I.E. regular versus SVR4)
6848a9c6 277# This value is overridden directly by configure.
32e6d418 278FIXINCLUDES=fixincludes
279
106a27e5 280# Additional directories of header files to run fixincludes on.
af731fc2 281# These should be directories searched automatically by default
282# just as /usr/include is.
283# *Do not* use this for directories that happen to contain
284# header files, but are not searched automatically by default.
106a27e5 285# On most systems, this is empty.
286OTHER_FIXINCLUDES_DIRS=
287
77a164d8 288# List of things which should already be built whenever we try to use xgcc
32e6d418 289# to compile anything (without linking).
77a164d8 290GCC_PASSES=xgcc cc1 cpp $(EXTRA_PASSES)
32e6d418 291
77a164d8 292# List of things which should already be built whenever we try to use xgcc
32e6d418 293# to link anything.
2289acd7 294GCC_PARTS=$(GCC_PASSES) $(LIBGCC) $(EXTRA_PROGRAMS) $(USE_COLLECT2) $(EXTRA_PARTS)
32e6d418 295
32e6d418 296# Directory to link to, when using the target `maketest'.
297DIR = ../gcc
298
89e36a04 299# Guaranteed to not exist when not passing md through cpp.
2c352995 300# This value is overridden directly by configure.
89e36a04 301MD_FILE = md-cpp-not-used
302
32e6d418 303# Flags to use when cross-building GCC.
304# Prefix to apply to names of object files when using them
305# to run on the machine we are compiling on.
306HOST_PREFIX=
307# Prefix to apply to names of object files when compiling them
308# to run on the machine we are compiling on.
309# The default for this variable is chosen to keep these rules
310# out of the way of the other rules for compiling the same source files.
311HOST_PREFIX_1=loser-
312HOST_CC=$(CC)
313HOST_CFLAGS=$(ALL_CFLAGS)
c6396a0b 314HOST_CLIB=$(CLIB)
32e6d418 315HOST_LDFLAGS=$(LDFLAGS)
316HOST_CPPFLAGS=$(ALL_CPPFLAGS)
c6396a0b 317HOST_ALLOCA=$(ALLOCA)
318HOST_MALLOC=$(MALLOC)
319HOST_OBSTACK=$(OBSTACK)
32e6d418 320
321# Choose the real default target.
322ALL=all.internal
323
324# Choose the real install target.
2cfd79fe 325INSTALL_TARGET=install-normal
326
327# Source for float.h. Overridden by cross-make.
328FLOAT_H=float.h-nat
32e6d418 329
b33b80ed 330# Extra symbols for fixproto to define when parsing headers.
331FIXPROTO_DEFINES =
332
32e6d418 333# End of variables for you to override.
334
335# Definition of `all' is here so that new rules inserted by sed
336# do not specify the default target.
337# The real definition is under `all.internal' (for native compilers)
338# or `all.cross' (for cross compilers).
c6396a0b 339all: all.indirect
32e6d418 340
131b361e 341# This tells GNU Make version 3 not to put all variables in the environment.
342.NOEXPORT:
343
32e6d418 344# sed inserts variable overrides after the following line.
a0a99f10 345####target overrides
346####host overrides
347####cross overrides
e77fd588 348####build overrides
32e6d418 349\f
350# Now figure out from those variables how to compile and link.
351
c6396a0b 352all.indirect: $(ALL)
353
335ebf8f 354# IN_GCC tells obstack.h that we are using gcc's <stddef.h> file.
355# ??? IN_GCC should be obsolete now.
34b1478f 356INTERNAL_CFLAGS = $(CROSS) -DIN_GCC
32e6d418 357
358# This is the variable actually used when we compile.
359ALL_CFLAGS = $(INTERNAL_CFLAGS) $(X_CFLAGS) $(T_CFLAGS) $(CFLAGS) $(XCFLAGS)
360
361# Likewise.
362ALL_CPPFLAGS = $(CPPFLAGS) $(X_CPPFLAGS) $(T_CPPFLAGS)
363
364# Even if ALLOCA is set, don't use it if compiling with GCC.
cdd3cf30 365USE_ALLOCA= ` case "${CC}" in "${OLDCC}") echo "${ALLOCA}" ;; esac `
c6396a0b 366USE_HOST_ALLOCA= ` case "${HOST_CC}"@"${HOST_ALLOCA}" in "${OLDCC}"@?*) echo ${HOST_PREFIX}${HOST_ALLOCA} ;; esac `
367USE_HOST_MALLOC= ` case "${HOST_MALLOC}" in ?*) echo ${HOST_PREFIX}${HOST_MALLOC} ;; esac `
368USE_HOST_OBSTACK= ` case "${HOST_OBSTACK}" in ?*) echo ${HOST_PREFIX}${HOST_OBSTACK} ;; esac `
32e6d418 369
370# Dependency on obstack, alloca, malloc or whatever library facilities
371# are not installed in the system libraries.
372# We don't use USE_ALLOCA because backquote expansion doesn't work in deps.
373LIBDEPS= $(OBSTACK) $(ALLOCA) $(MALLOC)
374
375# Likewise, for use in the tools that must run on this machine
376# even if we are cross-building GCC.
377# We don't use USE_ALLOCA because backquote expansion doesn't work in deps.
c6396a0b 378HOST_LIBDEPS= $(HOST_PREFIX)$(HOST_OBSTACK) $(HOST_PREFIX)$(HOST_ALLOCA) $(HOST_PREFIX)$(HOST_MALLOC)
32e6d418 379
380# How to link with both our special library facilities
381# and the system's installed libraries.
382LIBS = $(OBSTACK) $(USE_ALLOCA) $(MALLOC) $(CLIB)
383
384# Likewise, for use in the tools that must run on this machine
385# even if we are cross-building GCC.
c6396a0b 386HOST_LIBS = $(USE_HOST_OBSTACK) $(USE_HOST_ALLOCA) $(USE_HOST_MALLOC) \
387 $(HOST_CLIB)
32e6d418 388
389HOST_RTL = $(HOST_PREFIX)rtl.o
390HOST_RTLANAL = $(HOST_PREFIX)rtlanal.o
262d46de 391HOST_PRINT = $(HOST_PREFIX)print-rtl.o
32e6d418 392
393# Specify the directories to be searched for header files.
394# Both . and srcdir are used, in that order,
395# so that tm.h and config.h will be found in the compilation
396# subdirectory rather than in the source directory.
397INCLUDES = -I. -I$(srcdir) -I$(srcdir)/config
32e6d418 398
399# Always use -I$(srcdir)/config when compiling.
400.c.o:
401 $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $<
402
403# This tells GNU make version 3 not to export all the variables
404# defined in this file into the environment.
405.NOEXPORT:
406\f
73027c94 407# Support for additional languages (other than c and objc).
408# ??? objc can be supported this way too (leave for later).
409
410# These next lines are overridden by configure.
411LANG_MAKEFILES =
412LANG_STAGESTUFF =
413LANG_DIFF_EXCLUDES =
414
415# Flags to pass to recursive makes.
416# CC is set by configure. Hosts without symlinks need special handling
417# because we need CC="stage1/xgcc -Bstage1/" to work in the language
418# subdirectories.
419# ??? The choices here will need some experimenting with.
420FLAGS_TO_PASS = \
421 "AR_FLAGS=$(AR_FLAGS)" \
422 "AR_FOR_TARGET=$(AR_FOR_TARGET)" \
423 "BISON=$(BISON)" \
424 "BISONFLAGS=$(BISONFLAGS)" \
425 "CC=set-by-configure" \
426 "CFLAGS=$(CFLAGS)" \
73027c94 427 "GCC_FOR_TARGET=$(CC_FOR_TARGET)" \
428 "LDFLAGS=$(LDFLAGS)" \
429 "LEX=$(LEX)" \
430 "LEXFLAGS=$(LEXFLAGS)" \
431 "MAKEINFO=$(MAKEINFO)" \
432 "MAKEINFOFLAGS=$(MAKEINFOFLAGS)" \
73027c94 433 "RANLIB_FOR_TARGET=$(RANLIB_FOR_TARGET)" \
434 "RANLIB_TEST_FOR_TARGET=$(RANLIB_TEST_FOR_TARGET)" \
435 "SHELL=$(SHELL)" \
436 "exec_prefix=$(exec_prefix)" \
437 "prefix=$(prefix)" \
438 "tooldir=$(tooldir)" \
439 "bindir=$(bindir)" \
440 "libsubdir=$(libsubdir)"
441\f
32e6d418 442# Lists of files for various purposes.
443
444# A list of all the language-specific executables.
73027c94 445# This is overridden by configure.
446COMPILERS = cc1 cc1obj
32e6d418 447
448# Language-specific object files for C.
1294913b 449C_OBJS = c-parse.o c-lang.o c-lex.o c-pragma.o \
450 c-decl.o c-typeck.o c-convert.o c-aux-info.o c-common.o c-iterate.o
32e6d418 451
8dff2b2b 452# Language-specific object files for Objective C.
1294913b 453OBJC_OBJS = objc-parse.o objc-act.o c-lex.o c-pragma.o \
454 c-decl.o c-typeck.o c-convert.o c-aux-info.o c-common.o c-iterate.o
32e6d418 455
649d8da6 456# Files specific to the C interpreter bytecode compiler(s).
457BC_OBJS = bc-emit.o bc-optab.o
458
32e6d418 459# Language-independent object files.
460OBJS = toplev.o version.o tree.o print-tree.o stor-layout.o fold-const.o \
461 function.o stmt.o expr.o calls.o expmed.o explow.o optabs.o varasm.o \
6d9f2c4c 462 rtl.o print-rtl.o rtlanal.o emit-rtl.o real.o \
79f818d0 463 dbxout.o sdbout.o dwarfout.o xcoffout.o \
32e6d418 464 integrate.o jump.o cse.o loop.o unroll.o flow.o stupid.o combine.o \
8a4b1e01 465 regclass.o local-alloc.o global.o reload.o reload1.o caller-save.o \
32e6d418 466 insn-peep.o reorg.o sched.o final.o recog.o reg-stack.o \
bdb66cef 467 insn-opinit.o insn-recog.o insn-extract.o insn-output.o insn-emit.o \
de6985af 468 insn-attrtab.o aux-output.o getpwd.o convert.o $(EXTRA_OBJS)
32e6d418 469
470# GEN files are listed separately, so they can be built before doing parallel
471# makes for cc1 or cc1plus. Otherwise sequent parallel make attempts to load
472# them before rtl.o is compiled.
473GEN= genemit genoutput genrecog genextract genflags gencodes genconfig genpeep
474
475# Files to be copied away after each stage in building.
476STAGESTUFF = *.o insn-flags.h insn-config.h insn-codes.h \
477 insn-output.c insn-recog.c insn-emit.c insn-extract.c insn-peep.c \
d95fa18c 478 insn-attr.h insn-attrtab.c insn-opinit.c \
32e6d418 479 stamp-flags stamp-config stamp-codes \
480 stamp-output stamp-recog stamp-emit stamp-extract stamp-peep \
d95fa18c 481 stamp-attr stamp-attrtab stamp-opinit stamp-proto \
32e6d418 482 genemit genoutput genrecog genextract genflags gencodes genconfig genpeep \
d95fa18c 483 genattrtab genattr genopinit \
8bb62f3d 484 bc-arity.h bc-opcode.h bc-opname.h \
485 stamp-bcarity stamp-bcopcode stamp-bcopname \
486 bi-arity bi-opcode bi-opname \
73027c94 487 $(GCC_PASSES) $(EXTRA_PARTS) $(EXTRA_PROGRAMS) gcc-cross cccp \
488 cc1obj enquire protoize unprotoize specs collect2 $(USE_COLLECT2) \
489 $(LANG_STAGESTUFF)
32e6d418 490
491# Members of libgcc1.a.
492LIB1FUNCS = _mulsi3 _udivsi3 _divsi3 _umodsi3 _modsi3 \
493 _lshrsi3 _lshlsi3 _ashrsi3 _ashlsi3 \
494 _divdf3 _muldf3 _negdf2 _adddf3 _subdf3 \
495 _fixdfsi _fixsfsi _floatsidf _floatsisf _truncdfsf2 _extendsfdf2 \
496 _addsf3 _negsf2 _subsf3 _mulsf3 _divsf3 \
497 _eqdf2 _nedf2 _gtdf2 _gedf2 _ltdf2 _ledf2 \
498 _eqsf2 _nesf2 _gtsf2 _gesf2 _ltsf2 _lesf2
499
500# Library members defined in libgcc2.c.
501LIB2FUNCS = _muldi3 _divdi3 _moddi3 _udivdi3 _umoddi3 _negdi2 \
dc1db499 502 _lshrdi3 _lshldi3 _ashldi3 _ashrdi3 _ffsdi2 \
4b8f50a8 503 _udiv_w_sdiv _udivmoddi4 _cmpdi2 _ucmpdi2 _floatdidf _floatdisf \
32e6d418 504 _fixunsdfsi _fixunssfsi _fixunsdfdi _fixdfdi _fixunssfdi _fixsfdi \
619c3e71 505 _fixxfdi _fixunsxfdi _floatdixf _fixunsxfsi \
d055d75f 506 _fixtfdi _fixunstfdi _floatditf \
bbf03111 507 __gcc_bcmp _varargs _eprintf _op_new _op_vnew _new_handler _op_delete \
508 _op_vdel _bb _shtab _clear_cache _trampoline __main _exit _ctors
32e6d418 509
510# Header files that are made available under the same name
77a164d8 511# to programs compiled with GCC.
34aae198 512USER_H = $(srcdir)/ginclude/stdarg.h $(srcdir)/ginclude/stddef.h \
513 $(srcdir)/ginclude/varargs.h $(srcdir)/ginclude/va-alpha.h \
514 $(srcdir)/ginclude/va-h8300.h $(srcdir)/ginclude/va-i860.h \
515 $(srcdir)/ginclude/va-i960.h $(srcdir)/ginclude/va-mips.h \
516 $(srcdir)/ginclude/va-m88k.h $(srcdir)/ginclude/va-pa.h \
517 $(srcdir)/ginclude/va-pyr.h $(srcdir)/ginclude/va-sparc.h \
518 $(srcdir)/ginclude/va-clipper.h $(srcdir)/ginclude/va-spur.h \
519 $(srcdir)/ginclude/proto.h $(EXTRA_HEADERS)
32e6d418 520
32e6d418 521# The files that "belong" in CONFIG_H are deliberately omitted
522# because having them there would not be useful in actual practice.
523# All they would do is cause complete recompilation every time
524# one of the machine description files is edited.
525# That may or may not be what one wants to do.
526# If it is, rm *.o is an easy way to do it.
527# CONFIG_H = config.h tm.h
528CONFIG_H =
529RTL_H = rtl.h rtl.def machmode.h machmode.def
530TREE_H = tree.h real.h tree.def machmode.h machmode.def
649d8da6 531BYTECODE_H = bytecode.h bc-emit.h bc-optab.h
32e6d418 532\f
73027c94 533# Language makefile fragments.
534
535# The following targets define the interface between us and the languages.
536#
537# all.build, all.cross, start.encap, rest.encap,
538# info, dvi,
539# install-normal, install-common, install-info, install-man,
540# uninstall, distdir,
541# mostlyclean, clean, distclean, extraclean, realclean,
542# stage1, stage2, stage3, stage4
543#
544# Each language is linked in with a series of hooks (since we can't use `::'
545# targets). The name of each hooked is "lang.${target_name}" (eg: lang.info).
546# Configure computes and adds these here.
547
548####language hooks
549
550# sed inserts language fragments after the following line.
551####language fragments
552
553# End of language makefile fragments.
554\f
32e6d418 555# Avoid a lot of time thinking about remaking Makefile.in and *.def.
556.SUFFIXES: .in .def
557
79f818d0 558Makefile: $(srcdir)/Makefile.in $(srcdir)/configure $(srcdir)/version.c \
73027c94 559 $(srcdir)/config/$(xmake_file) $(srcdir)/config/$(tmake_file) \
560 $(LANG_MAKEFILES)
6518b023 561 $(SHELL) config.status
32e6d418 562
563all.internal: start.encap rest.encap
564# This is what to compile if making a cross-compiler.
73027c94 565# Note that we can compile enquire using the cross-compiler just built,
87540b0a 566# although we can't run it on this machine.
73027c94 567all.cross: native gcc-cross specs stmp-headers $(LIBGCC) $(STMP_FIXPROTO) \
568 $(CROSS_TEST) $(ENQUIRE) $(EXTRA_PARTS) lang.all.cross
e77fd588 569# This is what to compile if making gcc with a cross-compiler.
73027c94 570all.build: native xgcc $(EXTRA_PARTS) lang.all.build
32e6d418 571# This is what must be made before installing GCC and converting libraries.
73027c94 572start.encap: native xgcc specs $(LIBGCC1) xlimits.h lang.start.encap
335ebf8f 573# These can't be made until after GCC can run.
73027c94 574rest.encap: stmp-headers $(LIBGCC) $(STMP_FIXPROTO) $(EXTRA_PARTS) lang.rest.encap
32e6d418 575# This is what is made with the host's compiler
576# whether making a cross compiler or not.
852e59cd 577native: config.status cpp $(LANGUAGES) $(EXTRA_PASSES) $(EXTRA_PROGRAMS) $(USE_COLLECT2)
32e6d418 578
579# Define the names for selecting languages in LANGUAGES.
580C c: cc1
732b8330 581OBJC objc: cc1obj objc-runtime
582OBJECTIVE-C objective-c: cc1obj objc-runtime
32e6d418 583PROTO: proto
584
c6396a0b 585# Really, really stupid make features, such as SUN's KEEP_STATE, may force
586# a target to build even if it is up-to-date. So we must verify that
587# config.status does not exist before failing.
32e6d418 588config.status:
c6396a0b 589 @if [ ! -f config.status ] ; then \
590 echo You must configure gcc. Look at the INSTALL file for details.; \
591 false; \
592 else \
593 true; \
594 fi
32e6d418 595
840a6e8d 596# On the target machine, finish building a cross compiler.
597# This does the things that can't be done on the host machine.
2289acd7 598rest.cross: $(LIBGCC) gfloat.h specs
840a6e8d 599
d7330690 600# Verify that it works to compile and link cross-test.
601# If it does, then there are sufficient replacements for libgcc1.a.
2289acd7 602cross-test: cross-test.o native gcc-cross $(LIBGCC) $(GCC_PARTS)
13c6d959 603 $(GCC_FOR_TARGET) $(GCC_CFLAGS) cross-test.o -o cross-test
d7330690 604cross-test.o: cross-test.c native gcc-cross
605 $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(ALL_CPPFLAGS) -c $(srcdir)/cross-test.c
606
840a6e8d 607# Recompile all the language-independent object files.
608# This is used only if the user explicitly asks for it.
32e6d418 609compilations: ${OBJS}
610
03f51dea 611# Create a list of the language-independent object files so the language
612# subdirectories needn't mention their names explicitly.
62e181a7 613stamp-objlist: Makefile $(OBJS) $(BC_OBJS)
03f51dea 614 echo " $(OBJS) $(BC_OBJS)" | sed -e 's, \([a-z]\), ../\1,g' >stamp-objlist
615
77a164d8 616# We call this executable `xgcc' rather than `gcc'
617# to avoid confusion if the current directory is in the path
618# and CC is `gcc'. It is renamed to `gcc' when it is installed.
619xgcc: gcc.o version.o $(LIBDEPS)
620 $(CC) $(ALL_CFLAGS) $(LDFLAGS) -o xgcc gcc.o version.o $(LIBS)
840a6e8d 621
622# Dump a specs file to make -B./ read these specs over installed ones.
77a164d8 623specs: xgcc
c666179a 624 $(GCC_FOR_TARGET) -dumpspecs > specs
32e6d418 625
77a164d8 626# We do want to create an executable named `xgcc', so we can use it to
32e6d418 627# compile libgcc2.a.
628# Also create gcc-cross, so that install-common will install properly.
77a164d8 629gcc-cross: xgcc
630 cp xgcc gcc-cross
32e6d418 631
675fc1b6 632cc1: $(P) $(C_OBJS) $(OBJS) $(BC_OBJS) $(LIBDEPS)
649d8da6 633 $(CC) $(ALL_CFLAGS) $(LDFLAGS) -o cc1 $(C_OBJS) $(OBJS) $(BC_OBJS) $(LIBS)
32e6d418 634
675fc1b6 635cc1obj: $(P) $(OBJC_OBJS) $(OBJS) $(BC_OBJS) $(LIBDEPS)
649d8da6 636 $(CC) $(ALL_CFLAGS) $(LDFLAGS) -o cc1obj $(OBJC_OBJS) $(OBJS) $(BC_OBJS) $(LIBS)
32e6d418 637
2cfd79fe 638# Copy float.h from its source.
d82b9c93 639gfloat.h: $(FLOAT_H)
640 cp $(FLOAT_H) gfloat.h
2cfd79fe 641
642# Create float.h source for the native machine.
643float.h-nat: enquire
121c5e86 644 -./enquire -f > tmp-float.h
645 mv tmp-float.h float.h-nat
2cfd79fe 646
647# Create a dummy float.h source for a cross-compiler.
648float.h-cross:
649 echo "#error float.h values not known for cross-compiler" > float.h-cross
32e6d418 650
651# Used to compile enquire with standard cc, but have forgotten why.
652# Let's try with GCC.
653enquire: enquire.o $(GCC_PARTS)
13c6d959 654 $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(ENQUIRE_LDFLAGS) enquire.o -o enquire
25407fa4 655enquire.o: $(srcdir)/enquire.c $(GCC_PASSES) stmp-int-hdrs
1a754c64 656# -if [ "$(srcdir)" != "." ]; then rm -f ./enquire.c; else true; fi
657# -cp $(srcdir)/enquire.c . > /dev/null 2>&1
c6396a0b 658# Breaking this line caused a problem with one version of GNU make.
1a754c64 659 $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(ALL_CPPFLAGS) $(ENQUIRE_CFLAGS) -I. -c $(srcdir)/enquire.c
3f69fed5 660
661# Build the version of limits.h that we will install.
662xlimits.h: glimits.h limitx.h limity.h
663 if [ -f $(SYSTEM_HEADER_DIR)/limits.h ] ; then \
664 cat $(srcdir)/limitx.h $(srcdir)/glimits.h $(srcdir)/limity.h > xlimits.h; \
665 else \
666 cat $(srcdir)/glimits.h > xlimits.h; \
667 fi
32e6d418 668\f
669# Build libgcc.a.
670# This is done in two parts because some functions, in libgcc1.c,
77a164d8 671# must be compiled with something other than GCC,
672# while the rest, in libgcc2.c, must be compiled with xgcc.
673# That means we can't do libgcc2.c until after xgcc, cc1, etc.
32e6d418 674
675# Use this as value of LIBGCC1 to cause conversion to GNU library format.
676# LIBCONVERT should put its output in libgcc1.conv.
677libgcc1.conv: libgcc1.a
678 $(LIBCONVERT) libgcc1.a libgcc1.conv
679
680# Use this as value of LIBGCC1 to inhibit use of libgcc1.c entirely.
681# Make an empty file instead.
66e9b81a 682libgcc1.null: $(GCC_PASSES)
32e6d418 683 echo "__foo () {}" > dummy.c
684 $(GCC_FOR_TARGET) $(GCC_CFLAGS) -c dummy.c
685 $(OLDAR) $(OLDAR_FLAGS) libgcc1.null dummy.o
686 rm -f dummy.o dummy.c
687
fe918d35 688# This is $(LIBGCC1) for a cross-compiler.
689# We have no automatic way of building libgcc1.a,
690# so it's up to the installer to find a way to do that.
691# This rule deliberately does not depend on libgcc1.a
692# so that it will fail if the installer hasn't provided it.
693libgcc1.cross:
694 mv libgcc1.a libgcc1.cross || (echo You must find a way to make libgcc1.a; false)
695
32e6d418 696# Compile the library of arithmetic subroutines with the native compiler.
77a164d8 697# Don't compile it with GCC!
32e6d418 698# (That would cause most arithmetic functions to call themselves.)
699libgcc1.a: libgcc1.c $(CONFIG_H) $(LIB1FUNCS_EXTRA) config.status
700 -rm -f tmplibgcc1.a
701# Actually build it in tmplibgcc1.a, then rename at end,
702# so that libgcc1.a itself remains nonexistent if compilation is aborted.
703# -e causes any failing command to make this rule fail.
704# -e doesn't work in certain shells, so we test $$? as well.
547e1b60 705# lynx has a broken ar, it always complains when the initial library is
706# empty, thus this command works only if we don't do -e
707# There is a trailing backslash (\) deleted from the following line.
708# set -e;
32e6d418 709 for name in $(LIB1FUNCS); \
710 do \
711 echo $${name}; \
712 rm -f $${name}.o; \
713 $(OLDCC) $(CCLIBFLAGS) $(INCLUDES) -c -DL$${name} $(srcdir)/libgcc1.c; \
714 if [ $$? -eq 0 ] ; then true; else exit 1; fi; \
715 mv libgcc1.o $${name}.o; \
716 $(OLDAR) $(OLDAR_FLAGS) tmplibgcc1.a $${name}.o; \
717 rm -f $${name}.o; \
718 done
719# Some shells crash when a loop has no items.
720# So make sure there is always at least one--`..'.
721# Then ignore it.
722# We don't use -e here because there are if statements
723# that should not make the command give up when the if condition is false.
724# Instead, we test for failure after each command where it matters.
4daa2154 725 for file in .. $(LIB1FUNCS_EXTRA); \
32e6d418 726 do \
727 if [ x$${file} != x.. ]; then \
728 name=`echo $${file} | sed -e 's/[.]c$$//' -e 's/[.]asm$$//'`; \
729 echo $${name}; \
730 if [ $${name}.asm = $${file} ]; then \
f32abccb 731 cp $${file} $${name}.s || exit 1; file=$${name}.s; \
32e6d418 732 else true; fi; \
733 $(OLDCC) $(CCLIBFLAGS) $(INCLUDES) -c $${file}; \
734 if [ $$? -eq 0 ] ; then true; else exit 1; fi; \
735 $(OLDAR) $(OLDAR_FLAGS) tmplibgcc1.a $${name}.o; \
736 if [ $$? -eq 0 ] ; then true; else exit 1; fi; \
737 rm -f $${name}.[so]; \
738 else true; \
739 fi; \
740 done
741 mv tmplibgcc1.a libgcc1.a
742
cf80c04b 743# Build libgcc1.a from assembler source. LIB1ASMFUNCS is the list of
744# functions. LIB1ASMSRC is the name of the source file in the config
745# subdirectory.
746libgcc1-asm.a: libgcc2.ready config.status $(srcdir)/config/$(LIB1ASMSRC)
747 -rm -f tmplibgcc1.a libgcc1.S
748 cp $(srcdir)/config/$(LIB1ASMSRC) libgcc1.S
749# Actually build it in tmplibgcc1.a, then rename at end,
750# so that libgcc1-asm.a itself remains nonexistent if compilation is aborted.
751# -e causes any failing command to make this rule fail.
752# -e doesn't work in certain shells, so we test $$? as well.
753# lynx has a broken ar, it always complains when the initial library is
754# empty, thus this command works only if we don't do -e
755# There is a trailing backslash (\) deleted from the following line.
756# set -e;
757 for name in $(LIB1ASMFUNCS); \
758 do \
759 echo $${name}; \
760 $(GCC_FOR_TARGET) $(LIBGCC2_CFLAGS) $(INCLUDES) -c -DL$${name} libgcc1.S; \
761 if [ $$? -eq 0 ] ; then true; else exit 1; fi; \
762 mv libgcc1.o $${name}.o; \
763 $(AR) $(AR_FLAGS) tmplibgcc1.a $${name}.o; \
764 rm -f $${name}.o; \
765 done
766 -rm -f libgcc1.S
767 mv tmplibgcc1.a libgcc1-asm.a
768
32e6d418 769# Compiling libgcc2.a requires making sure that cc1, etc. have been compiled.
770# But recompiling cc1 should not force recompilation of libgcc2.a.
771# If you want to force recompilation, delete libgcc2.a.
732b8330 772libgcc2.ready: $(GCC_PASSES) $(LIBGCC2_DEPS) stmp-int-hdrs
32e6d418 773 -if [ -f libgcc2.ready ] ; then \
774 true; \
775 else \
776 touch libgcc2.ready; \
777 fi
778
779libgcc2.a: libgcc2.c libgcc2.ready $(CONFIG_H) $(LIB2FUNCS_EXTRA) \
33927595 780 machmode.h longlong.h gbl-ctors.h config.status
32e6d418 781# Actually build it in tmplibgcc2.a, then rename at end,
782# so that libgcc2.a itself remains nonexistent if compilation is aborted.
783 -rm -f tmplibgcc2.a
784# -e causes any failing command to make this rule fail.
785# -e doesn't work in certain shells, so we test $$? as well.
547e1b60 786# lynx has a broken ar, it always complains when the initial library is
787# empty, thus this command works only if we don't do -e
788# There is a trailing backslash (\) deleted from the following line.
789# set -e;
32e6d418 790 for name in $(LIB2FUNCS); \
791 do \
792 echo $${name}; \
c6396a0b 793 $(GCC_FOR_TARGET) $(LIBGCC2_CFLAGS) $(INCLUDES) -c -DL$${name} \
32e6d418 794 $(srcdir)/libgcc2.c -o $${name}.o; \
795 if [ $$? -eq 0 ] ; then true; else exit 1; fi; \
796 $(AR) $(AR_FLAGS) tmplibgcc2.a $${name}.o; \
797 rm -f $${name}.o; \
798 done
799# Some shells crash when a loop has no items.
800# So make sure there is always at least one--`..'.
801# Then ignore it.
802# We don't use -e here because there are if statements
803# that should not make the command give up when the if condition is false.
804# Instead, we test for failure after each command where it matters.
4daa2154 805 for file in .. $(LIB2FUNCS_EXTRA); \
32e6d418 806 do \
807 if [ x$${file} != x.. ]; then \
808 name=`echo $${file} | sed -e 's/[.]c$$//' -e 's/[.]asm$$//'`; \
809 echo $${name}; \
810 if [ $${name}.asm = $${file} ]; then \
f32abccb 811 cp $${file} $${name}.s || exit 1; file=$${name}.s; \
32e6d418 812 else true; fi; \
c6396a0b 813 $(GCC_FOR_TARGET) $(LIBGCC2_CFLAGS) $(INCLUDES) -c $${file}; \
32e6d418 814 if [ $$? -eq 0 ] ; then true; else exit 1; fi; \
815 $(AR) $(AR_FLAGS) tmplibgcc2.a $${name}.o; \
816 rm -f $${name}.[so]; \
817 else true; \
818 fi; \
819 done
820 mv tmplibgcc2.a libgcc2.a
821# These lines were deleted from above the mv command
822# because ranlibing libgcc.a itself should suffice.
823# -if [ x${HPUX_GAS} = x ] ; then \
824# if $(RANLIB_TEST) ; then $(RANLIB) tmplibgcc2.a; else true; fi \
825# else true; fi
826
827# Combine the various libraries into a single library, libgcc.a.
828libgcc.a: $(LIBGCC1) $(LIBGCC2)
829 -rm -rf tmplibgcc.a libgcc.a tmpcopy
830 mkdir tmpcopy
c6396a0b 831 -if [ x$(LIBGCC1) != x ]; \
832 then (cd tmpcopy; $(AR) x ../$(LIBGCC1)); \
833 else true; \
834 fi
edf5976e 835# Some versions of ar (specifically the one in RISC/os 5.x), create an
836# unwritable table of contents file, and then print an error message when
837# the second ar command tries to overwrite this file. To avoid the error
838# message from ar, we make sure all files are writable.
75c6d942 839 -(cd tmpcopy; chmod +w * > /dev/null 2>&1)
32e6d418 840 (cd tmpcopy; $(AR) x ../$(LIBGCC2))
841 (cd tmpcopy; $(AR) $(AR_FLAGS) ../tmplibgcc.a *.o)
842 rm -rf tmpcopy
843 -if $(RANLIB_TEST) ; then $(RANLIB) tmplibgcc.a; else true; fi
844# Actually build it in tmplibgcc.a, then rename at end,
845# so that libgcc.a itself remains nonexistent if compilation is aborted.
846 mv tmplibgcc.a libgcc.a
847
f1ad3130 848# Use the genmultilib shell script to generate the information the gcc
849# driver program needs to select the library directory based on the
850# switches.
851multilib.h: $(srcdir)/genmultilib config.status
852 $(SHELL) $(srcdir)/genmultilib "$(MULTILIB_OPTIONS)" \
853 "$(MULTILIB_DIRNAMES)" "$(MULTILIB_MATCHES)" > multilib.h
854
855# Build multiple copies of libgcc.a, one for each target switch.
856stmp-multilib: $(LIBGCC1) libgcc2.c libgcc2.ready $(CONFIG_H) \
857 $(LIB2FUNCS_EXTRA) machmode.h longlong.h gbl-ctors.h config.status
858 for i in `$(GCC_FOR_TARGET) --print-multi-lib`; do \
859 dir=`echo $$i | sed -e 's/;.*$$//'`; \
860 flags=`echo $$i | sed -e 's/^[^;]*;//' -e 's/@/ -/g'`; \
861 rm -f $${dir}/libgcc.a $(LIBGCC2); \
862 $(MAKE) GCC_FOR_TARGET="$(GCC_FOR_TARGET)" \
863 AR="$(AR)" AR_FLAGS="$(AR_FLAGS)" \
864 HOST_PREFIX="$(HOST_PREFIX)" HOST_PREFIX_1="$(HOST_PREFIX_1)" \
865 LIBGCC2_CFLAGS="$(LIBGCC2_CFLAGS) $${flags}" $(LIBGCC2); \
866 if [ $$? -eq 0 ] ; then true; else exit 1; fi; \
867 if [ x$(LIBGCC1) != xlibgcc1-asm.a ]; \
868 then true; \
869 else (rm -f $(LIBGCC1); \
870 $(MAKE) GCC_FOR_TARGET="$(GCC_FOR_TARGET)" \
871 AR="$(AR)" AR_FLAGS="$(AR_FLAGS)" \
872 HOST_PREFIX="$(HOST_PREFIX)" \
873 HOST_PREFIX_1="$(HOST_PREFIX_1)" \
874 LIBGCC2_CFLAGS="$(LIBGCC2_CFLAGS) $${flags}" $(LIBGCC1) ) \
875 fi; \
876 if [ $$? -eq 0 ] ; then true; else exit 1; fi; \
877 rm -rf tmpcopy; \
878 mkdir tmpcopy; \
879 if [ x$(LIBGCC1) != x ]; \
880 then (cd tmpcopy; $(AR) x ../$(LIBGCC1)); \
881 else true; \
882 fi; \
883 (cd tmpcopy; $(AR) x ../$(LIBGCC2)); \
884 (cd tmpcopy; $(AR) $(AR_FLAGS) ../tmplibgcc.a *.o); \
885 rm -rf libgcc2.a tmpcopy; \
886 if $(RANLIB_TEST) ; then $(RANLIB) tmplibgcc.a; else true; fi; \
887 if [ -d $${dir} ]; then true; else mkdir $${dir}; fi; \
888 mv tmplibgcc.a $${dir}/libgcc.a; \
889 done
890 touch stmp-multilib
891
4f1fd857 892objc-runtime: libobjc.a
893
bd594491 894# Build the Objective C runtime library.
732b8330 895libobjc.a: cc1obj stmp-int-hdrs libgcc2.ready $(USE_COLLECT2) $(EXTRA_PARTS)
d6518ea8 896 if [ -d objc ]; then true; else mkdir objc; fi
4f1fd857 897 thisdir1=`pwd`; \
e5190fd1 898 srcdir1=`cd $(srcdir); pwd`; \
4f1fd857 899 cd objc; \
72bce1c3 900 $(MAKE) -f $${srcdir1}/objc/Makefile libobjc.a \
901 srcdir=$${srcdir1} tooldir=$(tooldir) AR="$(AR)" AR_FLAGS="$(AR_FLAGS)" \
902 GCC_FOR_TARGET="$${thisdir1}/xgcc -B$${thisdir1}/" \
4f1fd857 903 GCC_CFLAGS="$(GCC_CFLAGS)"
553479e8 904 -rm -f libobjc.a
8281617f 905 ln objc/libobjc.a . >/dev/null 2>&1 || cp objc/libobjc.a .
4f1fd857 906 -if $(RANLIB_TEST) ; then $(RANLIB) libobjc.a; else true; fi
907
908# This is used by objc/Makefile if the user runs that directly.
732b8330 909sublibobjc.a: cc1obj stmp-int-hdrs libgcc2.ready
e5190fd1 910 thisdir1=`pwd`; \
911 srcdir1=`cd $(srcdir); pwd`; \
912 cd objc; \
553479e8 913 $(MAKE) -f $$srcdir1/objc/Makefile libobjc.a \
e5190fd1 914 srcdir=$$srcdir1 tooldir=$(tooldir) AR="$(AR)" AR_FLAGS="$(AR_FLAGS)" \
915 GCC_FOR_TARGET="$$thisdir1/xgcc -B$$thisdir1/" \
916 GCC_CFLAGS="$(GCC_CFLAGS)"
32e6d418 917
918# Compile two additional files that are linked with every program
919# linked using GCC on system V, for the sake of C++ constructors.
920crtbegin.o: crtstuff.c $(GCC_PASSES) $(CONFIG_H) gbl-ctors.h
921 $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(INCLUDES) -DCRT_BEGIN \
7bb7a2e8 922 -finhibit-size-directive -fno-inline-functions \
923 -g0 -c $(srcdir)/crtstuff.c -o crtbegin.o
32e6d418 924
925crtend.o: crtstuff.c $(GCC_PASSES) $(CONFIG_H) gbl-ctors.h
926 $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(INCLUDES) -DCRT_END \
7bb7a2e8 927 -finhibit-size-directive -fno-inline-functions \
928 -g0 -c $(srcdir)/crtstuff.c -o crtend.o
32e6d418 929\f
930# Compiling object files from source files.
931
932# Note that dependencies on obstack.h are not written
933# because that file is not part of GCC.
32e6d418 934
935# C language specific files.
936
f678532a 937c-parse.o : $(srcdir)/c-parse.c $(CONFIG_H) $(TREE_H) c-lex.h c-parse.h \
938 c-tree.h input.h flags.h
32e6d418 939 $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) -c $(srcdir)/c-parse.c
ab2562cb 940$(srcdir)/c-parse.c $(srcdir)/c-parse.h: $(srcdir)/c-parse.y
941 cd $(srcdir); $(BISON) $(BISONFLAGS) -d c-parse.y -o c-parse.c
d7c691fa 942$(srcdir)/c-parse.y: $(srcdir)/c-parse.in
943 sed -e "/^ifobjc$$/,/^end ifobjc$$/d" \
944 -e "/^ifc$$/d" -e "/^end ifc$$/d" \
a58045a1 945 $(srcdir)/c-parse.in >tmp-c-parse.y
946 $(srcdir)/move-if-change tmp-c-parse.y $(srcdir)/c-parse.y
d7c691fa 947
6a4a0b58 948$(srcdir)/c-gperf.h: $(srcdir)/c-parse.gperf
949 gperf -p -j1 -i 1 -g -o -t -G -N is_reserved_word -k1,3,$$ \
a58045a1 950 $(srcdir)/c-parse.gperf >tmp-gperf.h
951 $(srcdir)/move-if-change tmp-gperf.h $(srcdir)/c-gperf.h
6a4a0b58 952
32e6d418 953c-decl.o : c-decl.c $(CONFIG_H) $(TREE_H) c-tree.h c-lex.h flags.h
954c-typeck.o : c-typeck.c $(CONFIG_H) $(TREE_H) c-tree.h flags.h
955c-lang.o : c-lang.c $(CONFIG_H) $(TREE_H)
956c-lex.o : c-lex.c $(CONFIG_H) $(TREE_H) c-lex.h c-tree.h c-parse.h \
6a4a0b58 957 input.h flags.h c-gperf.h
32e6d418 958c-aux-info.o : c-aux-info.c $(CONFIG_H) $(TREE_H) c-tree.h flags.h
959c-convert.o : c-convert.c $(CONFIG_H) $(TREE_H) flags.h
b3781cc4 960c-pragma.o: c-pragma.c $(CONFIG_H) $(TREE_H)
1294913b 961c-iterate.o: c-iterate.c $(CONFIG_H) $(TREE_H) $(RTL_H) c-tree.h flags.h
32e6d418 962
79f818d0 963# To make a configuration always use collect2, set USE_COLLECT2 to ld.
964ld: collect2
965 rm -f ld
966 ln collect2 ld
967
32e6d418 968collect2 : collect2.o version.o $(LIBDEPS)
e77fd588 969# Don't try modifying collect2 (aka ld) in place--it might be linking this.
970 -rm -f collect2
32e6d418 971 $(CC) $(ALL_CFLAGS) $(LDFLAGS) -o collect2 collect2.o version.o $(LIBS)
972
973collect2.o : collect2.c $(CONFIG_H) gstab.h
5e03c63d 974 $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \
975 -DTARGET_MACHINE=\"$(target)\" \
976 -c `echo $(srcdir)/collect2.c | sed 's,^\./,,'`
32e6d418 977
8dff2b2b 978# Objective C language specific files.
32e6d418 979
980objc-parse.o : $(srcdir)/objc-parse.c $(CONFIG_H) $(TREE_H) c-lex.h \
222e139b 981 c-tree.h input.h flags.h objc-act.h
32e6d418 982 $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) -c $(srcdir)/objc-parse.c
983$(srcdir)/objc-parse.c : $(srcdir)/objc-parse.y
984 cd $(srcdir); $(BISON) $(BISONFLAGS) objc-parse.y -o objc-parse.c
ab2562cb 985$(srcdir)/objc-parse.y: $(srcdir)/c-parse.in
986 sed -e "/^ifc$$/,/^end ifc$$/d" \
987 -e "/^ifobjc$$/d" -e "/^end ifobjc$$/d" \
a58045a1 988 $(srcdir)/c-parse.in >tmp-objc-parse.y
989 $(srcdir)/move-if-change tmp-objc-parse.y $(srcdir)/objc-parse.y
32e6d418 990
7c4f0e88 991objc-act.o : objc-act.c $(CONFIG_H) $(TREE_H) $(RTL_H) c-tree.h c-lex.h \
992 flags.h objc-act.h input.h function.h $(srcdir)/c-parse.h
32e6d418 993
994# A file used by all variants of C.
995
996c-common.o : c-common.c $(CONFIG_H) $(TREE_H) c-tree.h c-lex.h flags.h
997
998# Language-independent files.
999
f1ad3130 1000gcc.o: gcc.c $(CONFIG_H) multilib.h config.status
32e6d418 1001 $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \
1002 -DSTANDARD_STARTFILE_PREFIX=\"$(libdir)/\" \
c6396a0b 1003 -DSTANDARD_EXEC_PREFIX=\"$(libdir)/gcc-lib/\" \
7df9e578 1004 -DDEFAULT_TARGET_VERSION=\"$(version)\" \
32e6d418 1005 -DDEFAULT_TARGET_MACHINE=\"$(target)\" \
556d8d24 1006 -DTOOLDIR_BASE_PREFIX=\"$(exec_prefix)/\" \
8618ef50 1007 $(MAYBE_TARGET_DEFAULT) \
32e6d418 1008 -c `echo $(srcdir)/gcc.c | sed 's,^\./,,'`
1009
1010dumpvers: dumpvers.c
1011
1012version.o: version.c
1013obstack.o: obstack.c
1014
beb68ac1 1015convert.o: convert.c $(CONFIG_H) $(TREE_H) flags.h convert.h
1016
335ebf8f 1017tree.o : tree.c $(CONFIG_H) $(TREE_H) flags.h function.h
32e6d418 1018print-tree.o : print-tree.c $(CONFIG_H) $(TREE_H)
1019stor-layout.o : stor-layout.c $(CONFIG_H) $(TREE_H) function.h
1020fold-const.o : fold-const.c $(CONFIG_H) $(TREE_H) flags.h
c6396a0b 1021toplev.o : toplev.c $(CONFIG_H) $(TREE_H) $(RTL_H) flags.h input.h \
aadb7c33 1022 insn-attr.h xcoffout.h defaults.h
79f818d0 1023 $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \
fe918d35 1024 $(MAYBE_TARGET_DEFAULT) $(MAYBE_USE_COLLECT2) \
1025 -c `echo $(srcdir)/toplev.c | sed 's,^\./,,'`
32e6d418 1026
1027rtl.o : rtl.c $(CONFIG_H) $(RTL_H)
1028
1029print-rtl.o : print-rtl.c $(CONFIG_H) $(RTL_H)
1030rtlanal.o : rtlanal.c $(CONFIG_H) $(RTL_H)
1031
832bfff4 1032toplev.o: bytecode.h bc-emit.h
35325097 1033varasm.o : varasm.c $(CONFIG_H) $(TREE_H) $(RTL_H) flags.h function.h \
832bfff4 1034 defaults.h insn-codes.h expr.h hard-reg-set.h regs.h xcoffout.h bytecode.h
32e6d418 1035function.o : function.c $(CONFIG_H) $(RTL_H) $(TREE_H) flags.h function.h \
1036 insn-flags.h insn-codes.h expr.h regs.h hard-reg-set.h insn-config.h \
832bfff4 1037 recog.h output.h bytecode.h
32e6d418 1038stmt.o : stmt.c $(CONFIG_H) $(RTL_H) $(TREE_H) flags.h function.h \
da98194a 1039 insn-flags.h insn-config.h insn-codes.h hard-reg-set.h expr.h loop.h \
e83ee760 1040 recog.h bytecode.h bc-typecd.h bc-typecd.def bc-opcode.h bc-optab.h \
1041 bc-emit.h
93ad9ce9 1042expr.o : expr.c $(CONFIG_H) $(RTL_H) $(TREE_H) flags.h function.h regs.h \
e83ee760 1043 insn-flags.h insn-codes.h expr.h insn-config.h recog.h output.h \
1044 typeclass.h bytecode.h bc-opcode.h bc-typecd.h bc-typecd.def bc-optab.h \
1045 bc-emit.h modemap.def
32e6d418 1046calls.o : calls.c $(CONFIG_H) $(RTL_H) $(TREE_H) flags.h expr.h insn-codes.h \
335ebf8f 1047 insn-flags.h
32e6d418 1048expmed.o : expmed.c $(CONFIG_H) $(RTL_H) $(TREE_H) flags.h \
1049 insn-flags.h insn-config.h insn-codes.h expr.h recog.h real.h
1050explow.o : explow.c $(CONFIG_H) $(RTL_H) $(TREE_H) flags.h hard-reg-set.h \
1051 insn-config.h expr.h recog.h insn-flags.h insn-codes.h
1052optabs.o : optabs.c $(CONFIG_H) $(RTL_H) $(TREE_H) flags.h \
a8a33ff5 1053 insn-flags.h insn-config.h insn-codes.h expr.h recog.h reload.h
32e6d418 1054dbxout.o : dbxout.c $(CONFIG_H) $(TREE_H) $(RTL_H) flags.h regs.h \
e7748130 1055 insn-config.h reload.h gstab.h xcoffout.h defaults.h output.h
32e6d418 1056sdbout.o : sdbout.c $(CONFIG_H) $(TREE_H) $(RTL_H) gsyms.h flags.h \
1057 insn-config.h reload.h
1058dwarfout.o : dwarfout.c $(CONFIG_H) $(TREE_H) $(RTL_H) dwarf.h flags.h \
8a19d0d5 1059 insn-config.h reload.h output.h defaults.h
79f818d0 1060xcoffout.o : xcoffout.c $(CONFIG_H) $(TREE_H) $(RTL_H) xcoffout.h flags.h
335ebf8f 1061emit-rtl.o : emit-rtl.c $(CONFIG_H) $(RTL_H) $(TREE_H) flags.h \
5e93c400 1062 function.h regs.h insn-config.h insn-codes.h real.h expr.h bytecode.h \
1063 bc-opcode.h bc-typecd.h bc-typecd.def bc-optab.h bc-emit.h bc-opname.h
6d9f2c4c 1064real.o : real.c $(CONFIG_H) $(TREE_H)
c6396a0b 1065getpwd.o : getpwd.c $(CONFIG_H)
32e6d418 1066
1067integrate.o : integrate.c $(CONFIG_H) $(RTL_H) $(TREE_H) flags.h integrate.h \
832bfff4 1068 insn-flags.h insn-config.h insn-codes.h expr.h real.h function.h \
1069 bytecode.h
32e6d418 1070
1071jump.o : jump.c $(CONFIG_H) $(RTL_H) flags.h hard-reg-set.h regs.h \
1072 insn-config.h insn-flags.h insn-codes.h expr.h real.h
1073stupid.o : stupid.c $(CONFIG_H) $(RTL_H) regs.h hard-reg-set.h flags.h
1074
1075cse.o : cse.c $(CONFIG_H) $(RTL_H) regs.h hard-reg-set.h flags.h real.h \
1076 insn-config.h recog.h
1077loop.o : loop.c $(CONFIG_H) $(RTL_H) flags.h loop.h insn-config.h \
1078 insn-flags.h insn-codes.h regs.h hard-reg-set.h recog.h expr.h real.h
1079unroll.o : unroll.c $(CONFIG_H) $(RTL_H) insn-config.h insn-codes.h \
1080 integrate.h regs.h flags.h expr.h loop.h
1081flow.o : flow.c $(CONFIG_H) $(RTL_H) flags.h insn-config.h \
1082 basic-block.h regs.h hard-reg-set.h output.h
335ebf8f 1083combine.o : combine.c $(CONFIG_H) $(RTL_H) flags.h \
32e6d418 1084 insn-config.h insn-flags.h insn-codes.h insn-attr.h regs.h expr.h \
f0a903c4 1085 basic-block.h recog.h real.h hard-reg-set.h
32e6d418 1086regclass.o : regclass.c $(CONFIG_H) $(RTL_H) hard-reg-set.h flags.h \
832bfff4 1087 basic-block.h regs.h insn-config.h recog.h reload.h real.h bytecode.h
32e6d418 1088local-alloc.o : local-alloc.c $(CONFIG_H) $(RTL_H) flags.h basic-block.h \
1089 regs.h hard-reg-set.h insn-config.h recog.h output.h
8a4b1e01 1090global.o : global.c $(CONFIG_H) $(RTL_H) flags.h \
32e6d418 1091 basic-block.h regs.h hard-reg-set.h insn-config.h output.h
1092
1093reload.o : reload.c $(CONFIG_H) $(RTL_H) flags.h \
1094 reload.h recog.h hard-reg-set.h insn-config.h insn-codes.h regs.h real.h
1095reload1.o : reload1.c $(CONFIG_H) $(RTL_H) flags.h expr.h \
1096 reload.h regs.h hard-reg-set.h insn-config.h insn-flags.h insn-codes.h \
1097 basic-block.h recog.h output.h
1098caller-save.o : caller-save.c $(CONFIG_H) $(RTL_H) flags.h \
1099 regs.h hard-reg-set.h insn-config.h basic-block.h recog.h reload.h expr.h
1100reorg.o : reorg.c $(CONFIG_H) $(RTL_H) conditions.h hard-reg-set.h \
1101 basic-block.h regs.h insn-config.h insn-attr.h insn-flags.h recog.h \
1102 flags.h output.h
1103sched.o : sched.c $(CONFIG_H) $(RTL_H) basic-block.h regs.h hard-reg-set.h \
1104 flags.h insn-config.h insn-attr.h
335ebf8f 1105final.o : final.c $(CONFIG_H) $(RTL_H) $(TREE_H) flags.h regs.h \
32e6d418 1106 recog.h conditions.h insn-config.h insn-attr.h real.h output.h \
fe918d35 1107 hard-reg-set.h insn-flags.h insn-codes.h gstab.h xcoffout.h defaults.h
32e6d418 1108recog.o : recog.c $(CONFIG_H) $(RTL_H) \
1109 regs.h recog.h hard-reg-set.h flags.h insn-config.h insn-attr.h \
1110 insn-flags.h insn-codes.h real.h
1111reg-stack.o : reg-stack.c $(CONFIG_H) $(RTL_H) $(TREE_H) \
1112 regs.h hard-reg-set.h flags.h insn-config.h
48c6936b 1113
32e6d418 1114aux-output.o : aux-output.c $(CONFIG_H) \
1115 $(RTL_H) regs.h hard-reg-set.h real.h insn-config.h conditions.h \
1116 insn-flags.h output.h insn-attr.h insn-codes.h
1117
f213fcf9 1118# Build auxiliary files that support ecoff format.
1119mips-tfile: mips-tfile.o version.o $(LIBDEPS)
1120 $(CC) $(CFLAGS) $(LDFLAGS) -o mips-tfile mips-tfile.o version.o $(LIBS)
1121
1122mips-tfile.o : mips-tfile.c $(CONFIG_H) $(RTL_H)
1123
1124mips-tdump: mips-tdump.o version.o $(LIBDEPS)
1125 $(CC) $(CFLAGS) $(LDFLAGS) -o mips-tdump mips-tdump.o version.o $(LIBS)
1126
1127mips-tdump.o : mips-tdump.c $(CONFIG_H) $(RTL_H)
1128
636b182c 1129# Build file to support OSF/rose half-pic format.
1130halfpic.o: halfpic.c $(CONFIG_H) $(RTL_H) $(TREE_H)
1131
32e6d418 1132# Normally this target is not used; but it is used if you
1133# define ALLOCA=alloca.o. In that case, you must get a suitable alloca.c
1134# from the GNU Emacs distribution.
32e6d418 1135alloca.o: alloca.c
32e6d418 1136 $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $(ALLOCA_FLAGS) \
cc2af6ca 1137 -c `echo $(srcdir)/alloca.c | sed 's,^\./,,'`
32e6d418 1138 $(ALLOCA_FINISH)
1139\f
1140# Generate header and source files from the machine description,
1141# and compile them.
1142
1143.PRECIOUS: insn-config.h insn-flags.h insn-codes.h \
1144 insn-emit.c insn-recog.c insn-extract.c insn-output.c insn-peep.c \
1145 insn-attr.h insn-attrtab.c
1146
1147# The following pair of rules has this effect:
1148# genconfig is run only if the md has changed since genconfig was last run;
1149# but the file insn-config.h is touched only when its contents actually change.
1150
1151# Each of the other insn-* files is handled by a similar pair of rules.
1152
3f69fed5 1153# This causes an anomaly in the results of make -n
1154# because insn-* is older than stamp-*
1155# and thus make -n thinks that insn-* will be updated
1156# and force recompilation of things that depend on it.
9ac790c5 1157# We use move-if-change precisely to avoid such recompilation.
3f69fed5 1158# But there is no way to teach make -n that it will be avoided.
1159
32e6d418 1160# Each of the insn-*.[ch] rules has a semicolon at the end,
1161# for otherwise the system Make on SunOS 4.1 never tries
876dc5b0 1162# to recompile insn-*.o. To avoid problems and extra noise from
1163# versions of make which don't like empty commands (nothing after the
1164# trailing `;'), we call true for each.
32e6d418 1165
c2a18965 1166insn-config.h: stamp-config ; @true
32e6d418 1167stamp-config : md genconfig $(srcdir)/move-if-change
1168 ./genconfig md > tmp-config.h
1169 $(srcdir)/move-if-change tmp-config.h insn-config.h
1170 touch stamp-config
1171
c2a18965 1172insn-flags.h: stamp-flags ; @true
32e6d418 1173stamp-flags : md genflags $(srcdir)/move-if-change
1174 ./genflags md > tmp-flags.h
1175 $(srcdir)/move-if-change tmp-flags.h insn-flags.h
1176 touch stamp-flags
1177
c2a18965 1178insn-codes.h: stamp-codes ; @true
32e6d418 1179stamp-codes : md gencodes $(srcdir)/move-if-change
1180 ./gencodes md > tmp-codes.h
1181 $(srcdir)/move-if-change tmp-codes.h insn-codes.h
1182 touch stamp-codes
1183
1184insn-emit.o : insn-emit.c $(CONFIG_H) $(RTL_H) expr.h real.h output.h \
1185 insn-config.h insn-flags.h insn-codes.h
1186 $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) -c insn-emit.c
1187
c2a18965 1188insn-emit.c: stamp-emit ; @true
32e6d418 1189stamp-emit : md genemit $(srcdir)/move-if-change
1190 ./genemit md > tmp-emit.c
1191 $(srcdir)/move-if-change tmp-emit.c insn-emit.c
1192 touch stamp-emit
1193
1194insn-recog.o : insn-recog.c $(CONFIG_H) $(RTL_H) insn-config.h recog.h \
1195 real.h output.h flags.h
1196 $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) -c insn-recog.c
1197
c2a18965 1198insn-recog.c: stamp-recog ; @true
32e6d418 1199stamp-recog : md genrecog $(srcdir)/move-if-change
1200 ./genrecog md > tmp-recog.c
1201 $(srcdir)/move-if-change tmp-recog.c insn-recog.c
1202 touch stamp-recog
1203
bdb66cef 1204insn-opinit.o : insn-opinit.c $(CONFIG_H) $(RTL_H) insn-codes.h insn-flags.h \
1205 insn-config.h flags.h rtl.h recog.h expr.h reload.h
1206 $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) -c insn-opinit.c
1207
1208insn-opinit.c: stamp-opinit ; @true
1209stamp-opinit : md genopinit $(srcdir)/move-if-change
1210 ./genopinit md > tmp-opinit.c
1211 $(srcdir)/move-if-change tmp-opinit.c insn-opinit.c
1212 touch stamp-opinit
1213
32e6d418 1214insn-extract.o : insn-extract.c $(CONFIG_H) $(RTL_H)
1215 $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) -c insn-extract.c
1216
c2a18965 1217insn-extract.c: stamp-extract ; @true
32e6d418 1218stamp-extract : md genextract $(srcdir)/move-if-change
1219 ./genextract md > tmp-extract.c
1220 $(srcdir)/move-if-change tmp-extract.c insn-extract.c
1221 touch stamp-extract
1222
1223insn-peep.o : insn-peep.c $(CONFIG_H) $(RTL_H) regs.h output.h real.h
1224 $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) -c insn-peep.c
1225
c2a18965 1226insn-peep.c: stamp-peep ; @true
32e6d418 1227stamp-peep : md genpeep $(srcdir)/move-if-change
1228 ./genpeep md > tmp-peep.c
1229 $(srcdir)/move-if-change tmp-peep.c insn-peep.c
1230 touch stamp-peep
1231
1232insn-attrtab.o : insn-attrtab.c $(CONFIG_H) $(RTL_H) regs.h real.h output.h \
1233 insn-attr.h insn-config.h
1234 $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) -c insn-attrtab.c
1235
c2a18965 1236insn-attr.h: stamp-attr ; @true
32e6d418 1237stamp-attr : md genattr $(srcdir)/move-if-change
1238 ./genattr md > tmp-attr.h
1239 $(srcdir)/move-if-change tmp-attr.h insn-attr.h
1240 touch stamp-attr
1241
c2a18965 1242insn-attrtab.c: stamp-attrtab ; @true
32e6d418 1243stamp-attrtab : md genattrtab $(srcdir)/move-if-change
8bd8ea06 1244 if cmp -s $(PREMADE_ATTRTAB_MD) md; \
1245 then \
1246 echo Using $(PREMADE_ATTRTAB); \
ab866dde 1247 cp $(PREMADE_ATTRTAB) tmp-attrtab.c; \
8bd8ea06 1248 else \
1249 ./genattrtab md > tmp-attrtab.c; \
1250 fi
32e6d418 1251 $(srcdir)/move-if-change tmp-attrtab.c insn-attrtab.c
1252 touch stamp-attrtab
1253
1254insn-output.o : insn-output.c $(CONFIG_H) $(RTL_H) regs.h real.h conditions.h \
1255 hard-reg-set.h insn-config.h insn-flags.h insn-attr.h output.h recog.h \
1256 insn-codes.h
1257 $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) -c insn-output.c
1258
c2a18965 1259insn-output.c: stamp-output ; @true
32e6d418 1260stamp-output : md genoutput $(srcdir)/move-if-change
1261 ./genoutput md > tmp-output.c
1262 $(srcdir)/move-if-change tmp-output.c insn-output.c
1263 touch stamp-output
1264\f
1265# Compile the programs that generate insn-* from the machine description.
1266# They are compiled with $(HOST_CC), and associated libraries,
1267# since they need to run on this machine
1268# even if GCC is being compiled to run on some other machine.
1269
1270# $(CONFIG_H) is omitted from the deps of the gen*.o
1271# because these programs don't really depend on anything
1272# about the target machine. They do depend on config.h itself,
1273# since that describes the host machine.
1274
89e36a04 1275# Pass the md file through cpp if the target requests it.
2c352995 1276$(MD_FILE): $(MD_DEPS)
1277 rm -f $@
1278 $(MD_CPP) $(MD_CPPFLAGS) md.pre-cpp | sed 's/^# /; /g' > $@
89e36a04 1279
32e6d418 1280genconfig : genconfig.o $(HOST_RTL) $(HOST_LIBDEPS)
1281 $(HOST_CC) $(HOST_CFLAGS) $(HOST_LDFLAGS) -o genconfig \
1282 genconfig.o $(HOST_RTL) $(HOST_LIBS)
1283
e77fd588 1284genconfig.o : genconfig.c $(RTL_H) hconfig.h
32e6d418 1285 $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(srcdir)/genconfig.c
1286
1287genflags : genflags.o $(HOST_RTL) $(HOST_LIBDEPS)
1288 $(HOST_CC) $(HOST_CFLAGS) $(HOST_LDFLAGS) -o genflags \
1289 genflags.o $(HOST_RTL) $(HOST_LIBS)
1290
e77fd588 1291genflags.o : genflags.c $(RTL_H) hconfig.h
32e6d418 1292 $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(srcdir)/genflags.c
1293
1294gencodes : gencodes.o $(HOST_RTL) $(HOST_LIBDEPS)
1295 $(HOST_CC) $(HOST_CFLAGS) $(HOST_LDFLAGS) -o gencodes \
1296 gencodes.o $(HOST_RTL) $(HOST_LIBS)
1297
e77fd588 1298gencodes.o : gencodes.c $(RTL_H) hconfig.h
32e6d418 1299 $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(srcdir)/gencodes.c
1300
1301genemit : genemit.o $(HOST_RTL) $(HOST_LIBDEPS)
1302 $(HOST_CC) $(HOST_CFLAGS) $(HOST_LDFLAGS) -o genemit \
1303 genemit.o $(HOST_RTL) $(HOST_LIBS)
1304
e77fd588 1305genemit.o : genemit.c $(RTL_H) hconfig.h
32e6d418 1306 $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(srcdir)/genemit.c
1307
bdb66cef 1308genopinit : genopinit.o $(HOST_RTL) $(HOST_LIBDEPS)
1309 $(HOST_CC) $(HOST_CFLAGS) $(HOST_LDFLAGS) -o genopinit \
1310 genopinit.o $(HOST_RTL) $(HOST_LIBS)
1311
1312genopinit.o : genopinit.c $(RTL_H) hconfig.h
1313 $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(srcdir)/genopinit.c
1314
32e6d418 1315genrecog : genrecog.o $(HOST_RTL) $(HOST_LIBDEPS)
1316 $(HOST_CC) $(HOST_CFLAGS) $(HOST_LDFLAGS) -o genrecog \
1317 genrecog.o $(HOST_RTL) $(HOST_LIBS)
1318
e77fd588 1319genrecog.o : genrecog.c $(RTL_H) hconfig.h
32e6d418 1320 $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(srcdir)/genrecog.c
1321
1322genextract : genextract.o $(HOST_RTL) $(HOST_LIBDEPS)
1323 $(HOST_CC) $(HOST_CFLAGS) $(HOST_LDFLAGS) -o genextract \
1324 genextract.o $(HOST_RTL) $(HOST_LIBS)
1325
e77fd588 1326genextract.o : genextract.c $(RTL_H) hconfig.h insn-config.h
32e6d418 1327 $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(srcdir)/genextract.c
1328
1329genpeep : genpeep.o $(HOST_RTL) $(HOST_LIBDEPS)
1330 $(HOST_CC) $(HOST_CFLAGS) $(HOST_LDFLAGS) -o genpeep \
1331 genpeep.o $(HOST_RTL) $(HOST_LIBS)
1332
e77fd588 1333genpeep.o : genpeep.c $(RTL_H) hconfig.h
32e6d418 1334 $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(srcdir)/genpeep.c
1335
1336genattr : genattr.o $(HOST_RTL) $(HOST_LIBDEPS)
1337 $(HOST_CC) $(HOST_CFLAGS) $(HOST_LDFLAGS) -o genattr \
1338 genattr.o $(HOST_RTL) $(HOST_LIBS)
1339
e77fd588 1340genattr.o : genattr.c $(RTL_H) hconfig.h
32e6d418 1341 $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(srcdir)/genattr.c
1342
262d46de 1343genattrtab : genattrtab.o $(HOST_RTL) $(HOST_PRINT) $(HOST_RTLANAL) $(HOST_LIBDEPS)
32e6d418 1344 $(HOST_CC) $(HOST_CFLAGS) $(HOST_LDFLAGS) -o genattrtab \
262d46de 1345 genattrtab.o $(HOST_RTL) $(HOST_PRINT) $(HOST_RTLANAL) $(HOST_LIBS)
32e6d418 1346
e77fd588 1347genattrtab.o : genattrtab.c $(RTL_H) hconfig.h insn-config.h
32e6d418 1348 $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(srcdir)/genattrtab.c
1349
1350genoutput : genoutput.o $(HOST_RTL) $(HOST_LIBDEPS)
1351 $(HOST_CC) $(HOST_CFLAGS) $(HOST_LDFLAGS) -o genoutput \
1352 genoutput.o $(HOST_RTL) $(HOST_LIBS)
1353
e77fd588 1354genoutput.o : genoutput.c $(RTL_H) hconfig.h
32e6d418 1355 $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(srcdir)/genoutput.c
1356\f
1357# Compile the libraries to be used by gen*.
1358# If we are not cross-building, gen* use the same .o's that cc1 will use,
1359# and HOST_PREFIX_1 is `foobar', just to ensure these rules don't conflict
1360# with the rules for rtl.o, alloca.o, etc.
1361$(HOST_PREFIX_1)rtl.o: $(srcdir)/rtl.c $(CONFIG_H) $(RTL_H)
1362 rm -f $(HOST_PREFIX)rtl.c
e77fd588 1363 sed -e 's/config[.]h/hconfig.h/' $(srcdir)/rtl.c > $(HOST_PREFIX)rtl.c
32e6d418 1364 $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(HOST_PREFIX)rtl.c
1365
262d46de 1366$(HOST_PREFIX_1)print-rtl.o: $(srcdir)/print-rtl.c $(CONFIG_H) $(RTL_H)
1367 rm -f $(HOST_PREFIX)print-rtl.c
e77fd588 1368 sed -e 's/config[.]h/hconfig.h/' $(srcdir)/print-rtl.c > $(HOST_PREFIX)print-rtl.c
262d46de 1369 $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(HOST_PREFIX)print-rtl.c
1370
32e6d418 1371$(HOST_PREFIX_1)rtlanal.o: $(srcdir)/rtlanal.c $(CONFIG_H) $(RTL_H)
1372 rm -f $(HOST_PREFIX)rtlanal.c
e77fd588 1373 sed -e 's/config[.]h/hconfig.h/' $(srcdir)/rtlanal.c > $(HOST_PREFIX)rtlanal.c
32e6d418 1374 $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(HOST_PREFIX)rtlanal.c
1375
1376$(HOST_PREFIX_1)alloca.o: alloca.c
1377 rm -f $(HOST_PREFIX)alloca.c
1378 cp $(srcdir)/alloca.c $(HOST_PREFIX)alloca.c
1379 $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(HOST_PREFIX)alloca.c
1380
1381$(HOST_PREFIX_1)obstack.o: obstack.c
1382 rm -f $(HOST_PREFIX)obstack.c
e77fd588 1383 sed -e 's/config[.]h/hconfig.h/' $(srcdir)/obstack.c > $(HOST_PREFIX)obstack.c
32e6d418 1384 $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(HOST_PREFIX)obstack.c
1385
1386$(HOST_PREFIX_1)malloc.o: malloc.c
1387 rm -f $(HOST_PREFIX)malloc.c
e77fd588 1388 sed -e 's/config[.]h/hconfig.h/' $(srcdir)/malloc.c > $(HOST_PREFIX)malloc.c
32e6d418 1389 $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(HOST_PREFIX)malloc.c
1390
1391# This satisfies the dependency that we get if you cross-compile a compiler
1392# that does not need to compile alloca, malloc or whatever.
1393$(HOST_PREFIX_1):
1394 touch $(HOST_PREFIX_1)
1395\f
649d8da6 1396# Remake bytecode files.
1397# BI_ALL=bi-run.o
1398BI_ALL=
1399BC_ALL=bc-opname.h bc-opcode.h bc-arity.h
1400BI_OBJ=bi-parser.o bi-lexer.o bi-reverse.o
1401
1402
7e20ea39 1403bc-emit.o : bc-emit.c $(CONFIG_H) $(RTL_H) real.h $(BYTECODE_H) \
f698a3d1 1404 bc-arity.h bc-opcode.h bc-typecd.h bc-typecd.def bi-run.h bytetypes.h
7e20ea39 1405bc-optab.o : bc-optab.c $(CONFIG_H) $(REAL_H) $(BYTECODE_H) \
1406 bc-opcode.h bc-typecd.h bc-typecd.def
649d8da6 1407
1408
1409bytecode: $(BI_ALL) $(BC_ALL)
1410
7e20ea39 1411bi-arity: bi-arity.o $(BI_OBJ) $(HOST_LIBDEPS)
1412 $(HOST_CC) $(HOST_CFLAGS) $(HOST_LDFLAGS) -o bi-arity \
c3eff1f2 1413 bi-arity.o $(BI_OBJ) $(HOST_LIBS)
7e20ea39 1414bi-opcode: bi-opcode.o $(BI_OBJ) $(HOST_LIBDEPS)
1415 $(HOST_CC) $(HOST_CFLAGS) $(HOST_LDFLAGS) -o bi-opcode \
c3eff1f2 1416 bi-opcode.o $(BI_OBJ) $(HOST_LIBS)
7e20ea39 1417bi-opname: bi-opname.o $(BI_OBJ) $(HOST_LIBDEPS)
1418 $(HOST_CC) $(HOST_CFLAGS) $(HOST_LDFLAGS) -o bi-opname \
c3eff1f2 1419 bi-opname.o $(BI_OBJ) $(HOST_LIBS)
7e20ea39 1420
e83ee760 1421bi-run.o: $(srcdir)/bi-run.c $(srcdir)/bi-run.h $(srcdir)/bc-typecd.h \
1422 bc-opname.h bc-arity.h bc-opcode.h
6fc7cea4 1423 $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) -c $(srcdir)/bi-run.c
7e20ea39 1424$(srcdir)/bi-parser.c $(srcdir)/bi-parser.h: $(srcdir)/bi-parser.y
1425 cd $(srcdir); $(BISON) $(BISONFLAGS) -d bi-parser.y -o bi-parser.c
3a346d9d 1426bi-parser.o: $(srcdir)/bi-parser.c $(srcdir)/bi-defs.h hconfig.h
7e20ea39 1427 $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) \
1428 $(srcdir)/bi-parser.c
3a346d9d 1429bi-lexer.o: $(srcdir)/bi-lexer.c $(srcdir)/bi-parser.h hconfig.h
7e20ea39 1430 $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) \
1431 $(srcdir)/bi-lexer.c
3a346d9d 1432bi-arity.o: bi-arity.c $(srcdir)/bi-defs.h hconfig.h
7e20ea39 1433 $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) \
1434 $(srcdir)/bi-arity.c
2cba3cbb 1435bi-opcode.o: bi-opcode.c $(srcdir)/bi-defs.h hconfig.h
7e20ea39 1436 $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) \
1437 $(srcdir)/bi-opcode.c
3a346d9d 1438bi-opname.o: bi-opname.c $(srcdir)/bi-defs.h hconfig.h
7e20ea39 1439 $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) \
1440 $(srcdir)/bi-opname.c
1441bi-reverse.o: bi-reverse.c $(srcdir)/bi-defs.h
1442 $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) \
1443 $(srcdir)/bi-reverse.c
832bfff4 1444
1445
e6baec2f 1446bc-arity.h: stamp-bcarity ; @true
1447stamp-bcarity : $(srcdir)/bytecode.def bi-arity $(srcdir)/move-if-change
e78095bc 1448 ./bi-arity < $(srcdir)/bytecode.def >tmp-bc-arity.h
1449 $(srcdir)/move-if-change tmp-bc-arity.h bc-arity.h
675fc1b6 1450 touch stamp-bcarity
649d8da6 1451
e6baec2f 1452bc-opcode.h: stamp-bcopcode ; @true
1453stamp-bcopcode : $(srcdir)/bytecode.def bi-opcode $(srcdir)/move-if-change
f698a3d1 1454 ./bi-opcode < $(srcdir)/bytecode.def >tmp-bcopcd.h
1455 $(srcdir)/move-if-change tmp-bcopcd.h bc-opcode.h
675fc1b6 1456 touch stamp-bcopcode
649d8da6 1457
e6baec2f 1458bc-opname.h: stamp-bcopname ; @true
1459stamp-bcopname : $(srcdir)/bytecode.def bi-opname $(srcdir)/move-if-change
f698a3d1 1460 ./bi-opname < $(srcdir)/bytecode.def >tmp-bcopnm.h
1461 $(srcdir)/move-if-change tmp-bcopnm.h bc-opname.h
675fc1b6 1462 touch stamp-bcopname
649d8da6 1463
1464bytecode.mostlyclean:
1465 -rm -f bc-arity.h bc-opcode.h bc-opname.h
1466
1467bytecode.distclean bytecode.clean: bytecode.mostlyclean
7e20ea39 1468 -rm -f bi-arity bi-opcode bi-opname bi-lexer
649d8da6 1469
1470bytecode.realclean: bytecode.clean
91cbf3f1 1471 -rm -f bi-parser.c bi-parser.h
649d8da6 1472
1473\f
32e6d418 1474# Remake cpp and protoize.
1475
1476# Making the preprocessor
1477cpp: cccp
1478 -rm -f cpp
1479 ln cccp cpp
1480cccp: cccp.o cexp.o version.o $(LIBDEPS)
1481 $(CC) $(ALL_CFLAGS) $(LDFLAGS) -o cccp cccp.o cexp.o version.o $(LIBS)
1482cexp.o: $(srcdir)/cexp.c $(CONFIG_H)
1483 $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) -c $(srcdir)/cexp.c
1484$(srcdir)/cexp.c: $(srcdir)/cexp.y
1485 cd $(srcdir); $(BISON) -o cexp.c cexp.y
d6b50af2 1486cccp.o: cccp.c $(CONFIG_H) pcp.h version.c config.status
32e6d418 1487# The reason we use $(libdir)/g++-include rather than using libsubdir
1488# is for compatibility with the current version of libg++.
1489 $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \
c6396a0b 1490 -DGCC_INCLUDE_DIR=\"$(libsubdir)/include\" \
3bf5d4dc 1491 -DGPLUSPLUS_INCLUDE_DIR=\"$(gxx_include_dir)\" \
9a4f2cdd 1492 -DLOCAL_INCLUDE_DIR=\"$(includedir)\" \
c6396a0b 1493 -DCROSS_INCLUDE_DIR=\"$(libsubdir)/sys-include\" \
46073b39 1494 -DTOOL_INCLUDE_DIR=\"$(tooldir)/include\" \
32e6d418 1495 -c `echo $(srcdir)/cccp.c | sed 's,^\./,,'`
1496
876dc5b0 1497# Note for the stamp targets, we run the program `true' instead of
1498# having an empty command (nothing following the semicolon).
1499
732b8330 1500proto: config.status protoize unprotoize SYSCALLS.c.X
32e6d418 1501
c6396a0b 1502protoize: protoize.o getopt.o getopt1.o getpwd.o version.o $(LIBDEPS)
32e6d418 1503 $(CC) $(ALL_CFLAGS) $(LDFLAGS) \
13c6d959 1504 protoize.o getopt.o getopt1.o getpwd.o version.o $(LIBS) -o protoize
c2a18965 1505protoize.o: stamp-proto ; @true
ab866dde 1506
1507unprotoize: unprotoize.o getopt.o getopt1.o getpwd.o version.o $(LIBDEPS)
1508 $(CC) $(ALL_CFLAGS) $(LDFLAGS) \
13c6d959 1509 unprotoize.o getopt.o getopt1.o getpwd.o version.o $(LIBS) \
1510 -o unprotoize
c2a18965 1511unprotoize.o: stamp-proto ; @true
ab866dde 1512
1513stamp-proto: $(srcdir)/protoize.c getopt.h $(CONFIG_H)
32e6d418 1514 $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \
1515 -DGCC_INCLUDE_DIR=\"$(libsubdir)/include\" \
3bf5d4dc 1516 -DGPLUSPLUS_INCLUDE_DIR=\"$(gxx_include_dir)\" \
32e6d418 1517 -DCROSS_INCLUDE_DIR=\"$(libsubdir)/sys-include\" \
46073b39 1518 -DTOOL_INCLUDE_DIR=\"$(tooldir)/include\" \
9a4f2cdd 1519 -DLOCAL_INCLUDE_DIR=\"$(includedir)\" \
32e6d418 1520 -DSTD_PROTO_DIR=\"$(libsubdir)\" \
ab866dde 1521 -DUNPROTOIZE $(srcdir)/protoize.c
1522 mv protoize.o unprotoize.o
32e6d418 1523 $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \
1524 -DGCC_INCLUDE_DIR=\"$(libsubdir)/include\" \
3bf5d4dc 1525 -DGPLUSPLUS_INCLUDE_DIR=\"$(gxx_include_dir)\" \
32e6d418 1526 -DCROSS_INCLUDE_DIR=\"$(libsubdir)/sys-include\" \
46073b39 1527 -DTOOL_INCLUDE_DIR=\"$(tooldir)/include\" \
9a4f2cdd 1528 -DLOCAL_INCLUDE_DIR=\"$(includedir)\" \
32e6d418 1529 -DSTD_PROTO_DIR=\"$(libsubdir)\" \
ab866dde 1530 $(srcdir)/protoize.c
77a164d8 1531 touch stamp-proto
32e6d418 1532
1533getopt.o: $(srcdir)/getopt.c getopt.h
1534 $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $(srcdir)/getopt.c
1535getopt1.o: $(srcdir)/getopt1.c getopt.h
1536 $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $(srcdir)/getopt1.c
1537
32e6d418 1538# This info describes the target machine, so compile with GCC just built.
732b8330 1539SYSCALLS.c.X: $(srcdir)/sys-types.h $(srcdir)/sys-protos.h $(GCC_PASSES) stmp-int-hdrs
f678532a 1540 -rm -f SYSCALLS.c tmp-SYSCALLS.s
79f818d0 1541 cat $(srcdir)/sys-types.h $(srcdir)/sys-protos.h > SYSCALLS.c
32e6d418 1542 $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \
f678532a 1543 -aux-info $@ -S -o tmp-SYSCALLS.s SYSCALLS.c
1544 -rm -f SYSCALLS.c tmp-SYSCALLS.s
0b20f012 1545
a5889b74 1546
0b20f012 1547test-protoize-simple: ./protoize ./unprotoize $(GCC_PASSES)
c548e550 1548 -rm -f tmp-proto.[cso]
262d46de 1549 cp $(srcdir)/protoize.c tmp-proto.c
1550 chmod u+w tmp-proto.c
c548e550 1551 ./protoize -N -B ./ -x getopt.h -c "-B./ -Wall -Wwrite-strings \
1552 $(CFLAGS) $(INCLUDES) \
0b20f012 1553 -DGCC_INCLUDE_DIR=0 \
1554 -DGPLUSPLUS_INCLUDE_DIR=0 \
1555 -DCROSS_INCLUDE_DIR=0 \
46073b39 1556 -DTOOL_INCLUDE_DIR=0 \
262d46de 1557 -DSTD_PROTO_DIR=0" tmp-proto.c
1a754c64 1558 @echo '**********' Expect 400 lines of differences.
c548e550 1559 -diff $(srcdir)/protoize.c tmp-proto.c > tmp-proto.diff
1560 -wc -l tmp-proto.diff
1561 ./unprotoize -N -x getopt.h -c "-B./ -Wall -Wwrite-strings \
1562 $(CFLAGS) $(INCLUDES) \
0b20f012 1563 -DGCC_INCLUDE_DIR=0 \
1564 -DGPLUSPLUS_INCLUDE_DIR=0 \
1565 -DCROSS_INCLUDE_DIR=0 \
46073b39 1566 -DTOOL_INCLUDE_DIR=0 \
262d46de 1567 -DSTD_PROTO_DIR=0" tmp-proto.c
0b20f012 1568 @echo Expect zero differences.
262d46de 1569 diff $(srcdir)/protoize.c tmp-proto.c | cat
c548e550 1570 -rm -f tmp-proto.[cso]
32e6d418 1571\f
2cfd79fe 1572# Build the include directory. The stamp files are stmp-* rather than
1573# stamp-* so that mostlyclean does not force the include directory to
1574# be rebuilt.
1575
690a93ea 1576# Build the include directory except for float.h (which depends upon
1577# enquire).
335ebf8f 1578stmp-int-hdrs: stmp-fixinc $(USER_H) xlimits.h objc-headers
2cfd79fe 1579# Copy in the headers provided with gcc.
1580# The sed command gets just the last file name component;
1581# this is necessary because VPATH could add a dirname.
1582# Using basename would be simpler, but some systems don't have it.
1583 objdir=`pwd`; \
1584 cd $(srcdir); \
1585 for file in $(USER_H); do \
1586 realfile=`echo $$file | sed -e 's|.*/\([^/]*\)$$|\1|'`; \
b5850e21 1587 rm -f $$objdir/include/$$realfile; \
335ebf8f 1588 cp ginclude/$$realfile $$objdir/include; \
2cfd79fe 1589 chmod a+r $$objdir/include/$$realfile; \
1590 done
b5850e21 1591 rm -f include/limits.h
2cfd79fe 1592 cp xlimits.h include/limits.h
1593 chmod a+r include/limits.h
2cfd79fe 1594# Install the README
b5850e21 1595 rm -f include/README
2cfd79fe 1596 cp $(srcdir)/README-fixinc include/README
1597 chmod a+r include/README
690a93ea 1598 touch stmp-int-hdrs
1599
1600# Build the complete include directory.
1601stmp-headers: stmp-int-hdrs gfloat.h
1602 rm -f include/float.h
1603 cp gfloat.h include/float.h
1604 chmod a+r include/float.h
2cfd79fe 1605 touch stmp-headers
1606
1607# Build fixed copies of system files.
5b1fce59 1608stmp-fixinc: $(srcdir)/$(FIXINCLUDES) gsyslimits.h
2cfd79fe 1609 rm -rf include
1610 mkdir include
92d223d1 1611 if [ x$(FIXINCLUDES) != xMakefile.in ]; \
6848a9c6 1612 then \
1613 for dir in $(SYSTEM_HEADER_DIR) $(OTHER_FIXINCLUDES_DIRS); do \
1614 if [ -d $$dir ]; \
1615 then \
cee3b7e3 1616 $(SHELL) $(srcdir)/$(FIXINCLUDES) include $$dir; \
6848a9c6 1617 else true; fi; \
92d223d1 1618 done; \
6848a9c6 1619 else true; \
1620 fi
b7d4d520 1621 rm -f include/syslimits.h
1622 if [ -f include/limits.h ]; then \
1623 mv include/limits.h include/syslimits.h; \
1624 else \
1625 cp $(srcdir)/gsyslimits.h include/syslimits.h; \
1626 fi
1627 chmod a+r include/syslimits.h
9e74f24f 1628 touch stmp-fixinc
7c4f0e88 1629
15045969 1630# copy objc header files into build directory
9fdf517e 1631objc-headers: stmp-fixinc
c7341319 1632 if [ -d include ]; then true; else mkdir include; fi
a5199ad9 1633 if [ -d objc ]; then true; else mkdir objc; fi
7c4f0e88 1634 thisdir1=`pwd`; \
1635 srcdir1=`cd $(srcdir); pwd`; \
1636 cd objc; \
1637 $(MAKE) -f $${srcdir1}/objc/Makefile copy-headers \
1638 srcdir=$${srcdir1} tooldir=$(tooldir) AR="$(AR)" AR_FLAGS="$(AR_FLAGS)" \
1639 GCC_FOR_TARGET="$${thisdir1}/xgcc -B$${thisdir1}/" \
1640 GCC_CFLAGS="$(GCC_CFLAGS)" incinstalldir=$${thisdir1}/include
15045969 1641 touch objc-headers
a5889b74 1642
1643# Files related to the fixproto script.
1644
047c2b8b 1645deduced.h: $(GCC_PASSES) $(srcdir)/scan-types.sh stmp-int-hdrs
f55e1a13 1646 CC="$(GCC_FOR_TARGET) $(GCC_CFLAGS) $(ALL_CPPFLAGS) -I. -I$(srcdir) -Iinclude -I${SYSTEM_HEADER_DIR}"; \
a5889b74 1647 export CC; \
6518b023 1648 $(SHELL) $(srcdir)/scan-types.sh "$(srcdir)" >tmp-deduced.h
a5889b74 1649 mv tmp-deduced.h deduced.h
1650
3b58525a 1651gen-protos: gen-protos.o scan.o $(HOST_LIBDEPS)
4631ecda 1652 ${HOST_CC} $(HOST_CFLAGS) $(HOST_LDFLAGS) -o gen-protos \
3b58525a 1653 gen-protos.o scan.o $(HOST_LIBS)
a5889b74 1654
c68462d9 1655gen-protos.o: gen-protos.c scan.h hconfig.h
1656 $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(srcdir)/gen-protos.c
1657
1658scan.o: scan.c scan.h hconfig.h
1659 $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(srcdir)/scan.c
9541a717 1660
047c2b8b 1661xsys-protos.h: $(GCC_PASSES) $(srcdir)/sys-protos.h deduced.h gen-protos Makefile
d7c4552e 1662 cat deduced.h $(srcdir)/sys-protos.h > fixtmp.c
43627542 1663 $(GCC_FOR_TARGET) fixtmp.c -w -U__SIZE_TYPE__ -U__PTRDIFF_TYPE_ -U__WCHAR_TYPE__ -E \
6fc3eafd 1664 | sed -e 's/ / /g' -e 's/ *(/ (/g' -e 's/ [ ]*/ /g' -e 's/( )/()/' \
1665 | ./gen-protos >xsys-protos.h
d7c4552e 1666 rm -rf fixtmp.c
a5889b74 1667
3b58525a 1668fix-header: fix-header.o scan-decls.o scan.o xsys-protos.h $(HOST_LIBDEPS)
4631ecda 1669 $(HOST_CC) $(HOST_CFLAGS) $(HOST_LDFLAGS) -o fix-header \
3b58525a 1670 fix-header.o scan-decls.o scan.o $(HOST_LIBS)
a5889b74 1671
c68462d9 1672fix-header.o: fix-header.c obstack.h scan.h xsys-protos.h hconfig.h
1673 $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(srcdir)/fix-header.c
1674
1675scan-decls.o: scan-decls.c scan.h hconfig.h
1676 $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(srcdir)/scan-decls.c
a5889b74 1677
047c2b8b 1678# stmp-fixproto depends on this, not on fix-header directly.
1679# The idea is to make sure fix-header gets built,
1680# but not rerun fixproto after each stage
1681# just because fix-header's mtime has changed.
1682fixhdr.ready: fix-header
1683 -if [ -f fixhdr.ready ] ; then \
1684 true; \
1685 else \
1686 touch fixhdr.ready; \
1687 fi
1688
7bf27989 1689# stmp-headers is to make sure fixincludes has already finished.
276709eb 1690# The if statement is so that we don't run fixproto a second time
1691# if it has already been run on the files in `include'.
6a0b7b7c 1692stmp-fixproto: fixhdr.ready fixproto stmp-headers
2deaa28d 1693 @echo "Various warnings and error messages from fixproto are normal"
4fbc622f 1694 -if [ -d include ] ; then true; else mkdir include; fi
b948f736 1695 -if [ -f include/fixed ] ; then true; \
276709eb 1696 else \
6f1f992e 1697 : This line works around a 'make' bug in BSDI 1.1.; \
276709eb 1698 CPP="$(GCC_FOR_TARGET) -E"; export CPP; \
b33b80ed 1699 FIXPROTO_DEFINES="$(FIXPROTO_DEFINES)"; export FIXPROTO_DEFINES; \
6518b023 1700 $(SHELL) ${srcdir}/fixproto include include $(SYSTEM_HEADER_DIR); \
276709eb 1701 touch include/fixed; \
1702 fi
a5889b74 1703 touch stmp-fixproto
2cfd79fe 1704\f
32e6d418 1705# Remake the info files.
1706
627defc4 1707doc: info
73027c94 1708info: $(srcdir)/cpp.info $(srcdir)/gcc.info lang.info
32e6d418 1709
630c76ba 1710$(srcdir)/cpp.info: cpp.texi
4b0206c0 1711 cd $(srcdir); $(MAKEINFO) cpp.texi
32e6d418 1712
630c76ba 1713$(srcdir)/gcc.info: gcc.texi extend.texi install.texi invoke.texi \
1714 md.texi rtl.texi tm.texi
4b0206c0 1715 cd $(srcdir); $(MAKEINFO) gcc.texi
630c76ba 1716
73027c94 1717dvi: $(srcdir)/gcc.dvi $(srcdir)/cpp.dvi lang.dvi
627defc4 1718
64616031 1719# This works with GNU Make's default rule.
1720$(srcdir)/gcc.dvi: gcc.texi extend.texi install.texi invoke.texi \
1721 md.texi rtl.texi tm.texi
f345940f 1722 $(TEXI2DVI) $<
64616031 1723
1724# This works with GNU Make's default rule.
1725$(srcdir)/cpp.dvi: cpp.texi
f345940f 1726 $(TEXI2DVI) $<
64616031 1727
630c76ba 1728$(srcdir)/INSTALL: install1.texi install.texi
0b9e1f1f 1729 $(MAKEINFO) -D INSTALLONLY --no-header --no-split \
1730 `echo $(srcdir)/install1.texi | sed 's,^\./,,'`
32e6d418 1731\f
1732# Deletion of files made during compilation.
1733# There are four levels of this:
79f818d0 1734# `mostlyclean', `clean', `distclean' and `realclean'.
32e6d418 1735# `mostlyclean' is useful while working on a particular type of machine.
c6396a0b 1736# It deletes most, but not all, of the files made by compilation.
32e6d418 1737# It does not delete libgcc.a or its parts, so it won't have to be recompiled.
c6396a0b 1738# `clean' deletes everything made by running `make all'.
79f818d0 1739# `distclean' also deletes the files made by config.
32e6d418 1740# `realclean' also deletes everything that could be regenerated automatically.
73027c94 1741# We remove as much from the language subdirectories as we can
1742# (less duplicated code).
32e6d418 1743
79f818d0 1744
73027c94 1745mostlyclean: bytecode.mostlyclean lang.mostlyclean
32e6d418 1746 -rm -f $(STAGESTUFF)
343505c4 1747# Clean the objc subdir if we created one.
1748 if [ -d objc ]; then \
1749 srcdir1=`cd $(srcdir); pwd`; \
8c6da369 1750 cd objc; $(MAKE) -f $$srcdir1/objc/Makefile mostlyclean; \
343505c4 1751 else true; fi
bd594491 1752 -rm -f libobjc.a
32e6d418 1753# Delete the temporary source copies for cross compilation.
1754 -rm -f $(HOST_PREFIX_1)rtl.c $(HOST_PREFIX_1)rtlanal.c
1755 -rm -f $(HOST_PREFIX_1)alloca.c $(HOST_PREFIX_1)malloc.c
1756 -rm -f $(HOST_PREFIX_1)obstack.c
1757# Delete the temp files made in the course of building libgcc.a.
590613c7 1758 -rm -f tmplibgcc* tmpcopy xlimits.h
32e6d418 1759 for name in $(LIB1FUNCS); do rm -f $${name}.c; done
1760# Delete other temporary files.
e5b63666 1761 -rm -f tmp-float.h tmp-gcc.xtar.gz
f678532a 1762 -rm -f tmp-foo1 tmp-foo2 tmp-proto.* tmp-unproto.1 tmp-SYSCALLS.s
a58045a1 1763 -rm tmp-c-parse.y tmp-objc-parse.y tmp-gperf.h
32e6d418 1764# Delete the stamp files.
1765 -rm -f stamp-* tmp-*
73027c94 1766 -rm -f */stamp-* */tmp-*
c6396a0b 1767# Delete debugging dump files.
32e6d418 1768 -rm -f *.greg *.lreg *.combine *.flow *.cse *.jump *.rtl *.tree *.loop
c6396a0b 1769 -rm -f *.dbr *.jump2 *.sched *.cse2 *.sched2 *.stack
73027c94 1770 -rm -f */*.greg */*.lreg */*.combine */*.flow */*.cse */*.jump */*.rtl
1771 -rm -f */*.tree */*.loop */*.dbr */*.jump2 */*.sched */*.cse2
1772 -rm -f */*.sched2 */*.stack
c6396a0b 1773# Delete some files made during installation.
d82b9c93 1774 -rm -f specs gfloat.h float.h-* enquire SYSCALLS.c.X SYSCALLS.c
e98401fc 1775 -rm -f collect collect2 mips-tfile mips-tdump alloca.s
a5889b74 1776# Delete files generated for fixproto
15dece2a 1777 -rm -rf fix-header xsys-protos.h deduced.h tmp-deduced.h \
c9c7b9d8 1778 gen-protos fixproto.list fixtmp.* fixhdr.ready
c6396a0b 1779# Delete unwanted output files from TeX.
1780 -rm -f *.toc *.log *.vr *.fn *.cp *.tp *.ky *.pg
73027c94 1781 -rm -f */*.toc */*.log */*.vr */*.fn */*.cp */*.tp */*.ky */*.pg
79f818d0 1782# Delete sorted indices we don't actually use.
1783 -rm -f gcc.vrs gcc.kys gcc.tps gcc.pgs gcc.fns
c6396a0b 1784# Delete core dumps.
73027c94 1785 -rm -f core */core
32e6d418 1786
79f818d0 1787# Delete all files made by compilation
1788# that don't exist in the distribution.
73027c94 1789clean: mostlyclean bytecode.clean lang.clean
8bd8ea06 1790# It may not be quite desirable to delete unprotoize.c here,
1791# but the spec for `make clean' requires it.
1792# Using unprotoize.c is not quite right in the first place,
1793# but what better way is there?
c3482c3b 1794 -rm -f libgcc.a libgcc1.a libgcc2.a libgcc2.ready
1795 -rm -f libgcc1.null $(LIB2FUNCS_EXTRA)
131b361e 1796 -rm -f *.dvi
73027c94 1797 -rm -f */*.dvi
89e36a04 1798 -if [ -f md.pre-cpp ]; then \
1799 rm -f md ; \
1800 fi
2cfd79fe 1801# Delete the include directory.
5b1fce59 1802 -rm -rf stmp-* include objc-headers
73027c94 1803 -rm -f */stmp-*
f1ad3130 1804 -rm -f multilib.h tmpmultilib*
32e6d418 1805
79f818d0 1806# Delete all files that users would normally create
1807# while building and installing GCC.
73027c94 1808distclean: clean bytecode.distclean lang.distclean
89e36a04 1809 -rm -f tm.h aux-output.c config.h config.status tconfig.h hconfig.h
1810 -rm -f md md.pre-cpp
ab866dde 1811 -rm -f Makefile *.oaux
79f818d0 1812 -rm -fr stage1 stage2 stage3 stage4
73027c94 1813 -rm -f */stage1 */stage2 */stage3 */stage4
08d7a103 1814 -rm -f objc-parse.output
1815 -rm -f c-parse.output
c6396a0b 1816
1817# Delete anything likely to be found in the source directory
1818# that shouldn't be in the distribution.
73027c94 1819extraclean: distclean lang.extraclean
bbbdbddd 1820 -rm -rf =* ./"#"* *~* config/=* config/"#"* config/*~*
131b361e 1821 -rm -f patch* *.orig *.rej config/patch* config/*.orig config/*.rej
08d7a103 1822 -rm -f config/*/=* config/*/"#"* config/*/*~*
1823 -rm -f config/*/*.orig config/*/*.rej
13da1009 1824 -rm -f *.dvi *.oaux *.d *.[zZ] *.gz
1825 -rm -f *.tar *.xtar *diff *.diff.* *.tar.* *.xtar.* *diffs
08d7a103 1826 -rm -f *lose config/*lose config/*/*lose
3a0781a0 1827 -rm -f *.s *.s[0-9] *.i install1.texi config/ChangeLog
73027c94 1828 -rm -f */=* */"#"* */*~*
1829 -rm -f */patch* */*.orig */*.rej
1830 -rm -f */*.dvi */*.oaux */*.d */*.[zZ] */*.gz
1831 -rm -f */*.tar */*.xtar */*diff */*.diff.* */*.tar.* */*.xtar.* */*diffs
1832 -rm -f */*lose */*.s */*.s[0-9] */*.i
32e6d418 1833
1834# Get rid of every file that's generated from some other file.
1835# Most of these files ARE PRESENT in the GCC distribution.
73027c94 1836realclean: distclean bytecode.realclean lang.realclean
6a4a0b58 1837 -rm -f c-parse.y c-gperf.h objc-parse.y
32e6d418 1838 -rm -f objc-parse.c objc-parse.output
32e6d418 1839 -rm -f c-parse.c c-parse.h c-parse.output
1840 -rm -f cexp.c cexp.output TAGS
c6396a0b 1841 -rm -f cpp.info* cpp.??s cpp.*aux
1842 -rm -f gcc.info* gcc.??s gcc.*aux
32e6d418 1843\f
1844# Entry points `install' and `uninstall'.
c6396a0b 1845# Also use `install-collect2' to install collect2 when the config files don't.
32e6d418 1846
3f69fed5 1847# The semicolon is to prevent the install.sh -> install default rule
876dc5b0 1848# from doing anything. Having it run true helps avoid problems and
1849# noise from versions of make which don't like to have null commands.
c2a18965 1850install: $(INSTALL_TARGET) ; @true
32e6d418 1851
2cfd79fe 1852# Copy the compiler files into directories where they will be run.
2289acd7 1853install-normal: install-common $(INSTALL_HEADERS) $(INSTALL_LIBGCC) \
73027c94 1854 install-man install-info lang.install-normal
32e6d418 1855
e77fd588 1856# Do nothing while making gcc with a cross-compiler. The person who
1857# makes gcc for the target machine has to know how to put a complete
1858# gcc together by hand.
1859install-build: force
1860 @echo You have to install gcc on your target machine by hand.
1861
32e6d418 1862# Run this on the target machine
1863# to finish installation of cross compiler.
1864install-cross-rest: install-float-h-cross
1865
1866# Install float.h for cross compiler.
1867# Run this on the target machine!
aa02423a 1868install-float-h-cross: install-dir
9f10de4b 1869# if [ -f enquire ] ; then true; else false; fi
1870# Note: don't use -. We should fail right away if enquire was not made.
1871 ./enquire -f > $(tmpdir)/float.h
32e6d418 1872 -rm -f $(libsubdir)/include/float.h
f32abccb 1873 $(INSTALL_DATA) $(tmpdir)/float.h $(libsubdir)/include/float.h
1874 -rm -f $(tmpdir)/float.h
32e6d418 1875 chmod a-x $(libsubdir)/include/float.h
1876
1877# Create the installation directory.
1878install-dir:
2388f67d 1879 -if [ -d $(libdir) ] ; then true ; else mkdir $(libdir) ; fi
1880 -if [ -d $(libdir)/gcc-lib ] ; then true ; else mkdir $(libdir)/gcc-lib ; fi
444c3fb0 1881# This dir isn't currently searched by cpp.
d0561ed0 1882# -if [ -d $(libdir)/gcc-lib/include ] ; then true ; else mkdir $(libdir)/gcc-lib/include ; fi
2388f67d 1883 -if [ -d $(libdir)/gcc-lib/$(target) ] ; then true ; else mkdir $(libdir)/gcc-lib/$(target) ; fi
1884 -if [ -d $(libdir)/gcc-lib/$(target)/$(version) ] ; then true ; else mkdir $(libdir)/gcc-lib/$(target)/$(version) ; fi
630c76ba 1885 -if [ -d $(libdir)/gcc-lib/$(target)/$(version)/include ] ; then true ; else mkdir $(libdir)/gcc-lib/$(target)/$(version)/include ; fi
2388f67d 1886 -if [ -d $(bindir) ] ; then true ; else mkdir $(bindir) ; fi
69184f78 1887 -if [ -d $(includedir) ] ; then true ; else mkdir $(includedir) ; fi
67aebfdd 1888 -if [ -d $(tooldir) ] ; then true ; else mkdir $(tooldir) ; fi
9d8314a9 1889 -if [ -d $(assertdir) ] ; then true ; else mkdir $(assertdir) ; fi
a2aa0fc1 1890 -if [ -d $(infodir) ] ; then true ; else mkdir $(infodir) ; fi
32e6d418 1891# We don't use mkdir -p to create the parents of mandir,
1892# because some systems don't support it.
1893# Instead, we use this technique to create the immediate parent of mandir.
2388f67d 1894 -parent=`echo $(mandir)|sed -e 's@/[^/]*$$@@'`; \
32e6d418 1895 if [ -d $$parent ] ; then true ; else mkdir $$parent ; fi
1896 -if [ -d $(mandir) ] ; then true ; else mkdir $(mandir) ; fi
1897
1898# Install the compiler executables built during cross compilation.
73027c94 1899install-common: native install-dir xgcc $(EXTRA_PARTS) lang.install-common
32e6d418 1900 for file in $(COMPILERS); do \
1901 if [ -f $$file ] ; then \
1902 rm -f $(libsubdir)/$$file; \
1903 $(INSTALL_PROGRAM) $$file $(libsubdir)/$$file; \
1904 else true; \
1905 fi; \
1906 done
1a1e7b42 1907 for file in $(EXTRA_PASSES) $(EXTRA_PROGRAMS) $(USE_COLLECT2) ..; do \
32e6d418 1908 if [ x"$$file" != x.. ]; then \
1909 rm -f $(libsubdir)/$$file; \
1910 $(INSTALL_PROGRAM) $$file $(libsubdir)/$$file; \
1911 else true; fi; \
1912 done
1a1e7b42 1913 for file in $(EXTRA_PARTS) ..; do \
1914 if [ x"$$file" != x.. ]; then \
1915 rm -f $(libsubdir)/$$file; \
1916 $(INSTALL_DATA) $$file $(libsubdir)/$$file; \
1917 else true; fi; \
1918 done
8a4b1e01 1919# Don't mess with specs if it doesn't exist yet.
94c53b91 1920 -if [ -f specs ] ; then \
1921 rm -f $(libsubdir)/specs; \
8a4b1e01 1922 $(INSTALL_DATA) specs $(libsubdir)/specs; \
1923 fi
6005991e 1924# Install the driver program as $(target)-gcc
32e6d418 1925# and also as either gcc (if native) or $(tooldir)/bin/gcc.
1926 -if [ -f gcc-cross ] ; then \
7fdd7d43 1927 rm -f $(bindir)/$(target)-gcc; \
6005991e 1928 $(INSTALL_PROGRAM) gcc-cross $(bindir)/$(target)-gcc; \
32e6d418 1929 if [ -d $(tooldir)/bin/. ] ; then \
1930 rm -f $(tooldir)/bin/gcc; \
1931 $(INSTALL_PROGRAM) gcc-cross $(tooldir)/bin/gcc; \
32e6d418 1932 else true; fi; \
1933 else \
1934 rm -f $(bindir)/gcc; \
77a164d8 1935 $(INSTALL_PROGRAM) xgcc $(bindir)/gcc; \
6005991e 1936 rm -f $(bindir)/$(target)-gcc-1; \
1937 ln $(bindir)/gcc $(bindir)/$(target)-gcc-1; \
1938 mv $(bindir)/$(target)-gcc-1 $(bindir)/$(target)-gcc; \
32e6d418 1939 fi
9cee99f7 1940# Install protoize if it was compiled.
ae0fea3a 1941 -if [ -f protoize ]; \
9cee99f7 1942 then \
1943 rm -f $(bindir)/protoize; \
1944 $(INSTALL_PROGRAM) protoize $(bindir)/protoize; \
1945 rm -f $(bindir)/unprotoize; \
1946 $(INSTALL_PROGRAM) unprotoize $(bindir)/unprotoize; \
1947 rm -f $(libsubdir)/SYSCALLS.c.X; \
1948 $(INSTALL_DATA) SYSCALLS.c.X $(libsubdir)/SYSCALLS.c.X; \
1949 chmod a-x $(libsubdir)/SYSCALLS.c.X; \
1950 fi
32e6d418 1951 -rm -f $(libsubdir)/cpp
1952 $(INSTALL_PROGRAM) cpp $(libsubdir)/cpp
1953
a2aa0fc1 1954# Install the info files.
73027c94 1955install-info: doc install-dir lang.install-info
a2aa0fc1 1956 -rm -f $(infodir)/cpp.info* $(infodir)/gcc.info*
1957 cd $(srcdir); for f in cpp.info* gcc.info*; \
1958 do $(INSTALL_DATA) $$f $(infodir)/$$f; done
1959 -chmod a-x $(infodir)/cpp.info* $(infodir)/gcc.info*
1960
32e6d418 1961# Install the man pages.
73027c94 1962install-man: install-dir $(srcdir)/gcc.1 $(srcdir)/cccp.1 lang.install-man
32e6d418 1963 -rm -f $(mandir)/gcc$(manext)
ab866dde 1964 -$(INSTALL_DATA) $(srcdir)/gcc.1 $(mandir)/gcc$(manext)
1965 -chmod a-x $(mandir)/gcc$(manext)
c6396a0b 1966 -rm -f $(mandir)/cccp$(manext)
ab866dde 1967 -$(INSTALL_DATA) $(srcdir)/cccp.1 $(mandir)/cccp$(manext)
1968 -chmod a-x $(mandir)/cccp$(manext)
32e6d418 1969
1970# Install the library.
807a86f6 1971install-libgcc: libgcc.a install-dir
32e6d418 1972 -if [ -f libgcc.a ] ; then \
1973 rm -f $(libsubdir)/libgcc.a; \
1974 $(INSTALL_DATA) libgcc.a $(libsubdir)/libgcc.a; \
1975 if $(RANLIB_TEST) ; then \
1976 (cd $(libsubdir); $(RANLIB) libgcc.a); else true; fi; \
1977 chmod a-x $(libsubdir)/libgcc.a; \
1978 else true; fi
1979
f1ad3130 1980# Install multiple versions of libgcc.a.
1981install-multilib: stmp-multilib install-dir
1982 for i in `$(GCC_FOR_TARGET) --print-multi-lib`; do \
1983 dir=`echo $$i | sed -e 's/;.*$$//'`; \
1984 if [ -d $(libsubdir)/$${dir} ]; then true; else mkdir $(libsubdir)/$${dir}; fi; \
1985 rm -f $(libsubdir)/$${dir}/libgcc.a; \
1986 $(INSTALL_DATA) $${dir}/libgcc.a $(libsubdir)/$${dir}/libgcc.a; \
1987 if $(RANLIB_TEST); then \
1988 (cd $(libsubdir)/$${dir}; $(RANLIB) libgcc.a); else true; fi; \
1989 chmod a-x $(libsubdir)/$${dir}/libgcc.a; \
1990 done
1991
f32abccb 1992# Install the objc run time library.
1993install-libobjc: libobjc.a install-dir
1994 -if [ -f libobjc.a ] ; then \
1995 rm -f $(libsubdir)/libobjc.a; \
1996 $(INSTALL_DATA) libobjc.a $(libsubdir)/libobjc.a; \
1997 if $(RANLIB_TEST) ; then \
1998 (cd $(libsubdir); $(RANLIB) libobjc.a); else true; fi; \
1999 chmod a-x $(libsubdir)/libobjc.a; \
2000 else true; fi
2001
2cfd79fe 2002# Install all the header files built in the include subdirectory.
2003install-headers: install-include-dir $(INSTALL_HEADERS_DIR) install-assert-h
2004# Fix symlinks to absolute paths in the installed include directory to
2005# point to the installed directory, not the build directory.
2006 -files=`cd $(libsubdir)/include; find . -type l -print 2>/dev/null`; \
2007 if [ $$? -eq 0 ]; then \
2008 dir=`cd include; pwd`; \
2009 for i in $$files; do \
2010 dest=`ls -ld $(libsubdir)/include/$$i | sed -n 's/.*-> //p'`; \
2011 if expr "$$dest" : "$$dir.*" > /dev/null; then \
2012 rm -f $(libsubdir)/include/$$i; \
5822e312 2013 ln -s `echo $$i | sed "s|/[^/]*|/..|g" | sed 's|/..$$||'``echo "$$dest" | sed "s|$$dir||"` $(libsubdir)/include/$$i; \
2cfd79fe 2014 fi; \
2015 done; \
2016 fi
32e6d418 2017
2cfd79fe 2018# Create or recreate the gcc private include file directory.
2fc395f6 2019install-include-dir: install-dir
2cfd79fe 2020 -rm -rf $(libsubdir)/include
2021 mkdir $(libsubdir)/include
2022 -chmod a+rx $(libsubdir)/include
2023
2024# Install the include directory using tar.
a5889b74 2025install-headers-tar: stmp-headers $(STMP_FIXPROTO) install-include-dir
651b0150 2026 (cd include; \
b948f736 2027 tar -cf - .; exit 0) | (cd $(libsubdir)/include; tar $(TAROUTOPTS) - )
16db1e2d 2028# /bin/sh on some systems returns the status of the first tar,
2029# and that can lose with GNU tar which always writes a full block.
2030# So use `exit 0' to ignore its exit status.
2cfd79fe 2031
2032# Install the include directory using cpio.
a5889b74 2033install-headers-cpio: stmp-headers $(STMP_FIXPROTO) install-include-dir
813fb313 2034 (cd include; find . -print) | (cd include; cpio -pdum $(libsubdir)/include)
32e6d418 2035
35df828f 2036# Put assert.h where it won't override GNU libc's assert.h.
2037# It goes in a dir that is searched after GNU libc's headers;
2038# thus, the following conditionals are no longer needed.
2039# But it's not worth deleting them now.
2040## Don't replace the assert.h already there if it is not from GCC.
2041## This code would be simpler if it tested for -f ... && ! grep ...
2042## but supposedly the ! operator is missing in sh on some systems.
2cfd79fe 2043install-assert-h: assert.h install-dir
eb5a0caa 2044 if [ -f $(assertdir)/assert.h ]; \
2045 then \
95856242 2046 if grep "__eprintf" $(assertdir)/assert.h >/dev/null; \
a953974c 2047 then \
eb5a0caa 2048 rm -f $(assertdir)/assert.h; \
2049 $(INSTALL_DATA) $(srcdir)/assert.h $(assertdir)/assert.h; \
04873c54 2050 chmod a-x $(assertdir)/assert.h; \
eb5a0caa 2051 else true; \
2052 fi; \
2ba284c3 2053 else \
db9a0b19 2054 rm -f $(assertdir)/assert.h; \
2055 $(INSTALL_DATA) $(srcdir)/assert.h $(assertdir)/assert.h; \
04873c54 2056 chmod a-x $(assertdir)/assert.h; \
2ba284c3 2057 fi
32e6d418 2058
c6396a0b 2059# Use this target to install the program `collect2' under the name `ld'.
aa02423a 2060install-collect2: collect2 install-dir
c6396a0b 2061 $(INSTALL_PROGRAM) collect2 $(libsubdir)/ld
2062# Install the driver program as $(libsubdir)/gcc for collect2.
77a164d8 2063 $(INSTALL_PROGRAM) xgcc $(libsubdir)/gcc
c6396a0b 2064
32e6d418 2065# Cancel installation by deleting the installed files.
73027c94 2066uninstall: lang.uninstall
32e6d418 2067 -rm -rf $(libsubdir)
2068 -rm -rf $(bindir)/gcc
32e6d418 2069 -rm -rf $(bindir)/protoize
2070 -rm -rf $(bindir)/unprotoize
2071 -rm -rf $(mandir)/gcc$(manext)
c6396a0b 2072 -rm -rf $(mandir)/cccp$(manext)
32e6d418 2073 -rm -rf $(mandir)/protoize$(manext)
2074 -rm -rf $(mandir)/unprotoize$(manext)
2075\f
2076# These exist for maintenance purposes.
2077
2078# Update the tags table.
2079TAGS: force
2080 cd $(srcdir); \
2081 mkdir temp; \
73027c94 2082 mv -f c-parse.[ch] objc-parse.c cexp.c =*.[chy] temp; \
32e6d418 2083 etags *.y *.h *.c; \
2084 mv temp/* .; \
2085 rmdir temp
2086
2087# Create the distribution tar file.
e5b63666 2088#dist: gcc-$(version).tar.gz
2089dist: gcc.xtar.gz
32e6d418 2090
e5b63666 2091gcc.xtar.gz: gcc.xtar
b89eb617 2092 gzip --best < gcc.xtar > tmp-gcc.xtar.gz
e5b63666 2093 mv tmp-gcc.xtar.gz gcc.xtar.gz
32e6d418 2094
e5b63666 2095#gcc-$(version).tar.gz: gcc-$(version).tar
2096# gzip < gcc-$(version).tar > gcc-$(version).tar.gz
32e6d418 2097
2098#gcc-$(version).tar:
6c76e6ec 2099gcc.xtar: distdir
2100# Make the distribution.
b948f736 2101 tar -chf gcc.xtar gcc-$(version)
6c76e6ec 2102
73027c94 2103# This target exists to do the initial work before the language specific
2104# stuff gets done.
2105distdir-start: doc $(srcdir)/INSTALL c-parse.y c-gperf.h objc-parse.y \
2106 c-parse.c objc-parse.c cexp.c
2deaa28d 2107 @if grep -s "for version ${mainversion}" gcc.texi > /dev/null; \
630c76ba 2108 then true; \
0dce1b01 2109 else echo "You must update the version number in \`gcc.texi'"; sleep 10;\
630c76ba 2110 fi
131b361e 2111# Update the version number in README
2112 awk '$$1 " " $$2 " " $$3 == "This directory contains" \
2113 { $$6 = version; print $$0 } \
2114 $$1 " " $$2 " " $$3 != "This directory contains"' \
2115 version=$(version) README > tmp.README
2116 mv tmp.README README
c6396a0b 2117 -rm -rf gcc-$(version) tmp
32e6d418 2118# Put all the files in a temporary subdirectory
2119# which has the name that we want to have in the tar file.
c6396a0b 2120 mkdir tmp
2121 mkdir tmp/config
3bc8e4d6 2122 mkdir tmp/ginclude
4f1fd857 2123 mkdir tmp/objc
c6396a0b 2124 for file in *[0-9a-zA-Z+]; do \
131b361e 2125 ln $$file tmp > /dev/null 2>&1 || cp $$file tmp; \
c6396a0b 2126 done
2127 cd config; \
2128 for file in *[0-9a-zA-Z+]; do \
57e88ef9 2129 if test -d $$file && test "$$file" != RCS; then \
8a32ef6f 2130 mkdir ../tmp/config/$$file; \
2131 cd $$file; \
2132 for subfile in *[0-9a-zA-Z+]; do \
2133 ln $$subfile ../../tmp/config/$$file >/dev/null 2>&1 \
2134 || cp $$subfile ../../tmp/config/$$file; \
2135 done; \
2136 cd ..; \
2137 else \
2138 ln $$file ../tmp/config >/dev/null 2>&1 \
2139 || cp $$file ../tmp/config; \
2140 fi; \
32e6d418 2141 done
3bc8e4d6 2142 cd ginclude; \
2143 for file in *[0-9a-zA-Z+]; do \
2144 ln $$file ../tmp/ginclude >/dev/null 2>&1 || cp $$file ../tmp/ginclude; \
2145 done
4f1fd857 2146 cd objc; \
2147 for file in *[0-9a-zA-Z+]; do \
e77fd588 2148 ln $$file ../tmp/objc >/dev/null 2>&1 || cp $$file ../tmp/objc; \
4f1fd857 2149 done
c6396a0b 2150 ln .gdbinit tmp
73027c94 2151
2152# Finish making `distdir', after the languages have done their thing.
2153distdir-finish:
c6396a0b 2154 mv tmp gcc-$(version)
3bc8e4d6 2155# Get rid of everything we don't want in the distribution. We'd want
2156# this to use Makefile.in, but it doesn't have the `lang.foo' targets
2157# expanded.
2158 cd gcc-$(version); make extraclean
32e6d418 2159
73027c94 2160distdir: distdir-start lang.distdir distdir-finish
2161
2deaa28d 2162# make diff oldversion=M.N
2163# creates a diff file between an older distribution and this one.
2164# The -P option assumes this is GNU diff.
2165diff:
6a4a0b58 2166 diff -rc2P -x c-parse.y -x c-parse.c -x c-parse.h -x c-gperf.h \
73027c94 2167 -x cexp.c -x bi-parser.c -x objc-parse.y -x objc-parse.c \
2168 -x TAGS \
2169 -x "gcc.??" -x "gcc.??s" -x gcc.aux -x "gcc.info*" \
2170 -x "cpp.??" -x "cpp.??s" -x cpp.aux -x "cpp.info*" \
2171 $(LANG_DIFF_EXCLUDES) \
2deaa28d 2172 gcc-$(oldversion) gcc-$(version) > diffs
2173
32e6d418 2174# do make -f ../gcc/Makefile maketest DIR=../gcc
2175# in the intended test directory to make it a suitable test directory.
2176# THIS IS OBSOLETE; use the -srcdir operand in configure instead.
2177maketest:
2178 ln -s $(DIR)/*.[chy] .
2179 ln -s $(DIR)/configure .
2180 ln -s $(DIR)/*.def .
2181 -rm -f =*
2182 ln -s $(DIR)/.gdbinit .
2183 ln -s $(DIR)/$(FIXINCLUDES) .
2184 -ln -s $(DIR)/bison.simple .
2185 ln -s $(DIR)/config .
2186 ln -s $(DIR)/move-if-change .
2187# The then and else were swapped to avoid a problem on Ultrix.
2188 if [ ! -f Makefile ] ; then ln -s $(DIR)/Makefile .; else false; fi
2189 -rm tm.h aux-output.c config.h md
2190 make clean
2191# You must then run config to set up for compilation.
77a164d8 2192
41f63c60 2193bootstrap: force
2194# Only build the C compiler for stage1, because that is the only one that
2195# we can guarantee will build with the native compiler, and also it is the
2196# only thing useful for building stage2.
3ef0efe3 2197 $(MAKE) CC="$(CC)" libdir=$(libdir) LANGUAGES=c
32e6d418 2198 $(MAKE) stage1
c6396a0b 2199# This used to define ALLOCA as empty, but that would lead to bad results
2200# for a subsequent `make install' since that would not have ALLOCA empty.
2201# To prevent `make install' from compiling alloca.o and then relinking cc1
2202# because alloca.o is newer, we permit these recursive makes to compile
2203# alloca.o. Then cc1 is newer, so it won't have to be relinked.
b5b9fcfc 2204 $(MAKE) CC="stage1/xgcc -Bstage1/" CFLAGS="$(BOOT_CFLAGS)" LDFLAGS="$(BOOT_LDFLAGS)" libdir=$(libdir) LANGUAGES="$(LANGUAGES)"
32e6d418 2205 $(MAKE) stage2
b5b9fcfc 2206 $(MAKE) CC="stage2/xgcc -Bstage2/" CFLAGS="$(BOOT_CFLAGS)" LDFLAGS="$(BOOT_LDFLAGS)" libdir=$(libdir) LANGUAGES="$(LANGUAGES)"
32e6d418 2207
2208bootstrap2: force
b5b9fcfc 2209 $(MAKE) CC="stage1/xgcc -Bstage1/" CFLAGS="$(BOOT_CFLAGS)" LDFLAGS="$(BOOT_LDFLAGS)" libdir=$(libdir) LANGUAGES="$(LANGUAGES)"
32e6d418 2210 $(MAKE) stage2
b5b9fcfc 2211 $(MAKE) CC="stage2/xgcc -Bstage2/" CFLAGS="$(BOOT_CFLAGS)" LDFLAGS="$(BOOT_LDFLAGS)" libdir=$(libdir) LANGUAGES="$(LANGUAGES)"
32e6d418 2212
2213bootstrap3: force
b5b9fcfc 2214 $(MAKE) CC="stage2/xgcc -Bstage2/" CFLAGS="$(BOOT_CFLAGS)" LDFLAGS="$(BOOT_LDFLAGS)" libdir=$(libdir) LANGUAGES="$(LANGUAGES)"
32e6d418 2215
48c6936b 2216# Compare the object files in the current directory with those in the
2217# stage2 directory.
2218
639b13ee 2219# ./ avoids bug in some versions of tail.
48c6936b 2220compare: force
2221 for file in *.o; do \
639b13ee 2222 tail +16c ./$$file > tmp-foo1; \
77a164d8 2223 tail +16c stage2/$$file > tmp-foo2 2>/dev/null \
2224 && (cmp tmp-foo1 tmp-foo2 || echo $$file differs); \
48c6936b 2225 done
73027c94 2226 for dir in tmp-foo $(SUBDIRS); do \
848a4a74 2227 if [ "`echo $$dir/*.o`" != "$$dir/*.o" ] ; then \
73027c94 2228 for file in $$dir/*.o; do \
2229 tail +16c ./$$file > tmp-foo1; \
2230 tail +16c stage2/$$file > tmp-foo2 2>/dev/null \
2231 && (cmp tmp-foo1 tmp-foo2 || echo $$file differs); \
9771451c 2232 done; \
2233 fi; \
73027c94 2234 done
48c6936b 2235 -rm -f tmp-foo*
2236
2237# Similar, but compare with stage3 directory
2238compare3: force
2239 for file in *.o; do \
73027c94 2240 tail +16c ./$$file > tmp-foo1; \
77a164d8 2241 tail +16c stage3/$$file > tmp-foo2 2>/dev/null \
2242 && (cmp tmp-foo1 tmp-foo2 || echo $$file differs); \
48c6936b 2243 done
73027c94 2244 for dir in tmp-foo $(SUBDIRS); do \
848a4a74 2245 if [ "`echo $$dir/*.o`" != "$$dir/*.o" ] ; then \
73027c94 2246 for file in $$dir/*.o; do \
2247 tail +16c ./$$file > tmp-foo1; \
2248 tail +16c stage3/$$file > tmp-foo2 2>/dev/null \
2249 && (cmp tmp-foo1 tmp-foo2 || echo $$file differs); \
9771451c 2250 done; \
2251 fi; \
73027c94 2252 done
48c6936b 2253 -rm -f tmp-foo*
2254
f72bf186 2255# Compare the object files in the current directory with those in the
2256# stage2 directory. Use gnu cmp (diffutils v2.4 or later) to avoid
2257# running tail and the overhead of twice copying each object file.
2258
2259gnucompare: force
2260 for file in *.o; do \
2261 cmp --ignore-initial=16 $$file stage2/$$file || true ; \
2262 done
73027c94 2263 for dir in tmp-foo $(SUBDIRS); do \
848a4a74 2264 if [ "`echo $$dir/*.o`" != "$$dir/*.o" ] ; then \
73027c94 2265 for file in $$dir/*.o; do \
2266 cmp --ignore-initial=16 $$file stage2/$$file || true ; \
9771451c 2267 done; \
2268 fi; \
73027c94 2269 done
f72bf186 2270
2271# Similar, but compare with stage3 directory
2272gnucompare3: force
2273 for file in *.o; do \
2274 cmp --ignore-initial=16 $$file stage3/$$file || true ; \
2275 done
73027c94 2276 for dir in tmp-foo $(SUBDIRS); do \
848a4a74 2277 if [ "`echo $$dir/*.o`" != "$$dir/*.o" ] ; then \
73027c94 2278 for file in $$dir/*.o; do \
2279 cmp --ignore-initial=16 $$file stage3/$$file || true ; \
9771451c 2280 done; \
2281 fi; \
73027c94 2282 done
f72bf186 2283
32e6d418 2284# Copy the object files from a particular stage into a subdirectory.
73027c94 2285stage1-start:
c6396a0b 2286 -if [ -d stage1 ] ; then true ; else mkdir stage1 ; fi
73027c94 2287 -for dir in . $(SUBDIRS) ; \
2288 do \
2289 if [ -d stage1/$$dir ] ; then true ; else mkdir stage1/$$dir ; fi \
2290 done
32e6d418 2291 -mv $(STAGESTUFF) stage1
2292 -rm -f stage1/libgcc.a
2293 -cp libgcc.a stage1
2294 -if $(RANLIB_TEST) ; then $(RANLIB) stage1/libgcc.a; else true; fi
73027c94 2295stage1: force stage1-start lang.stage1
32e6d418 2296
73027c94 2297stage2-start:
c6396a0b 2298 -if [ -d stage2 ] ; then true ; else mkdir stage2 ; fi
73027c94 2299 -for dir in . $(SUBDIRS) ; \
2300 do \
2301 if [ -d stage2/$$dir ] ; then true ; else mkdir stage2/$$dir ; fi \
2302 done
32e6d418 2303 -mv $(STAGESTUFF) stage2
2304 -rm -f stage2/libgcc.a
2305 -cp libgcc.a stage2
2306 -if $(RANLIB_TEST) ; then $(RANLIB) stage2/libgcc.a; else true; fi
73027c94 2307stage2: force stage2-start lang.stage2
32e6d418 2308
73027c94 2309stage3-start:
2388f67d 2310 -if [ -d stage3 ] ; then true ; else mkdir stage3 ; fi
73027c94 2311 -for dir in . $(SUBDIRS) ; \
2312 do \
2313 if [ -d stage3/$$dir ] ; then true ; else mkdir stage3/$$dir ; fi \
2314 done
32e6d418 2315 -mv $(STAGESTUFF) stage3
2316 -rm -f stage3/libgcc.a
2317 -cp libgcc.a stage3
2318 -if $(RANLIB_TEST) ; then $(RANLIB) stage3/libgcc.a; else true; fi
73027c94 2319stage3: force stage3-start lang.stage3
32e6d418 2320
73027c94 2321stage4-start:
2388f67d 2322 -if [ -d stage4 ] ; then true ; else mkdir stage4 ; fi
73027c94 2323 -for dir in . $(SUBDIRS) ; \
2324 do \
2325 if [ -d stage4/$$dir ] ; then true ; else mkdir stage4/$$dir ; fi \
2326 done
32e6d418 2327 -mv $(STAGESTUFF) stage4
2328 -rm -f stage4/libgcc.a
2329 -cp libgcc.a stage4
2330 -if $(RANLIB_TEST) ; then $(RANLIB) stage4/libgcc.a; else true; fi
73027c94 2331stage4: force stage4-start lang.stage4
32e6d418 2332
2333# Copy just the executable files from a particular stage into a subdirectory,
2334# and delete the object files. Use this if you're just verifying a version
2335# that is pretty sure to work, and you are short of disk space.
2336risky-stage1: force
2388f67d 2337 -if [ -d stage1 ] ; then true ; else mkdir stage1 ; fi
e650197c 2338 -mv $(GCC_PARTS) stage1
32e6d418 2339 -rm -f stage1/libgcc.a
2340 -cp libgcc.a stage1 && $(RANLIB) stage1/libgcc.a
2341 -make clean
2342
2343risky-stage2: force
2388f67d 2344 -if [ -d stage2 ] ; then true ; else mkdir stage2 ; fi
e650197c 2345 -mv $(GCC_PARTS) stage2
32e6d418 2346 -rm -f stage2/libgcc.a
2347 -cp libgcc.a stage2 && $(RANLIB) stage2/libgcc.a
2348 -make clean
2349
2350risky-stage3: force
2388f67d 2351 -if [ -d stage3 ] ; then true ; else mkdir stage3 ; fi
e650197c 2352 -mv $(GCC_PARTS) stage3
32e6d418 2353 -rm -f stage3/libgcc.a
2354 -cp libgcc.a stage3 && $(RANLIB) stage3/libgcc.a
2355 -make clean
2356
2357risky-stage4: force
2388f67d 2358 -if [ -d stage4 ] ; then true ; else mkdir stage4 ; fi
e650197c 2359 -mv $(GCC_PARTS) stage4
32e6d418 2360 -rm -f stage4/libgcc.a
2361 -cp libgcc.a stage4 && $(RANLIB) stage4/libgcc.a
2362 -make clean
2363
2364#In GNU Make, ignore whether `stage*' exists.
2365.PHONY: stage1 stage2 stage3 stage4 clean realclean TAGS bootstrap
2366.PHONY: risky-stage1 risky-stage2 risky-stage3 risky-stage4
2367
2368force: