]> gcc.gnu.org Git - gcc.git/blame - gcc/Makefile.in
(output_move_quad): Implement CNSTOP case.
[gcc.git] / gcc / Makefile.in
CommitLineData
79d8453e 1# Makefile for GNU C compiler.
ac155eb2 2# Copyright (C) 1987, 88, 90, 91, 92, 1993 Free Software Foundation, Inc.
79d8453e
RS
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,
2e494f70 22# uninstall, TAGS, mostlyclean, clean, distclean, realclean,
79d8453e
RS
23# stage1, stage2, stage3, stage4.
24
2e494f70
RS
25# Suppress smart makes who think they know how to automake Yacc files
26.y.c:
27
79d8453e
RS
28# Variables that exist for you to override.
29# See below for how to change them for certain systems.
30
31# Selection of languages to be made.
32LANGUAGES = c c++ objective-c proto
33
34ALLOCA =
8d86aaea 35ALLOCA_FLAGS =
2a7bccbb 36ALLOCA_FINISH = true
79d8453e
RS
37
38# Various ways of specifying flags for compilations:
39# CFLAGS is for the user to override to, e.g., do a bootstrap with -O2.
40# BOOT_CFLAGS is the value of CFLAGS to pass
41# to the stage2 and stage3 compilations
42# XCFLAGS is used for most compilations but not when using the GCC just built.
43XCFLAGS =
44CFLAGS = -g
45BOOT_CFLAGS = -O $(CFLAGS)
46# These exists to be overridden by the x-* and t-* files, respectively.
47X_CFLAGS =
48T_CFLAGS =
49
50X_CPPFLAGS =
51T_CPPFLAGS =
52
53CC = cc
54BISON = bison
0777e4c6 55BISONFLAGS =
79d8453e
RS
56AR = ar
57OLDAR_FLAGS = qc
58AR_FLAGS = rc
59SHELL = /bin/sh
60# on sysV, define this as cp.
61INSTALL = install -c
62# These permit overriding just for certain files.
63INSTALL_PROGRAM = $(INSTALL)
64INSTALL_DATA = $(INSTALL)
65SYMLINK = ln -s
fcd40e95 66MAKEINFO = makeinfo
d8984b6e 67TEXI2DVI = texi2dvi
79d8453e
RS
68
69# Define this as & to perform parallel make on a Sequent.
70# Note that this has some bugs, and it seems currently necessary
71# to compile all the gen* files first by hand to avoid erroneous results.
72P =
73
74# How to invoke ranlib.
75RANLIB = ranlib
76# Test to use to see whether ranlib exists on the system.
77RANLIB_TEST = [ -f /usr/bin/ranlib -o -f /bin/ranlib ]
78
79# Compiler to use for compiling libgcc1.a.
80# OLDCC should not be the GNU C compiler,
81# since that would compile typical libgcc1.a functions such as mulsi3
82# into infinite recursions.
83OLDCC = cc
84
85# CFLAGS for use with OLDCC, for compiling libgcc1.a.
86# NOTE: -O does not work on some Unix systems!
87CCLIBFLAGS = -O
88
2e494f70 89# Version of ar to use when compiling libgcc1.a.
79d8453e
RS
90OLDAR = ar
91
ba1811f1
ILT
92# Target to use when installing include directory. Either
93# install-headers-tar or install-headers-cpio.
94INSTALL_HEADERS_DIR = install-headers-tar
95
bf428f48
RS
96# The GCC to use for compiling libgcc2.a, enquire, and cross-test.
97# Usually the one we just built.
79d8453e 98# Don't use this as a dependency--use $(GCC_PASSES) or $(GCC_PARTS).
f2e663b6 99GCC_FOR_TARGET = ./xgcc -B./
79d8453e
RS
100
101# This is used instead of ALL_CFLAGS when compiling with GCC_FOR_TARGET.
102# It omits XCFLAGS, and specifies -B./.
bf428f48 103# It also specifies -B$(tooldir)/ to find as and ld for a cross compiler.
57cd2ea1 104GCC_CFLAGS=$(INTERNAL_CFLAGS) $(X_CFLAGS) $(T_CFLAGS) $(CFLAGS)
79d8453e
RS
105
106# Special flags for compiling enquire.
107# We disable optimization to make floating point more reliable.
e18eb523 108ENQUIRE_CFLAGS = -DNO_MEM -DNO_STDDEF -DNO_LONG_DOUBLE_IO -O0
79d8453e
RS
109ENQUIRE_LDFLAGS = $(LDFLAGS)
110
111# Tools to use when building a cross-compiler.
112# These are used because `configure' appends `cross-make'
113# to the makefile when making a cross-compiler.
114
115TARGET_TOOLPREFIX = $(tooldir)/bin/
116AR_FOR_TARGET = $(TARGET_TOOLPREFIX)ar
117AR_FOR_TARGET_FLAGS = rc
118RANLIB_FOR_TARGET = $(TARGET_TOOLPREFIX)ranlib
119RANLIB_TEST_FOR_TARGET = [ -f $(TARGET_TOOLPREFIX)ranlib ]
79d8453e 120
1402d22c
RS
121# Dir to search for system headers. Overridden by cross-make.
122SYSTEM_HEADER_DIR = /usr/include
123
20bd0ab1
RS
124# There may be a premade insn-attrtab.c for this machine.
125# (You could rebuild it with genattrtab as usual, but it takes a long time.)
126# PREMADE_ATTRTAB is the file name of the file to use.
127# PREMADE_ATTRTAB_MD is the md file it corresponds to.
128PREMADE_ATTRTAB_MD = Makefile # Guaranteed not to cmp equal to md.
129PREMADE_ATTRTAB =
130
79d8453e
RS
131target= ... `configure' substitutes actual target name here.
132xmake_file= ... `configure' substitutes actual x- file name here.
133tmake_file= ... `configure' substitutes actual t- file name here.
2c514f26 134version=`sed -e 's/.*\"\([^ \"]*\)[ \"].*/\1/' < $(srcdir)/version.c`
79d8453e
RS
135
136# Directory where sources are, from where we are.
137srcdir = .
138# Common prefix for installation directories.
139# NOTE: This directory must exist when you start installation.
140prefix = /usr/local
c844ddda
RS
141# Directory in which to put localized header files. On the systems with
142# gcc as the native cc, `local_prefix' may not be `prefix' which is
143# `/usr'.
0b2fbcb2
RS
144# NOTE: local_prefix *should not* default from prefix.
145local_prefix = /usr/local
2e494f70
RS
146# Directory in which to put host dependent programs and libraries
147exec_prefix = $(prefix)
79d8453e 148# Directory in which to put the executable for the command `gcc'
2e494f70 149bindir = $(exec_prefix)/bin
79d8453e 150# Directory in which to put the directories used by the compiler.
2e494f70 151libdir = $(exec_prefix)/lib
79d8453e 152# Directory in which the compiler finds executables, libraries, etc.
2e494f70 153libsubdir = $(libdir)/gcc-lib/$(target)/$(version)
49ba557e 154# Directory to search for site-specific includes.
4b7179be 155includedir = $(local_prefix)/include
6204c24f 156# assertdir is overridden in cross-make.
7b4d5f42
RS
157# (But this currently agrees with what is in cross-make.)
158assertdir = $(tooldir)/include
0b2fbcb2
RS
159# where the info files go
160infodir = $(prefix)/info
79d8453e
RS
161# Extension (if any) to put in installed man-page filename.
162manext = .1
163# Directory in which to put man pages.
164mandir = $(prefix)/man/man1
165# Directory in which to find other cross-compilation tools and headers.
166# Used in install-cross.
47279178 167tooldir = $(exec_prefix)/$(target)
62c13b81
RS
168# Dir for temp files.
169tmpdir = /tmp
79d8453e
RS
170
171# Additional system libraries to link with.
172CLIB=
173
174# Change this to a null string if obstacks are installed in the
175# system library.
176OBSTACK=obstack.o
177
b583eed8
DE
178# Specify the rule for actually making libgcc.a,
179LIBGCC = libgcc.a
180# and the rule for installing it.
181INSTALL_LIBGCC = install-libgcc
182
79d8453e 183# Specify the rule for actually making libgcc1.a.
2e494f70
RS
184# The value may be empty; that means to do absolutely nothing
185# with or for libgcc1.a.
79d8453e
RS
186LIBGCC1 = libgcc1.a
187
188# Specify the rule for actually making libgcc2.a.
189LIBGCC2 = libgcc2.a
190
191# Options to use when compiling libgcc2.a.
192# -g1 causes output of debug info only for file-scope entities.
193# we use this here because that should be enough, and also
194# so that -g1 will be tested.
56f9206d
ILT
195LIBGCC2_CFLAGS = -O2 $(LIBGCC2_INCLUDES) $(GCC_CFLAGS) -g1
196
197# Additional options to use when compiling libgcc2.a.
198# Some targets override this to -Iinclude
199LIBGCC2_INCLUDES =
200
201# Things which must be built before building libgcc2.a.
202# Some targets override this to stmp-int-hdrs
203LIBGCC2_DEPS =
79d8453e
RS
204
205# List of extra executables that should be compiled for this target machine
206# that are used for compiling from source code to object code.
207# The rules for compiling them should be in the t-* file for the machine.
208EXTRA_PASSES =
209
2e494f70
RS
210# Like EXTRA_PASSES, but these are used when linking.
211EXTRA_PROGRAMS =
212
213# List of extra object files that should be compiled for this target machine.
79d8453e
RS
214# The rules for compiling them should be in the t-* file for the machine.
215EXTRA_PARTS =
216
2e494f70
RS
217# List of extra object files that should be compiled and linked with
218# compiler proper (cc1, cc1obj, cc1plus).
219EXTRA_OBJS =
220
f780d21b
RS
221# List of additional header files to install.
222# Often this is edited directly by `configure'.
223EXTRA_HEADERS =
224
47547081
RS
225# Set this to `ld' to enable use of collect2.
226# USE_COLLECT2 =
227# It is convenient for configure to add the assignment at the beginning,
228# so don't override it here.
229
79d8453e
RS
230# List of extra C and assembler files to add to libgcc1.a.
231# Assembler files should have names ending in `.asm'.
232LIB1FUNCS_EXTRA =
233
234# List of extra C and assembler files to add to libgcc2.a.
235# Assembler files should have names ending in `.asm'.
236LIB2FUNCS_EXTRA =
237
ba1811f1
ILT
238# Default float.h source to use for cross-compiler.
239CROSS_FLOAT_H=float.h-cross
240
79d8453e
RS
241# Program to convert libraries.
242LIBCONVERT =
243
244# Control whether header files are installed.
79d8453e
RS
245INSTALL_HEADERS=install-headers
246
0d4d8174
RS
247# Options for tar when copying trees. So HPUX can override it.
248TAROUTOPTS = xpBf
249
79d8453e 250# Select which version of fixincludes to use (I.E. regular versus SVR4)
98e4b835 251# This value is overridden directly by configure.
79d8453e
RS
252FIXINCLUDES=fixincludes
253
66d7ffbf 254# Additional directories of header files to run fixincludes on.
4ab08223
RS
255# These should be directories searched automatically by default
256# just as /usr/include is.
257# *Do not* use this for directories that happen to contain
258# header files, but are not searched automatically by default.
66d7ffbf
RS
259# On most systems, this is empty.
260OTHER_FIXINCLUDES_DIRS=
261
acbbf3d9 262# List of things which should already be built whenever we try to use xgcc
79d8453e 263# to compile anything (without linking).
acbbf3d9 264GCC_PASSES=xgcc cc1 cpp $(EXTRA_PASSES)
79d8453e 265
acbbf3d9 266# List of things which should already be built whenever we try to use xgcc
79d8453e 267# to link anything.
b583eed8 268GCC_PARTS=$(GCC_PASSES) $(LIBGCC) $(EXTRA_PROGRAMS) $(USE_COLLECT2) $(EXTRA_PARTS)
79d8453e 269
79d8453e
RS
270# Directory to link to, when using the target `maketest'.
271DIR = ../gcc
272
273# Flags to use when cross-building GCC.
274# Prefix to apply to names of object files when using them
275# to run on the machine we are compiling on.
276HOST_PREFIX=
277# Prefix to apply to names of object files when compiling them
278# to run on the machine we are compiling on.
279# The default for this variable is chosen to keep these rules
280# out of the way of the other rules for compiling the same source files.
281HOST_PREFIX_1=loser-
282HOST_CC=$(CC)
283HOST_CFLAGS=$(ALL_CFLAGS)
2e494f70 284HOST_CLIB=$(CLIB)
79d8453e
RS
285HOST_LDFLAGS=$(LDFLAGS)
286HOST_CPPFLAGS=$(ALL_CPPFLAGS)
2e494f70
RS
287HOST_ALLOCA=$(ALLOCA)
288HOST_MALLOC=$(MALLOC)
289HOST_OBSTACK=$(OBSTACK)
79d8453e
RS
290
291# Choose the real default target.
292ALL=all.internal
293
294# Choose the real install target.
ba1811f1
ILT
295INSTALL_TARGET=install-normal
296
297# Source for float.h. Overridden by cross-make.
298FLOAT_H=float.h-nat
79d8453e
RS
299
300# End of variables for you to override.
301
302# Definition of `all' is here so that new rules inserted by sed
303# do not specify the default target.
304# The real definition is under `all.internal' (for native compilers)
305# or `all.cross' (for cross compilers).
2e494f70 306all: all.indirect
79d8453e 307
be0d23ff
RS
308# This tells GNU Make version 3 not to put all variables in the environment.
309.NOEXPORT:
310
79d8453e 311# sed inserts variable overrides after the following line.
60d00117
TW
312####target overrides
313####host overrides
314####cross overrides
057f494b 315####build overrides
79d8453e
RS
316\f
317# Now figure out from those variables how to compile and link.
318
2e494f70
RS
319all.indirect: $(ALL)
320
b4f96011
RS
321# IN_GCC tells obstack.h to use gstddef.h.
322INTERNAL_CFLAGS = $(CROSS) -DIN_GCC
79d8453e
RS
323
324# This is the variable actually used when we compile.
325ALL_CFLAGS = $(INTERNAL_CFLAGS) $(X_CFLAGS) $(T_CFLAGS) $(CFLAGS) $(XCFLAGS)
326
327# Likewise.
328ALL_CPPFLAGS = $(CPPFLAGS) $(X_CPPFLAGS) $(T_CPPFLAGS)
329
330# Even if ALLOCA is set, don't use it if compiling with GCC.
2e494f70
RS
331USE_ALLOCA= ` case "${CC}" in "${OLDCC}") echo ${ALLOCA} ;; esac `
332USE_HOST_ALLOCA= ` case "${HOST_CC}"@"${HOST_ALLOCA}" in "${OLDCC}"@?*) echo ${HOST_PREFIX}${HOST_ALLOCA} ;; esac `
333USE_HOST_MALLOC= ` case "${HOST_MALLOC}" in ?*) echo ${HOST_PREFIX}${HOST_MALLOC} ;; esac `
334USE_HOST_OBSTACK= ` case "${HOST_OBSTACK}" in ?*) echo ${HOST_PREFIX}${HOST_OBSTACK} ;; esac `
79d8453e
RS
335
336# Dependency on obstack, alloca, malloc or whatever library facilities
337# are not installed in the system libraries.
338# We don't use USE_ALLOCA because backquote expansion doesn't work in deps.
339LIBDEPS= $(OBSTACK) $(ALLOCA) $(MALLOC)
340
341# Likewise, for use in the tools that must run on this machine
342# even if we are cross-building GCC.
343# We don't use USE_ALLOCA because backquote expansion doesn't work in deps.
2e494f70 344HOST_LIBDEPS= $(HOST_PREFIX)$(HOST_OBSTACK) $(HOST_PREFIX)$(HOST_ALLOCA) $(HOST_PREFIX)$(HOST_MALLOC)
79d8453e
RS
345
346# How to link with both our special library facilities
347# and the system's installed libraries.
348LIBS = $(OBSTACK) $(USE_ALLOCA) $(MALLOC) $(CLIB)
349
350# Likewise, for use in the tools that must run on this machine
351# even if we are cross-building GCC.
2e494f70
RS
352HOST_LIBS = $(USE_HOST_OBSTACK) $(USE_HOST_ALLOCA) $(USE_HOST_MALLOC) \
353 $(HOST_CLIB)
79d8453e
RS
354
355HOST_RTL = $(HOST_PREFIX)rtl.o
356HOST_RTLANAL = $(HOST_PREFIX)rtlanal.o
d3614a37 357HOST_PRINT = $(HOST_PREFIX)print-rtl.o
79d8453e
RS
358
359# Specify the directories to be searched for header files.
360# Both . and srcdir are used, in that order,
361# so that tm.h and config.h will be found in the compilation
362# subdirectory rather than in the source directory.
363INCLUDES = -I. -I$(srcdir) -I$(srcdir)/config
364SUBDIR_INCLUDES = -I.. -I../$(srcdir) -I../$(srcdir)/config
365
366# Always use -I$(srcdir)/config when compiling.
367.c.o:
368 $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $<
369
370# This tells GNU make version 3 not to export all the variables
371# defined in this file into the environment.
372.NOEXPORT:
373\f
374# Lists of files for various purposes.
375
376# A list of all the language-specific executables.
377COMPILERS = cc1 cc1plus cc1obj
378
379# Language-specific object files for C.
f10fec92
RS
380C_OBJS = c-parse.o c-lang.o c-lex.o c-pragma.o \
381 c-decl.o c-typeck.o c-convert.o c-aux-info.o c-common.o c-iterate.o
79d8453e 382
ccfc4033 383# Language-specific object files for Objective C.
f10fec92
RS
384OBJC_OBJS = objc-parse.o objc-act.o c-lex.o c-pragma.o \
385 c-decl.o c-typeck.o c-convert.o c-aux-info.o c-common.o c-iterate.o
79d8453e
RS
386
387# Language-specific object files for C++.
388CPLUS_OBJS = cp-parse.o cp-decl.o cp-decl2.o \
389 cp-typeck.o cp-type2.o cp-tree.o cp-ptree.o \
390 cp-cvt.o cp-search.o cp-lex.o cp-gc.o cp-call.o \
391 cp-class.o cp-init.o cp-method.o cp-except.o \
392 cp-expr.o cp-pt.o cp-edsel.o cp-xref.o \
393 $(CPLUS_INPUT) cp-spew.o c-common.o
394
395# Language-independent object files.
396OBJS = toplev.o version.o tree.o print-tree.o stor-layout.o fold-const.o \
397 function.o stmt.o expr.o calls.o expmed.o explow.o optabs.o varasm.o \
ee7e5441 398 rtl.o print-rtl.o rtlanal.o emit-rtl.o real.o \
47547081 399 dbxout.o sdbout.o dwarfout.o xcoffout.o \
79d8453e 400 integrate.o jump.o cse.o loop.o unroll.o flow.o stupid.o combine.o \
f0ec1f64 401 regclass.o local-alloc.o global.o reload.o reload1.o caller-save.o \
79d8453e 402 insn-peep.o reorg.o sched.o final.o recog.o reg-stack.o \
118bdbf8 403 insn-opinit.o insn-recog.o insn-extract.o insn-output.o insn-emit.o \
10055ae2 404 insn-attrtab.o aux-output.o getpwd.o convert.o $(EXTRA_OBJS)
79d8453e
RS
405
406# GEN files are listed separately, so they can be built before doing parallel
407# makes for cc1 or cc1plus. Otherwise sequent parallel make attempts to load
408# them before rtl.o is compiled.
409GEN= genemit genoutput genrecog genextract genflags gencodes genconfig genpeep
410
411# Files to be copied away after each stage in building.
412STAGESTUFF = *.o insn-flags.h insn-config.h insn-codes.h \
413 insn-output.c insn-recog.c insn-emit.c insn-extract.c insn-peep.c \
8fad1c10 414 insn-attr.h insn-attrtab.c insn-opinit.c \
79d8453e
RS
415 stamp-flags stamp-config stamp-codes \
416 stamp-output stamp-recog stamp-emit stamp-extract stamp-peep \
8fad1c10 417 stamp-attr stamp-attrtab stamp-opinit stamp-proto \
79d8453e 418 genemit genoutput genrecog genextract genflags gencodes genconfig genpeep \
8fad1c10 419 genattrtab genattr genopinit \
47547081 420 $(GCC_PASSES) $(EXTRA_PARTS) $(EXTRA_PROGRAMS) gcc-cross cccp \
9c0022f6 421 cc1plus cc1obj enquire protoize unprotoize specs collect2 $(USE_COLLECT2)
79d8453e
RS
422
423# Members of libgcc1.a.
424LIB1FUNCS = _mulsi3 _udivsi3 _divsi3 _umodsi3 _modsi3 \
425 _lshrsi3 _lshlsi3 _ashrsi3 _ashlsi3 \
426 _divdf3 _muldf3 _negdf2 _adddf3 _subdf3 \
427 _fixdfsi _fixsfsi _floatsidf _floatsisf _truncdfsf2 _extendsfdf2 \
428 _addsf3 _negsf2 _subsf3 _mulsf3 _divsf3 \
429 _eqdf2 _nedf2 _gtdf2 _gedf2 _ltdf2 _ledf2 \
430 _eqsf2 _nesf2 _gtsf2 _gesf2 _ltsf2 _lesf2
431
432# Library members defined in libgcc2.c.
433LIB2FUNCS = _muldi3 _divdi3 _moddi3 _udivdi3 _umoddi3 _negdi2 \
eccf291b 434 _lshrdi3 _lshldi3 _ashldi3 _ashrdi3 _ffsdi2 \
3af18470 435 _udiv_w_sdiv _udivmoddi4 _cmpdi2 _ucmpdi2 _floatdidf _floatdisf \
79d8453e 436 _fixunsdfsi _fixunssfsi _fixunsdfdi _fixdfdi _fixunssfdi _fixsfdi \
3971e415 437 _fixxfdi _fixunsxfdi _floatdixf _fixunsxfsi \
96047291 438 __gcc_bcmp _varargs _eprintf _op_new _new_handler _op_delete \
0380c535 439 _bb _shtab _clear_cache _trampoline __main _exit _ctors
79d8453e
RS
440
441# Header files that are made available under the same name
acbbf3d9 442# to programs compiled with GCC.
7bea819f 443USER_H = va-alpha.h va-i860.h va-i960.h va-mips.h va-m88k.h \
581ed239 444 va-pa.h va-pyr.h va-sparc.h va-clipper.h va-spur.h proto.h $(EXTRA_HEADERS)
79d8453e 445
79d8453e
RS
446# The files that "belong" in CONFIG_H are deliberately omitted
447# because having them there would not be useful in actual practice.
448# All they would do is cause complete recompilation every time
449# one of the machine description files is edited.
450# That may or may not be what one wants to do.
451# If it is, rm *.o is an easy way to do it.
452# CONFIG_H = config.h tm.h
453CONFIG_H =
454RTL_H = rtl.h rtl.def machmode.h machmode.def
455TREE_H = tree.h real.h tree.def machmode.h machmode.def
456CPLUS_TREE_H = $(TREE_H) cp-tree.h cp-tree.def
457\f
458# Avoid a lot of time thinking about remaking Makefile.in and *.def.
459.SUFFIXES: .in .def
460
47547081 461Makefile: $(srcdir)/Makefile.in $(srcdir)/configure $(srcdir)/version.c \
79d8453e
RS
462 $(srcdir)/config/$(xmake_file) $(srcdir)/config/$(tmake_file)
463 sh config.status
464
465all.internal: start.encap rest.encap
466# This is what to compile if making a cross-compiler.
42396e97
RS
467# Note that we can compile enquire using the cross-compiler just build,
468# although we can't run it on this machine.
b583eed8 469all.cross: native gcc-cross specs $(LIBGCC) stmp-headers cross-test enquire $(EXTRA_PARTS)
057f494b 470# This is what to compile if making gcc with a cross-compiler.
9df7926f 471all.build: native xgcc $(EXTRA_PARTS)
79d8453e 472# This is what must be made before installing GCC and converting libraries.
1402d22c 473start.encap: native xgcc specs $(LIBGCC1) xlimits.h
79d8453e 474# Use this to make a GCC that will be used only to recompile GCC.
b583eed8 475for-bootstrap: start.encap $(LIBGCC)
79d8453e 476# These can't be made, with COFF encapsulation, until after GCC can run.
b583eed8 477rest.encap: $(LIBGCC) stmp-headers $(EXTRA_PARTS)
79d8453e
RS
478# This is what is made with the host's compiler
479# whether making a cross compiler or not.
47547081 480native: config.status cpp $(LANGUAGES) $(EXTRA_PASSES) $(EXTRA_PROGRAMS) $(USE_COLLECT2)
79d8453e
RS
481
482# Define the names for selecting languages in LANGUAGES.
483C c: cc1
484C++ c++: cc1plus
0d4d8174
RS
485# The next two ought to depend on objc-runtime, but that doesn't work yet.
486OBJC objc: cc1obj
487OBJECTIVE-C objective-c: cc1obj
79d8453e
RS
488PROTO: proto
489
2e494f70
RS
490# Really, really stupid make features, such as SUN's KEEP_STATE, may force
491# a target to build even if it is up-to-date. So we must verify that
492# config.status does not exist before failing.
79d8453e 493config.status:
2e494f70
RS
494 @if [ ! -f config.status ] ; then \
495 echo You must configure gcc. Look at the INSTALL file for details.; \
496 false; \
497 else \
498 true; \
499 fi
79d8453e 500
3aa072f2
RS
501# On the target machine, finish building a cross compiler.
502# This does the things that can't be done on the host machine.
b583eed8 503rest.cross: $(LIBGCC) gfloat.h specs
3aa072f2 504
e97ed334
RS
505# Verify that it works to compile and link cross-test.
506# If it does, then there are sufficient replacements for libgcc1.a.
b583eed8 507cross-test: cross-test.o native gcc-cross $(LIBGCC) $(GCC_PARTS)
e97ed334
RS
508 $(GCC_FOR_TARGET) $(GCC_CFLAGS) cross-test.o -o $@
509cross-test.o: cross-test.c native gcc-cross
510 $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(ALL_CPPFLAGS) -c $(srcdir)/cross-test.c
511
3aa072f2
RS
512# Recompile all the language-independent object files.
513# This is used only if the user explicitly asks for it.
79d8453e
RS
514compilations: ${OBJS}
515
acbbf3d9
RS
516# We call this executable `xgcc' rather than `gcc'
517# to avoid confusion if the current directory is in the path
518# and CC is `gcc'. It is renamed to `gcc' when it is installed.
519xgcc: gcc.o version.o $(LIBDEPS)
520 $(CC) $(ALL_CFLAGS) $(LDFLAGS) -o xgcc gcc.o version.o $(LIBS)
3aa072f2
RS
521
522# Dump a specs file to make -B./ read these specs over installed ones.
acbbf3d9 523specs: xgcc
74c84fe6 524 $(GCC_FOR_TARGET) -dumpspecs > specs
79d8453e 525
acbbf3d9 526# We do want to create an executable named `xgcc', so we can use it to
79d8453e
RS
527# compile libgcc2.a.
528# Also create gcc-cross, so that install-common will install properly.
acbbf3d9
RS
529gcc-cross: xgcc
530 cp xgcc gcc-cross
79d8453e
RS
531
532cc1:$(P) $(C_OBJS) $(OBJS) $(LIBDEPS)
533 $(CC) $(ALL_CFLAGS) $(LDFLAGS) -o cc1 $(C_OBJS) $(OBJS) $(LIBS)
534
535cc1plus:$(P) $(CPLUS_OBJS) $(OBJS) $(LIBDEPS)
536 $(CC) $(ALL_CFLAGS) $(LDFLAGS) -o cc1plus $(CPLUS_OBJS) $(OBJS) $(LIBS)
537
538cc1obj:$(P) $(OBJC_OBJS) $(OBJS) $(LIBDEPS)
539 $(CC) $(ALL_CFLAGS) $(LDFLAGS) -o cc1obj $(OBJC_OBJS) $(OBJS) $(LIBS)
540
ba1811f1 541# Copy float.h from its source.
42118350
RK
542gfloat.h: $(FLOAT_H)
543 cp $(FLOAT_H) gfloat.h
ba1811f1
ILT
544
545# Create float.h source for the native machine.
546float.h-nat: enquire
1e558d35
RS
547 -./enquire -f > tmp-float.h
548 mv tmp-float.h float.h-nat
ba1811f1
ILT
549
550# Create a dummy float.h source for a cross-compiler.
551float.h-cross:
552 echo "#error float.h values not known for cross-compiler" > float.h-cross
79d8453e
RS
553
554# Used to compile enquire with standard cc, but have forgotten why.
555# Let's try with GCC.
556enquire: enquire.o $(GCC_PARTS)
557 $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(ENQUIRE_LDFLAGS) enquire.o -o $@
558enquire.o: $(srcdir)/enquire.c $(GCC_PASSES)
e3e873d2
RS
559# -if [ "$(srcdir)" != "." ]; then rm -f ./enquire.c; else true; fi
560# -cp $(srcdir)/enquire.c . > /dev/null 2>&1
2e494f70 561# Breaking this line caused a problem with one version of GNU make.
e3e873d2 562 $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(ALL_CPPFLAGS) $(ENQUIRE_CFLAGS) -I. -c $(srcdir)/enquire.c
1402d22c
RS
563
564# Build the version of limits.h that we will install.
565xlimits.h: glimits.h limitx.h limity.h
566 if [ -f $(SYSTEM_HEADER_DIR)/limits.h ] ; then \
567 cat $(srcdir)/limitx.h $(srcdir)/glimits.h $(srcdir)/limity.h > xlimits.h; \
568 else \
569 cat $(srcdir)/glimits.h > xlimits.h; \
570 fi
79d8453e
RS
571\f
572# Build libgcc.a.
573# This is done in two parts because some functions, in libgcc1.c,
acbbf3d9
RS
574# must be compiled with something other than GCC,
575# while the rest, in libgcc2.c, must be compiled with xgcc.
576# That means we can't do libgcc2.c until after xgcc, cc1, etc.
79d8453e
RS
577
578# Use this as value of LIBGCC1 to cause conversion to GNU library format.
579# LIBCONVERT should put its output in libgcc1.conv.
580libgcc1.conv: libgcc1.a
581 $(LIBCONVERT) libgcc1.a libgcc1.conv
582
583# Use this as value of LIBGCC1 to inhibit use of libgcc1.c entirely.
584# Make an empty file instead.
57cd2ea1 585libgcc1.null: $(GCC_PASSES)
79d8453e
RS
586 echo "__foo () {}" > dummy.c
587 $(GCC_FOR_TARGET) $(GCC_CFLAGS) -c dummy.c
588 $(OLDAR) $(OLDAR_FLAGS) libgcc1.null dummy.o
589 rm -f dummy.o dummy.c
590
b7ac21e3
RS
591# This is $(LIBGCC1) for a cross-compiler.
592# We have no automatic way of building libgcc1.a,
593# so it's up to the installer to find a way to do that.
594# This rule deliberately does not depend on libgcc1.a
595# so that it will fail if the installer hasn't provided it.
596libgcc1.cross:
597 mv libgcc1.a libgcc1.cross || (echo You must find a way to make libgcc1.a; false)
598
79d8453e 599# Compile the library of arithmetic subroutines with the native compiler.
acbbf3d9 600# Don't compile it with GCC!
79d8453e
RS
601# (That would cause most arithmetic functions to call themselves.)
602libgcc1.a: libgcc1.c $(CONFIG_H) $(LIB1FUNCS_EXTRA) config.status
603 -rm -f tmplibgcc1.a
604# Actually build it in tmplibgcc1.a, then rename at end,
605# so that libgcc1.a itself remains nonexistent if compilation is aborted.
606# -e causes any failing command to make this rule fail.
607# -e doesn't work in certain shells, so we test $$? as well.
608 set -e; \
609 for name in $(LIB1FUNCS); \
610 do \
611 echo $${name}; \
612 rm -f $${name}.o; \
613 $(OLDCC) $(CCLIBFLAGS) $(INCLUDES) -c -DL$${name} $(srcdir)/libgcc1.c; \
614 if [ $$? -eq 0 ] ; then true; else exit 1; fi; \
615 mv libgcc1.o $${name}.o; \
616 $(OLDAR) $(OLDAR_FLAGS) tmplibgcc1.a $${name}.o; \
617 rm -f $${name}.o; \
618 done
619# Some shells crash when a loop has no items.
620# So make sure there is always at least one--`..'.
621# Then ignore it.
622# We don't use -e here because there are if statements
623# that should not make the command give up when the if condition is false.
624# Instead, we test for failure after each command where it matters.
2e494f70 625 -for file in .. $(LIB1FUNCS_EXTRA); \
79d8453e
RS
626 do \
627 if [ x$${file} != x.. ]; then \
628 name=`echo $${file} | sed -e 's/[.]c$$//' -e 's/[.]asm$$//'`; \
629 echo $${name}; \
630 if [ $${name}.asm = $${file} ]; then \
62c13b81 631 cp $${file} $${name}.s || exit 1; file=$${name}.s; \
79d8453e
RS
632 else true; fi; \
633 $(OLDCC) $(CCLIBFLAGS) $(INCLUDES) -c $${file}; \
634 if [ $$? -eq 0 ] ; then true; else exit 1; fi; \
635 $(OLDAR) $(OLDAR_FLAGS) tmplibgcc1.a $${name}.o; \
636 if [ $$? -eq 0 ] ; then true; else exit 1; fi; \
637 rm -f $${name}.[so]; \
638 else true; \
639 fi; \
640 done
641 mv tmplibgcc1.a libgcc1.a
642
643# Compiling libgcc2.a requires making sure that cc1, etc. have been compiled.
644# But recompiling cc1 should not force recompilation of libgcc2.a.
645# If you want to force recompilation, delete libgcc2.a.
56f9206d 646libgcc2.ready: $(GCC_PASSES) $(LIBGCC2_DEPS)
79d8453e
RS
647 -if [ -f libgcc2.ready ] ; then \
648 true; \
649 else \
650 touch libgcc2.ready; \
651 fi
652
653libgcc2.a: libgcc2.c libgcc2.ready $(CONFIG_H) $(LIB2FUNCS_EXTRA) \
bfe655f9 654 machmode.h longlong.h gbl-ctors.h config.status
79d8453e
RS
655# Actually build it in tmplibgcc2.a, then rename at end,
656# so that libgcc2.a itself remains nonexistent if compilation is aborted.
657 -rm -f tmplibgcc2.a
658# -e causes any failing command to make this rule fail.
659# -e doesn't work in certain shells, so we test $$? as well.
660 set -e; \
661 for name in $(LIB2FUNCS); \
662 do \
663 echo $${name}; \
2e494f70 664 $(GCC_FOR_TARGET) $(LIBGCC2_CFLAGS) $(INCLUDES) -c -DL$${name} \
79d8453e
RS
665 $(srcdir)/libgcc2.c -o $${name}.o; \
666 if [ $$? -eq 0 ] ; then true; else exit 1; fi; \
667 $(AR) $(AR_FLAGS) tmplibgcc2.a $${name}.o; \
668 rm -f $${name}.o; \
669 done
670# Some shells crash when a loop has no items.
671# So make sure there is always at least one--`..'.
672# Then ignore it.
673# We don't use -e here because there are if statements
674# that should not make the command give up when the if condition is false.
675# Instead, we test for failure after each command where it matters.
2e494f70 676 -for file in .. $(LIB2FUNCS_EXTRA); \
79d8453e
RS
677 do \
678 if [ x$${file} != x.. ]; then \
679 name=`echo $${file} | sed -e 's/[.]c$$//' -e 's/[.]asm$$//'`; \
680 echo $${name}; \
681 if [ $${name}.asm = $${file} ]; then \
62c13b81 682 cp $${file} $${name}.s || exit 1; file=$${name}.s; \
79d8453e 683 else true; fi; \
2e494f70 684 $(GCC_FOR_TARGET) $(LIBGCC2_CFLAGS) $(INCLUDES) -c $${file}; \
79d8453e
RS
685 if [ $$? -eq 0 ] ; then true; else exit 1; fi; \
686 $(AR) $(AR_FLAGS) tmplibgcc2.a $${name}.o; \
687 rm -f $${name}.[so]; \
688 else true; \
689 fi; \
690 done
691 mv tmplibgcc2.a libgcc2.a
692# These lines were deleted from above the mv command
693# because ranlibing libgcc.a itself should suffice.
694# -if [ x${HPUX_GAS} = x ] ; then \
695# if $(RANLIB_TEST) ; then $(RANLIB) tmplibgcc2.a; else true; fi \
696# else true; fi
697
698# Combine the various libraries into a single library, libgcc.a.
699libgcc.a: $(LIBGCC1) $(LIBGCC2)
700 -rm -rf tmplibgcc.a libgcc.a tmpcopy
701 mkdir tmpcopy
2e494f70
RS
702 -if [ x$(LIBGCC1) != x ]; \
703 then (cd tmpcopy; $(AR) x ../$(LIBGCC1)); \
704 else true; \
705 fi
79d8453e
RS
706 (cd tmpcopy; $(AR) x ../$(LIBGCC2))
707 (cd tmpcopy; $(AR) $(AR_FLAGS) ../tmplibgcc.a *.o)
708 rm -rf tmpcopy
709 -if $(RANLIB_TEST) ; then $(RANLIB) tmplibgcc.a; else true; fi
710# Actually build it in tmplibgcc.a, then rename at end,
711# so that libgcc.a itself remains nonexistent if compilation is aborted.
712 mv tmplibgcc.a libgcc.a
713
ea727bbf
RS
714objc-runtime: libobjc.a
715
8ba23f20 716# Build the Objective C runtime library.
44659439 717libobjc.a: cc1obj libgcc2.ready $(USE_COLLECT2) $(EXTRA_PARTS)
f1553cbb 718 if [ -d objc ]; then true; else mkdir objc; fi
ea727bbf 719 thisdir1=`pwd`; \
265ce9f8 720 srcdir1=`cd $(srcdir); pwd`; \
ea727bbf 721 cd objc; \
5baa9d1f
RS
722 $(MAKE) -f $${srcdir1}/objc/Makefile libobjc.a \
723 srcdir=$${srcdir1} tooldir=$(tooldir) AR="$(AR)" AR_FLAGS="$(AR_FLAGS)" \
724 GCC_FOR_TARGET="$${thisdir1}/xgcc -B$${thisdir1}/" \
ea727bbf 725 GCC_CFLAGS="$(GCC_CFLAGS)"
d8880fea 726 -rm -f libobjc.a
7c3b4722 727 ln objc/libobjc.a . >/dev/null 2>&1 || cp objc/libobjc.a .
ea727bbf
RS
728 -if $(RANLIB_TEST) ; then $(RANLIB) libobjc.a; else true; fi
729
730# This is used by objc/Makefile if the user runs that directly.
731sublibobjc.a: cc1obj libgcc2.ready
265ce9f8
TW
732 thisdir1=`pwd`; \
733 srcdir1=`cd $(srcdir); pwd`; \
734 cd objc; \
d8880fea 735 $(MAKE) -f $$srcdir1/objc/Makefile libobjc.a \
265ce9f8
TW
736 srcdir=$$srcdir1 tooldir=$(tooldir) AR="$(AR)" AR_FLAGS="$(AR_FLAGS)" \
737 GCC_FOR_TARGET="$$thisdir1/xgcc -B$$thisdir1/" \
738 GCC_CFLAGS="$(GCC_CFLAGS)"
79d8453e
RS
739
740# Compile two additional files that are linked with every program
741# linked using GCC on system V, for the sake of C++ constructors.
742crtbegin.o: crtstuff.c $(GCC_PASSES) $(CONFIG_H) gbl-ctors.h
743 $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(INCLUDES) -DCRT_BEGIN \
2e494f70 744 -finhibit-size-directive -g0 -c $(srcdir)/crtstuff.c -o crtbegin.o
79d8453e
RS
745
746crtend.o: crtstuff.c $(GCC_PASSES) $(CONFIG_H) gbl-ctors.h
747 $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(INCLUDES) -DCRT_END \
2e494f70 748 -finhibit-size-directive -g0 -c $(srcdir)/crtstuff.c -o crtend.o
79d8453e
RS
749\f
750# Compiling object files from source files.
751
752# Note that dependencies on obstack.h are not written
753# because that file is not part of GCC.
754# Dependencies on gvarargs.h are not written
755# because all that file does, when not compiling with GCC,
756# is include the system varargs.h.
757
758# C language specific files.
759
c21cf0a7
RS
760c-parse.o : $(srcdir)/c-parse.c $(CONFIG_H) $(TREE_H) c-lex.h c-parse.h \
761 c-tree.h input.h flags.h
79d8453e 762 $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) -c $(srcdir)/c-parse.c
26095868
RS
763$(srcdir)/c-parse.c $(srcdir)/c-parse.h: $(srcdir)/c-parse.y
764 cd $(srcdir); $(BISON) $(BISONFLAGS) -d c-parse.y -o c-parse.c
1c48d17e
RS
765$(srcdir)/c-parse.y: $(srcdir)/c-parse.in
766 sed -e "/^ifobjc$$/,/^end ifobjc$$/d" \
767 -e "/^ifc$$/d" -e "/^end ifc$$/d" \
768 $(srcdir)/c-parse.in > $(srcdir)/c-parse.y
769
79d8453e
RS
770c-decl.o : c-decl.c $(CONFIG_H) $(TREE_H) c-tree.h c-lex.h flags.h
771c-typeck.o : c-typeck.c $(CONFIG_H) $(TREE_H) c-tree.h flags.h
772c-lang.o : c-lang.c $(CONFIG_H) $(TREE_H)
773c-lex.o : c-lex.c $(CONFIG_H) $(TREE_H) c-lex.h c-tree.h c-parse.h \
774 input.h flags.h
775c-aux-info.o : c-aux-info.c $(CONFIG_H) $(TREE_H) c-tree.h flags.h
776c-convert.o : c-convert.c $(CONFIG_H) $(TREE_H) flags.h
bf428f48 777c-pragma.o: c-pragma.c $(CONFIG_H) $(TREE_H)
f10fec92 778c-iterate.o: c-iterate.c $(CONFIG_H) $(TREE_H) $(RTL_H) c-tree.h flags.h
79d8453e
RS
779
780# C++ language specific files.
781
1b212aa8 782cp-parse.o : $(srcdir)/cp-parse.c $(CONFIG_H) $(CPLUS_TREE_H) flags.h cp-lex.h
79d8453e
RS
783 $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \
784 `echo $(srcdir)/cp-parse.c | sed 's,^\./,,'`
785
786$(srcdir)/cp-parse.c $(srcdir)/cp-parse.h : $(srcdir)/cp-parse.y
c157db53 787 @echo expect 29 shift/reduce conflicts and 13 reduce/reduce conflicts
79d8453e 788 cd $(srcdir); $(BISON) $(BISONFLAGS) -d -o cp-parse.c cp-parse.y
b7ac21e3 789 cd $(srcdir); grep '^#define[ ]*YYEMPTY' cp-parse.c >>cp-parse.h
79d8453e
RS
790
791cp-spew.o : cp-spew.c $(CONFIG_H) $(CPLUS_TREE_H) \
1b212aa8 792 $(srcdir)/cp-parse.h flags.h cp-lex.h
79d8453e 793cp-lex.o : cp-lex.c $(CONFIG_H) $(CPLUS_TREE_H) \
1b212aa8 794 $(srcdir)/cp-parse.h $(srcdir)/cp-input.c flags.h cp-hash.h cp-lex.h
79d8453e
RS
795cp-decl.o : cp-decl.c $(CONFIG_H) $(CPLUS_TREE_H) flags.h \
796 cp-lex.h cp-decl.h stack.h
797cp-decl2.o : cp-decl2.c $(CONFIG_H) $(CPLUS_TREE_H) flags.h \
798 cp-lex.h cp-decl.h
799cp-type2.o : cp-type2.c $(CONFIG_H) $(CPLUS_TREE_H) flags.h
1b212aa8
BK
800cp-typeck.o : cp-typeck.c $(CONFIG_H) $(CPLUS_TREE_H) flags.h $(RTL_H)
801cp-class.o : cp-class.c $(CONFIG_H) $(CPLUS_TREE_H) flags.h
802cp-call.o : cp-call.c $(CONFIG_H) $(CPLUS_TREE_H) flags.h
803cp-init.o : cp-init.c $(CONFIG_H) $(CPLUS_TREE_H) flags.h $(RTL_H)
79d8453e
RS
804cp-method.o : cp-method.c $(CONFIG_H) $(CPLUS_TREE_H)
805cp-cvt.o : cp-cvt.c $(CONFIG_H) $(CPLUS_TREE_H)
806cp-search.o : cp-search.c $(CONFIG_H) $(CPLUS_TREE_H) stack.h flags.h
807cp-tree.o : cp-tree.c $(CONFIG_H) $(CPLUS_TREE_H) flags.h
808cp-ptree.o : cp-ptree.c $(CONFIG_H) $(CPLUS_TREE_H)
809cp-gc.o : cp-gc.c $(CONFIG_H) $(CPLUS_TREE_H) flags.h
1b212aa8 810cp-except.o : cp-except.c $(CONFIG_H) $(CPLUS_TREE_H) flags.h $(RTL_H)
79d8453e
RS
811cp-expr.o : cp-expr.c $(CONFIG_H) $(CPLUS_TREE_H) $(RTL_H) flags.h \
812 expr.h insn-codes.h
813cp-edsel.o : cp-edsel.c $(CONFIG_H) $(CPLUS_TREE_H) stack.h flags.h
1b212aa8 814cp-xref.o : cp-xref.c $(CONFIG_H) $(CPLUS_TREE_H) input.h
79d8453e
RS
815cp-pt.o : cp-pt.c $(CONFIG_H) $(CPLUS_TREE_H) cp-decl.h cp-parse.h
816
47547081
RS
817# To make a configuration always use collect2, set USE_COLLECT2 to ld.
818ld: collect2
819 rm -f ld
820 ln collect2 ld
821
79d8453e 822collect2 : collect2.o version.o $(LIBDEPS)
057f494b
RS
823# Don't try modifying collect2 (aka ld) in place--it might be linking this.
824 -rm -f collect2
79d8453e
RS
825 $(CC) $(ALL_CFLAGS) $(LDFLAGS) -o collect2 collect2.o version.o $(LIBS)
826
827collect2.o : collect2.c $(CONFIG_H) gstab.h
b7b08dcd
RS
828 $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \
829 -DTARGET_MACHINE=\"$(target)\" \
830 -c `echo $(srcdir)/collect2.c | sed 's,^\./,,'`
79d8453e 831
ccfc4033 832# Objective C language specific files.
79d8453e
RS
833
834objc-parse.o : $(srcdir)/objc-parse.c $(CONFIG_H) $(TREE_H) c-lex.h \
812e2cfe 835 c-tree.h input.h flags.h objc-act.h
79d8453e
RS
836 $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) -c $(srcdir)/objc-parse.c
837$(srcdir)/objc-parse.c : $(srcdir)/objc-parse.y
838 cd $(srcdir); $(BISON) $(BISONFLAGS) objc-parse.y -o objc-parse.c
26095868
RS
839$(srcdir)/objc-parse.y: $(srcdir)/c-parse.in
840 sed -e "/^ifc$$/,/^end ifc$$/d" \
841 -e "/^ifobjc$$/d" -e "/^end ifobjc$$/d" \
842 $(srcdir)/c-parse.in > $(srcdir)/objc-parse.y
79d8453e 843
469778e2
RS
844objc-act.o : objc-act.c $(CONFIG_H) $(TREE_H) $(RTL_H) c-tree.h c-lex.h \
845 flags.h objc-act.h input.h function.h $(srcdir)/c-parse.h
79d8453e
RS
846
847# A file used by all variants of C.
848
849c-common.o : c-common.c $(CONFIG_H) $(TREE_H) c-tree.h c-lex.h flags.h
850
851# Language-independent files.
852
f10fec92 853gcc.o: gcc.c $(CONFIG_H) gvarargs.h config.status
79d8453e
RS
854 $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \
855 -DSTANDARD_STARTFILE_PREFIX=\"$(libdir)/\" \
2e494f70 856 -DSTANDARD_EXEC_PREFIX=\"$(libdir)/gcc-lib/\" \
79d8453e 857 -DDEFAULT_TARGET_MACHINE=\"$(target)\" \
47279178 858 -DTOOLDIR_BASE_PREFIX=\"$(exec_prefix)/\" \
17d4d0e0 859 -DTOOLDIR=\"$(tooldir)/\" \
c60416cd 860 $(MAYBE_TARGET_DEFAULT) \
79d8453e
RS
861 -c `echo $(srcdir)/gcc.c | sed 's,^\./,,'`
862
863dumpvers: dumpvers.c
864
865version.o: version.c
866obstack.o: obstack.c
867
c5d3565c
BK
868convert.o: convert.c $(CONFIG_H) $(TREE_H) flags.h convert.h
869
79d8453e
RS
870tree.o : tree.c $(CONFIG_H) $(TREE_H) gvarargs.h flags.h function.h
871print-tree.o : print-tree.c $(CONFIG_H) $(TREE_H)
872stor-layout.o : stor-layout.c $(CONFIG_H) $(TREE_H) function.h
873fold-const.o : fold-const.c $(CONFIG_H) $(TREE_H) flags.h
2e494f70 874toplev.o : toplev.c $(CONFIG_H) $(TREE_H) $(RTL_H) flags.h input.h \
9c6a79a9 875 insn-attr.h xcoffout.h defaults.h
47547081 876 $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \
b7ac21e3
RS
877 $(MAYBE_TARGET_DEFAULT) $(MAYBE_USE_COLLECT2) \
878 -c `echo $(srcdir)/toplev.c | sed 's,^\./,,'`
79d8453e
RS
879
880rtl.o : rtl.c $(CONFIG_H) $(RTL_H)
881
882print-rtl.o : print-rtl.c $(CONFIG_H) $(RTL_H)
883rtlanal.o : rtlanal.c $(CONFIG_H) $(RTL_H)
884
88e71d24
RS
885varasm.o : varasm.c $(CONFIG_H) $(TREE_H) $(RTL_H) flags.h function.h \
886 defaults.h insn-codes.h expr.h hard-reg-set.h regs.h xcoffout.h
79d8453e
RS
887function.o : function.c $(CONFIG_H) $(RTL_H) $(TREE_H) flags.h function.h \
888 insn-flags.h insn-codes.h expr.h regs.h hard-reg-set.h insn-config.h \
889 recog.h output.h
890stmt.o : stmt.c $(CONFIG_H) $(RTL_H) $(TREE_H) flags.h function.h \
891 insn-flags.h insn-config.h insn-codes.h hard-reg-set.h expr.h loop.h recog.h
b587ed66 892expr.o : expr.c $(CONFIG_H) $(RTL_H) $(TREE_H) flags.h function.h \
79d8453e
RS
893 insn-flags.h insn-codes.h expr.h insn-config.h recog.h output.h typeclass.h
894calls.o : calls.c $(CONFIG_H) $(RTL_H) $(TREE_H) flags.h expr.h insn-codes.h \
b587ed66 895 insn-flags.h gvarargs.h
79d8453e
RS
896expmed.o : expmed.c $(CONFIG_H) $(RTL_H) $(TREE_H) flags.h \
897 insn-flags.h insn-config.h insn-codes.h expr.h recog.h real.h
898explow.o : explow.c $(CONFIG_H) $(RTL_H) $(TREE_H) flags.h hard-reg-set.h \
899 insn-config.h expr.h recog.h insn-flags.h insn-codes.h
900optabs.o : optabs.c $(CONFIG_H) $(RTL_H) $(TREE_H) flags.h \
109bcc7e 901 insn-flags.h insn-config.h insn-codes.h expr.h recog.h reload.h
79d8453e 902dbxout.o : dbxout.c $(CONFIG_H) $(TREE_H) $(RTL_H) flags.h regs.h \
6aa4e0b4 903 insn-config.h reload.h gstab.h xcoffout.h defaults.h output.h
79d8453e
RS
904sdbout.o : sdbout.c $(CONFIG_H) $(TREE_H) $(RTL_H) gsyms.h flags.h \
905 insn-config.h reload.h
906dwarfout.o : dwarfout.c $(CONFIG_H) $(TREE_H) $(RTL_H) dwarf.h flags.h \
8b7ec00c 907 insn-config.h reload.h output.h defaults.h
47547081 908xcoffout.o : xcoffout.c $(CONFIG_H) $(TREE_H) $(RTL_H) xcoffout.h flags.h
79d8453e
RS
909emit-rtl.o : emit-rtl.c $(CONFIG_H) $(RTL_H) flags.h gvarargs.h function.h \
910 regs.h insn-config.h insn-codes.h real.h expr.h
ee7e5441 911real.o : real.c $(CONFIG_H) $(TREE_H)
2e494f70 912getpwd.o : getpwd.c $(CONFIG_H)
79d8453e
RS
913
914integrate.o : integrate.c $(CONFIG_H) $(RTL_H) $(TREE_H) flags.h integrate.h \
915 insn-flags.h insn-config.h insn-codes.h expr.h real.h function.h
916
917jump.o : jump.c $(CONFIG_H) $(RTL_H) flags.h hard-reg-set.h regs.h \
918 insn-config.h insn-flags.h insn-codes.h expr.h real.h
919stupid.o : stupid.c $(CONFIG_H) $(RTL_H) regs.h hard-reg-set.h flags.h
920
921cse.o : cse.c $(CONFIG_H) $(RTL_H) regs.h hard-reg-set.h flags.h real.h \
922 insn-config.h recog.h
923loop.o : loop.c $(CONFIG_H) $(RTL_H) flags.h loop.h insn-config.h \
924 insn-flags.h insn-codes.h regs.h hard-reg-set.h recog.h expr.h real.h
925unroll.o : unroll.c $(CONFIG_H) $(RTL_H) insn-config.h insn-codes.h \
926 integrate.h regs.h flags.h expr.h loop.h
927flow.o : flow.c $(CONFIG_H) $(RTL_H) flags.h insn-config.h \
928 basic-block.h regs.h hard-reg-set.h output.h
929combine.o : combine.c $(CONFIG_H) $(RTL_H) gvarargs.h flags.h \
930 insn-config.h insn-flags.h insn-codes.h insn-attr.h regs.h expr.h \
1717563d 931 basic-block.h recog.h real.h hard-reg-set.h
79d8453e 932regclass.o : regclass.c $(CONFIG_H) $(RTL_H) hard-reg-set.h flags.h \
e4600702 933 basic-block.h regs.h insn-config.h recog.h reload.h real.h
79d8453e
RS
934local-alloc.o : local-alloc.c $(CONFIG_H) $(RTL_H) flags.h basic-block.h \
935 regs.h hard-reg-set.h insn-config.h recog.h output.h
f0ec1f64 936global.o : global.c $(CONFIG_H) $(RTL_H) flags.h \
79d8453e
RS
937 basic-block.h regs.h hard-reg-set.h insn-config.h output.h
938
939reload.o : reload.c $(CONFIG_H) $(RTL_H) flags.h \
940 reload.h recog.h hard-reg-set.h insn-config.h insn-codes.h regs.h real.h
941reload1.o : reload1.c $(CONFIG_H) $(RTL_H) flags.h expr.h \
942 reload.h regs.h hard-reg-set.h insn-config.h insn-flags.h insn-codes.h \
943 basic-block.h recog.h output.h
944caller-save.o : caller-save.c $(CONFIG_H) $(RTL_H) flags.h \
945 regs.h hard-reg-set.h insn-config.h basic-block.h recog.h reload.h expr.h
946reorg.o : reorg.c $(CONFIG_H) $(RTL_H) conditions.h hard-reg-set.h \
947 basic-block.h regs.h insn-config.h insn-attr.h insn-flags.h recog.h \
948 flags.h output.h
949sched.o : sched.c $(CONFIG_H) $(RTL_H) basic-block.h regs.h hard-reg-set.h \
950 flags.h insn-config.h insn-attr.h
951final.o : final.c $(CONFIG_H) $(RTL_H) gvarargs.h flags.h regs.h \
952 recog.h conditions.h insn-config.h insn-attr.h real.h output.h \
b7ac21e3 953 hard-reg-set.h insn-flags.h insn-codes.h gstab.h xcoffout.h defaults.h
79d8453e
RS
954recog.o : recog.c $(CONFIG_H) $(RTL_H) \
955 regs.h recog.h hard-reg-set.h flags.h insn-config.h insn-attr.h \
956 insn-flags.h insn-codes.h real.h
957reg-stack.o : reg-stack.c $(CONFIG_H) $(RTL_H) $(TREE_H) \
958 regs.h hard-reg-set.h flags.h insn-config.h
dcfedcd0 959
79d8453e
RS
960aux-output.o : aux-output.c $(CONFIG_H) \
961 $(RTL_H) regs.h hard-reg-set.h real.h insn-config.h conditions.h \
962 insn-flags.h output.h insn-attr.h insn-codes.h
963
964# Normally this target is not used; but it is used if you
965# define ALLOCA=alloca.o. In that case, you must get a suitable alloca.c
966# from the GNU Emacs distribution.
79d8453e 967alloca.o: alloca.c
79d8453e 968 $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $(ALLOCA_FLAGS) \
1d839079 969 -c `echo $(srcdir)/alloca.c | sed 's,^\./,,'`
79d8453e
RS
970 $(ALLOCA_FINISH)
971\f
972# Generate header and source files from the machine description,
973# and compile them.
974
975.PRECIOUS: insn-config.h insn-flags.h insn-codes.h \
976 insn-emit.c insn-recog.c insn-extract.c insn-output.c insn-peep.c \
977 insn-attr.h insn-attrtab.c
978
979# The following pair of rules has this effect:
980# genconfig is run only if the md has changed since genconfig was last run;
981# but the file insn-config.h is touched only when its contents actually change.
982
983# Each of the other insn-* files is handled by a similar pair of rules.
984
1402d22c
RS
985# This causes an anomaly in the results of make -n
986# because insn-* is older than stamp-*
987# and thus make -n thinks that insn-* will be updated
988# and force recompilation of things that depend on it.
424aa086 989# We use move-if-change precisely to avoid such recompilation.
1402d22c
RS
990# But there is no way to teach make -n that it will be avoided.
991
79d8453e
RS
992# Each of the insn-*.[ch] rules has a semicolon at the end,
993# for otherwise the system Make on SunOS 4.1 never tries
7bd95cc1
BK
994# to recompile insn-*.o. To avoid problems and extra noise from
995# versions of make which don't like empty commands (nothing after the
996# trailing `;'), we call true for each.
79d8453e 997
d960abef 998insn-config.h: stamp-config ; @true
79d8453e
RS
999stamp-config : md genconfig $(srcdir)/move-if-change
1000 ./genconfig md > tmp-config.h
1001 $(srcdir)/move-if-change tmp-config.h insn-config.h
1002 touch stamp-config
1003
d960abef 1004insn-flags.h: stamp-flags ; @true
79d8453e
RS
1005stamp-flags : md genflags $(srcdir)/move-if-change
1006 ./genflags md > tmp-flags.h
1007 $(srcdir)/move-if-change tmp-flags.h insn-flags.h
1008 touch stamp-flags
1009
d960abef 1010insn-codes.h: stamp-codes ; @true
79d8453e
RS
1011stamp-codes : md gencodes $(srcdir)/move-if-change
1012 ./gencodes md > tmp-codes.h
1013 $(srcdir)/move-if-change tmp-codes.h insn-codes.h
1014 touch stamp-codes
1015
1016insn-emit.o : insn-emit.c $(CONFIG_H) $(RTL_H) expr.h real.h output.h \
1017 insn-config.h insn-flags.h insn-codes.h
1018 $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) -c insn-emit.c
1019
d960abef 1020insn-emit.c: stamp-emit ; @true
79d8453e
RS
1021stamp-emit : md genemit $(srcdir)/move-if-change
1022 ./genemit md > tmp-emit.c
1023 $(srcdir)/move-if-change tmp-emit.c insn-emit.c
1024 touch stamp-emit
1025
1026insn-recog.o : insn-recog.c $(CONFIG_H) $(RTL_H) insn-config.h recog.h \
1027 real.h output.h flags.h
1028 $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) -c insn-recog.c
1029
d960abef 1030insn-recog.c: stamp-recog ; @true
79d8453e
RS
1031stamp-recog : md genrecog $(srcdir)/move-if-change
1032 ./genrecog md > tmp-recog.c
1033 $(srcdir)/move-if-change tmp-recog.c insn-recog.c
1034 touch stamp-recog
1035
118bdbf8
RK
1036insn-opinit.o : insn-opinit.c $(CONFIG_H) $(RTL_H) insn-codes.h insn-flags.h \
1037 insn-config.h flags.h rtl.h recog.h expr.h reload.h
1038 $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) -c insn-opinit.c
1039
1040insn-opinit.c: stamp-opinit ; @true
1041stamp-opinit : md genopinit $(srcdir)/move-if-change
1042 ./genopinit md > tmp-opinit.c
1043 $(srcdir)/move-if-change tmp-opinit.c insn-opinit.c
1044 touch stamp-opinit
1045
79d8453e
RS
1046insn-extract.o : insn-extract.c $(CONFIG_H) $(RTL_H)
1047 $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) -c insn-extract.c
1048
d960abef 1049insn-extract.c: stamp-extract ; @true
79d8453e
RS
1050stamp-extract : md genextract $(srcdir)/move-if-change
1051 ./genextract md > tmp-extract.c
1052 $(srcdir)/move-if-change tmp-extract.c insn-extract.c
1053 touch stamp-extract
1054
1055insn-peep.o : insn-peep.c $(CONFIG_H) $(RTL_H) regs.h output.h real.h
1056 $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) -c insn-peep.c
1057
d960abef 1058insn-peep.c: stamp-peep ; @true
79d8453e
RS
1059stamp-peep : md genpeep $(srcdir)/move-if-change
1060 ./genpeep md > tmp-peep.c
1061 $(srcdir)/move-if-change tmp-peep.c insn-peep.c
1062 touch stamp-peep
1063
1064insn-attrtab.o : insn-attrtab.c $(CONFIG_H) $(RTL_H) regs.h real.h output.h \
1065 insn-attr.h insn-config.h
1066 $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) -c insn-attrtab.c
1067
d960abef 1068insn-attr.h: stamp-attr ; @true
79d8453e
RS
1069stamp-attr : md genattr $(srcdir)/move-if-change
1070 ./genattr md > tmp-attr.h
1071 $(srcdir)/move-if-change tmp-attr.h insn-attr.h
1072 touch stamp-attr
1073
d960abef 1074insn-attrtab.c: stamp-attrtab ; @true
79d8453e 1075stamp-attrtab : md genattrtab $(srcdir)/move-if-change
20bd0ab1
RS
1076 if cmp -s $(PREMADE_ATTRTAB_MD) md; \
1077 then \
1078 echo Using $(PREMADE_ATTRTAB); \
2e0b13db 1079 cp $(PREMADE_ATTRTAB) tmp-attrtab.c; \
20bd0ab1
RS
1080 else \
1081 ./genattrtab md > tmp-attrtab.c; \
1082 fi
79d8453e
RS
1083 $(srcdir)/move-if-change tmp-attrtab.c insn-attrtab.c
1084 touch stamp-attrtab
1085
1086insn-output.o : insn-output.c $(CONFIG_H) $(RTL_H) regs.h real.h conditions.h \
1087 hard-reg-set.h insn-config.h insn-flags.h insn-attr.h output.h recog.h \
1088 insn-codes.h
1089 $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) -c insn-output.c
1090
d960abef 1091insn-output.c: stamp-output ; @true
79d8453e
RS
1092stamp-output : md genoutput $(srcdir)/move-if-change
1093 ./genoutput md > tmp-output.c
1094 $(srcdir)/move-if-change tmp-output.c insn-output.c
1095 touch stamp-output
1096\f
1097# Compile the programs that generate insn-* from the machine description.
1098# They are compiled with $(HOST_CC), and associated libraries,
1099# since they need to run on this machine
1100# even if GCC is being compiled to run on some other machine.
1101
1102# $(CONFIG_H) is omitted from the deps of the gen*.o
1103# because these programs don't really depend on anything
1104# about the target machine. They do depend on config.h itself,
1105# since that describes the host machine.
1106
1107genconfig : genconfig.o $(HOST_RTL) $(HOST_LIBDEPS)
1108 $(HOST_CC) $(HOST_CFLAGS) $(HOST_LDFLAGS) -o genconfig \
1109 genconfig.o $(HOST_RTL) $(HOST_LIBS)
1110
057f494b 1111genconfig.o : genconfig.c $(RTL_H) hconfig.h
79d8453e
RS
1112 $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(srcdir)/genconfig.c
1113
1114genflags : genflags.o $(HOST_RTL) $(HOST_LIBDEPS)
1115 $(HOST_CC) $(HOST_CFLAGS) $(HOST_LDFLAGS) -o genflags \
1116 genflags.o $(HOST_RTL) $(HOST_LIBS)
1117
057f494b 1118genflags.o : genflags.c $(RTL_H) hconfig.h
79d8453e
RS
1119 $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(srcdir)/genflags.c
1120
1121gencodes : gencodes.o $(HOST_RTL) $(HOST_LIBDEPS)
1122 $(HOST_CC) $(HOST_CFLAGS) $(HOST_LDFLAGS) -o gencodes \
1123 gencodes.o $(HOST_RTL) $(HOST_LIBS)
1124
057f494b 1125gencodes.o : gencodes.c $(RTL_H) hconfig.h
79d8453e
RS
1126 $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(srcdir)/gencodes.c
1127
1128genemit : genemit.o $(HOST_RTL) $(HOST_LIBDEPS)
1129 $(HOST_CC) $(HOST_CFLAGS) $(HOST_LDFLAGS) -o genemit \
1130 genemit.o $(HOST_RTL) $(HOST_LIBS)
1131
057f494b 1132genemit.o : genemit.c $(RTL_H) hconfig.h
79d8453e
RS
1133 $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(srcdir)/genemit.c
1134
118bdbf8
RK
1135genopinit : genopinit.o $(HOST_RTL) $(HOST_LIBDEPS)
1136 $(HOST_CC) $(HOST_CFLAGS) $(HOST_LDFLAGS) -o genopinit \
1137 genopinit.o $(HOST_RTL) $(HOST_LIBS)
1138
1139genopinit.o : genopinit.c $(RTL_H) hconfig.h
1140 $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(srcdir)/genopinit.c
1141
79d8453e
RS
1142genrecog : genrecog.o $(HOST_RTL) $(HOST_LIBDEPS)
1143 $(HOST_CC) $(HOST_CFLAGS) $(HOST_LDFLAGS) -o genrecog \
1144 genrecog.o $(HOST_RTL) $(HOST_LIBS)
1145
057f494b 1146genrecog.o : genrecog.c $(RTL_H) hconfig.h
79d8453e
RS
1147 $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(srcdir)/genrecog.c
1148
1149genextract : genextract.o $(HOST_RTL) $(HOST_LIBDEPS)
1150 $(HOST_CC) $(HOST_CFLAGS) $(HOST_LDFLAGS) -o genextract \
1151 genextract.o $(HOST_RTL) $(HOST_LIBS)
1152
057f494b 1153genextract.o : genextract.c $(RTL_H) hconfig.h insn-config.h
79d8453e
RS
1154 $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(srcdir)/genextract.c
1155
1156genpeep : genpeep.o $(HOST_RTL) $(HOST_LIBDEPS)
1157 $(HOST_CC) $(HOST_CFLAGS) $(HOST_LDFLAGS) -o genpeep \
1158 genpeep.o $(HOST_RTL) $(HOST_LIBS)
1159
057f494b 1160genpeep.o : genpeep.c $(RTL_H) hconfig.h
79d8453e
RS
1161 $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(srcdir)/genpeep.c
1162
1163genattr : genattr.o $(HOST_RTL) $(HOST_LIBDEPS)
1164 $(HOST_CC) $(HOST_CFLAGS) $(HOST_LDFLAGS) -o genattr \
1165 genattr.o $(HOST_RTL) $(HOST_LIBS)
1166
057f494b 1167genattr.o : genattr.c $(RTL_H) hconfig.h
79d8453e
RS
1168 $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(srcdir)/genattr.c
1169
d3614a37 1170genattrtab : genattrtab.o $(HOST_RTL) $(HOST_PRINT) $(HOST_RTLANAL) $(HOST_LIBDEPS)
79d8453e 1171 $(HOST_CC) $(HOST_CFLAGS) $(HOST_LDFLAGS) -o genattrtab \
d3614a37 1172 genattrtab.o $(HOST_RTL) $(HOST_PRINT) $(HOST_RTLANAL) $(HOST_LIBS)
79d8453e 1173
057f494b 1174genattrtab.o : genattrtab.c $(RTL_H) hconfig.h insn-config.h
79d8453e
RS
1175 $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(srcdir)/genattrtab.c
1176
1177genoutput : genoutput.o $(HOST_RTL) $(HOST_LIBDEPS)
1178 $(HOST_CC) $(HOST_CFLAGS) $(HOST_LDFLAGS) -o genoutput \
1179 genoutput.o $(HOST_RTL) $(HOST_LIBS)
1180
057f494b 1181genoutput.o : genoutput.c $(RTL_H) hconfig.h
79d8453e
RS
1182 $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(srcdir)/genoutput.c
1183\f
1184# Compile the libraries to be used by gen*.
1185# If we are not cross-building, gen* use the same .o's that cc1 will use,
1186# and HOST_PREFIX_1 is `foobar', just to ensure these rules don't conflict
1187# with the rules for rtl.o, alloca.o, etc.
1188$(HOST_PREFIX_1)rtl.o: $(srcdir)/rtl.c $(CONFIG_H) $(RTL_H)
1189 rm -f $(HOST_PREFIX)rtl.c
057f494b 1190 sed -e 's/config[.]h/hconfig.h/' $(srcdir)/rtl.c > $(HOST_PREFIX)rtl.c
79d8453e
RS
1191 $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(HOST_PREFIX)rtl.c
1192
d3614a37
RS
1193$(HOST_PREFIX_1)print-rtl.o: $(srcdir)/print-rtl.c $(CONFIG_H) $(RTL_H)
1194 rm -f $(HOST_PREFIX)print-rtl.c
057f494b 1195 sed -e 's/config[.]h/hconfig.h/' $(srcdir)/print-rtl.c > $(HOST_PREFIX)print-rtl.c
d3614a37
RS
1196 $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(HOST_PREFIX)print-rtl.c
1197
79d8453e
RS
1198$(HOST_PREFIX_1)rtlanal.o: $(srcdir)/rtlanal.c $(CONFIG_H) $(RTL_H)
1199 rm -f $(HOST_PREFIX)rtlanal.c
057f494b 1200 sed -e 's/config[.]h/hconfig.h/' $(srcdir)/rtlanal.c > $(HOST_PREFIX)rtlanal.c
79d8453e
RS
1201 $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(HOST_PREFIX)rtlanal.c
1202
1203$(HOST_PREFIX_1)alloca.o: alloca.c
1204 rm -f $(HOST_PREFIX)alloca.c
1205 cp $(srcdir)/alloca.c $(HOST_PREFIX)alloca.c
1206 $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(HOST_PREFIX)alloca.c
1207
1208$(HOST_PREFIX_1)obstack.o: obstack.c
1209 rm -f $(HOST_PREFIX)obstack.c
057f494b 1210 sed -e 's/config[.]h/hconfig.h/' $(srcdir)/obstack.c > $(HOST_PREFIX)obstack.c
79d8453e
RS
1211 $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(HOST_PREFIX)obstack.c
1212
1213$(HOST_PREFIX_1)malloc.o: malloc.c
1214 rm -f $(HOST_PREFIX)malloc.c
057f494b 1215 sed -e 's/config[.]h/hconfig.h/' $(srcdir)/malloc.c > $(HOST_PREFIX)malloc.c
79d8453e
RS
1216 $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(HOST_PREFIX)malloc.c
1217
1218# This satisfies the dependency that we get if you cross-compile a compiler
1219# that does not need to compile alloca, malloc or whatever.
1220$(HOST_PREFIX_1):
1221 touch $(HOST_PREFIX_1)
1222\f
1223# Remake cpp and protoize.
1224
1225# Making the preprocessor
1226cpp: cccp
1227 -rm -f cpp
1228 ln cccp cpp
1229cccp: cccp.o cexp.o version.o $(LIBDEPS)
1230 $(CC) $(ALL_CFLAGS) $(LDFLAGS) -o cccp cccp.o cexp.o version.o $(LIBS)
1231cexp.o: $(srcdir)/cexp.c $(CONFIG_H)
1232 $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) -c $(srcdir)/cexp.c
1233$(srcdir)/cexp.c: $(srcdir)/cexp.y
1234 cd $(srcdir); $(BISON) -o cexp.c cexp.y
5c539087 1235cccp.o: cccp.c $(CONFIG_H) pcp.h version.c config.status
79d8453e
RS
1236# The reason we use $(libdir)/g++-include rather than using libsubdir
1237# is for compatibility with the current version of libg++.
1238 $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \
2e494f70
RS
1239 -DGCC_INCLUDE_DIR=\"$(libsubdir)/include\" \
1240 -DGPLUSPLUS_INCLUDE_DIR=\"$(libdir)/g++-include\" \
c844ddda 1241 -DLOCAL_INCLUDE_DIR=\"$(local_prefix)/include\" \
2e494f70 1242 -DCROSS_INCLUDE_DIR=\"$(libsubdir)/sys-include\" \
14b18068 1243 -DTOOL_INCLUDE_DIR=\"$(tooldir)/include\" \
17d4d0e0 1244 -DTOOLDIR=\"$(tooldir)/\" \
79d8453e
RS
1245 -c `echo $(srcdir)/cccp.c | sed 's,^\./,,'`
1246
7bd95cc1
BK
1247# Note for the stamp targets, we run the program `true' instead of
1248# having an empty command (nothing following the semicolon).
1249
acbbf3d9 1250proto: config.status protoize unprotoize SYSCALLS.c.X
79d8453e 1251
2e494f70 1252protoize: protoize.o getopt.o getopt1.o getpwd.o version.o $(LIBDEPS)
79d8453e 1253 $(CC) $(ALL_CFLAGS) $(LDFLAGS) \
2e494f70 1254 protoize.o getopt.o getopt1.o getpwd.o version.o $(LIBS) -o $@
d960abef 1255protoize.o: stamp-proto ; @true
2e0b13db
RS
1256
1257unprotoize: unprotoize.o getopt.o getopt1.o getpwd.o version.o $(LIBDEPS)
1258 $(CC) $(ALL_CFLAGS) $(LDFLAGS) \
1259 unprotoize.o getopt.o getopt1.o getpwd.o version.o $(LIBS) -o $@
d960abef 1260unprotoize.o: stamp-proto ; @true
2e0b13db
RS
1261
1262stamp-proto: $(srcdir)/protoize.c getopt.h $(CONFIG_H)
79d8453e
RS
1263 $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \
1264 -DGCC_INCLUDE_DIR=\"$(libsubdir)/include\" \
2e494f70 1265 -DGPLUSPLUS_INCLUDE_DIR=\"$(libdir)/g++-include\" \
79d8453e 1266 -DCROSS_INCLUDE_DIR=\"$(libsubdir)/sys-include\" \
14b18068 1267 -DTOOL_INCLUDE_DIR=\"$(tooldir)/include\" \
6056afa0 1268 -DLOCAL_INCLUDE_DIR=\"$(local_prefix)/include\" \
79d8453e 1269 -DSTD_PROTO_DIR=\"$(libsubdir)\" \
2e0b13db
RS
1270 -DUNPROTOIZE $(srcdir)/protoize.c
1271 mv protoize.o unprotoize.o
79d8453e
RS
1272 $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \
1273 -DGCC_INCLUDE_DIR=\"$(libsubdir)/include\" \
2e494f70 1274 -DGPLUSPLUS_INCLUDE_DIR=\"$(libdir)/g++-include\" \
79d8453e 1275 -DCROSS_INCLUDE_DIR=\"$(libsubdir)/sys-include\" \
14b18068 1276 -DTOOL_INCLUDE_DIR=\"$(tooldir)/include\" \
6056afa0 1277 -DLOCAL_INCLUDE_DIR=\"$(local_prefix)/include\" \
79d8453e 1278 -DSTD_PROTO_DIR=\"$(libsubdir)\" \
2e0b13db 1279 $(srcdir)/protoize.c
acbbf3d9 1280 touch stamp-proto
79d8453e
RS
1281
1282getopt.o: $(srcdir)/getopt.c getopt.h
1283 $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $(srcdir)/getopt.c
1284getopt1.o: $(srcdir)/getopt1.c getopt.h
1285 $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $(srcdir)/getopt1.c
1286
79d8453e 1287# This info describes the target machine, so compile with GCC just built.
47547081 1288SYSCALLS.c.X: $(srcdir)/sys-types.h $(srcdir)/sys-protos.h $(GCC_PASSES)
c21cf0a7 1289 -rm -f SYSCALLS.c tmp-SYSCALLS.s
47547081 1290 cat $(srcdir)/sys-types.h $(srcdir)/sys-protos.h > SYSCALLS.c
79d8453e 1291 $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \
c21cf0a7
RS
1292 -aux-info $@ -S -o tmp-SYSCALLS.s SYSCALLS.c
1293 -rm -f SYSCALLS.c tmp-SYSCALLS.s
9c0022f6
RS
1294
1295test-protoize-simple: ./protoize ./unprotoize $(GCC_PASSES)
4803a34a 1296 -rm -f tmp-proto.[cso]
d3614a37
RS
1297 cp $(srcdir)/protoize.c tmp-proto.c
1298 chmod u+w tmp-proto.c
4803a34a
RK
1299 ./protoize -N -B ./ -x getopt.h -c "-B./ -Wall -Wwrite-strings \
1300 $(CFLAGS) $(INCLUDES) \
9c0022f6
RS
1301 -DGCC_INCLUDE_DIR=0 \
1302 -DGPLUSPLUS_INCLUDE_DIR=0 \
1303 -DCROSS_INCLUDE_DIR=0 \
14b18068 1304 -DTOOL_INCLUDE_DIR=0 \
d3614a37 1305 -DSTD_PROTO_DIR=0" tmp-proto.c
e3e873d2 1306 @echo '**********' Expect 400 lines of differences.
4803a34a
RK
1307 -diff $(srcdir)/protoize.c tmp-proto.c > tmp-proto.diff
1308 -wc -l tmp-proto.diff
1309 ./unprotoize -N -x getopt.h -c "-B./ -Wall -Wwrite-strings \
1310 $(CFLAGS) $(INCLUDES) \
9c0022f6
RS
1311 -DGCC_INCLUDE_DIR=0 \
1312 -DGPLUSPLUS_INCLUDE_DIR=0 \
1313 -DCROSS_INCLUDE_DIR=0 \
14b18068 1314 -DTOOL_INCLUDE_DIR=0 \
d3614a37 1315 -DSTD_PROTO_DIR=0" tmp-proto.c
9c0022f6 1316 @echo Expect zero differences.
d3614a37 1317 diff $(srcdir)/protoize.c tmp-proto.c | cat
4803a34a 1318 -rm -f tmp-proto.[cso]
79d8453e 1319\f
ba1811f1
ILT
1320# Build the include directory. The stamp files are stmp-* rather than
1321# stamp-* so that mostlyclean does not force the include directory to
1322# be rebuilt.
1323
56f9206d
ILT
1324# Build the include directory except for float.h (which depends upon
1325# enquire).
3dc4a939
RK
1326stmp-int-hdrs: stmp-fixinc $(USER_H) gvarargs.h gstdarg.h gstddef.h \
1327 xlimits.h objc-headers
ba1811f1
ILT
1328# Copy in the headers provided with gcc.
1329# The sed command gets just the last file name component;
1330# this is necessary because VPATH could add a dirname.
1331# Using basename would be simpler, but some systems don't have it.
1332 objdir=`pwd`; \
1333 cd $(srcdir); \
1334 for file in $(USER_H); do \
1335 realfile=`echo $$file | sed -e 's|.*/\([^/]*\)$$|\1|'`; \
1f050b9b 1336 rm -f $$objdir/include/$$realfile; \
ba1811f1
ILT
1337 cp $$realfile $$objdir/include; \
1338 chmod a+r $$objdir/include/$$realfile; \
1339 done
1f050b9b 1340 rm -f include/varargs.h
ba1811f1
ILT
1341 cp $(srcdir)/gvarargs.h include/varargs.h
1342 chmod a+r include/varargs.h
1f050b9b 1343 rm -f include/stdarg.h
ba1811f1
ILT
1344 cp $(srcdir)/gstdarg.h include/stdarg.h
1345 chmod a+r include/stdarg.h
1f050b9b 1346 rm -f include/stddef.h
ba1811f1
ILT
1347 cp $(srcdir)/gstddef.h include/stddef.h
1348 chmod a+r include/stddef.h
1f050b9b 1349 rm -f include/limits.h
ba1811f1
ILT
1350 cp xlimits.h include/limits.h
1351 chmod a+r include/limits.h
ba1811f1 1352# Install the README
1f050b9b 1353 rm -f include/README
ba1811f1
ILT
1354 cp $(srcdir)/README-fixinc include/README
1355 chmod a+r include/README
56f9206d
ILT
1356 touch stmp-int-hdrs
1357
1358# Build the complete include directory.
1359stmp-headers: stmp-int-hdrs gfloat.h
1360 rm -f include/float.h
1361 cp gfloat.h include/float.h
1362 chmod a+r include/float.h
ba1811f1
ILT
1363 touch stmp-headers
1364
1365# Build fixed copies of system files.
3dc4a939 1366stmp-fixinc: $(srcdir)/$(FIXINCLUDES) gsyslimits.h
ba1811f1
ILT
1367 rm -rf include
1368 mkdir include
b82a0ad9 1369 if [ x$(FIXINCLUDES) != xMakefile.in ]; \
98e4b835
RS
1370 then \
1371 for dir in $(SYSTEM_HEADER_DIR) $(OTHER_FIXINCLUDES_DIRS); do \
1372 if [ -d $$dir ]; \
1373 then \
1374 $(srcdir)/$(FIXINCLUDES) include $$dir $(srcdir); \
1375 else true; fi; \
b82a0ad9 1376 done; \
98e4b835
RS
1377 else true; \
1378 fi
3dc4a939
RK
1379 rm -f include/syslimits.h
1380 if [ -f include/limits.h ]; then \
1381 mv include/limits.h include/syslimits.h; \
1382 else \
1383 cp $(srcdir)/gsyslimits.h include/syslimits.h; \
1384 fi
1385 chmod a+r include/syslimits.h
49b6e255 1386 touch stmp-fixinc
469778e2 1387
41fe5ef9
RS
1388# copy objc header files into build directory
1389objc-headers:
d68d6b81 1390 if [ -d objc ]; then true; else mkdir objc; fi
469778e2
RS
1391 thisdir1=`pwd`; \
1392 srcdir1=`cd $(srcdir); pwd`; \
1393 cd objc; \
1394 $(MAKE) -f $${srcdir1}/objc/Makefile copy-headers \
1395 srcdir=$${srcdir1} tooldir=$(tooldir) AR="$(AR)" AR_FLAGS="$(AR_FLAGS)" \
1396 GCC_FOR_TARGET="$${thisdir1}/xgcc -B$${thisdir1}/" \
1397 GCC_CFLAGS="$(GCC_CFLAGS)" incinstalldir=$${thisdir1}/include
41fe5ef9 1398 touch objc-headers
ba1811f1 1399\f
79d8453e
RS
1400# Remake the info files.
1401
8dbda01e
RS
1402doc: info
1403info: $(srcdir)/cpp.info $(srcdir)/gcc.info
79d8453e 1404
f780d21b 1405$(srcdir)/cpp.info: cpp.texi
1c0015c2 1406 cd $(srcdir); $(MAKEINFO) cpp.texi
79d8453e 1407
f780d21b 1408#$(srcdir)/gplus.info: gplus.texi
fcd40e95 1409# $(MAKEINFO) `echo $(srcdir)/gplus.texi | sed 's,^\./,,'`
79d8453e 1410
f780d21b
RS
1411$(srcdir)/gcc.info: gcc.texi extend.texi install.texi invoke.texi \
1412 md.texi rtl.texi tm.texi
1c0015c2 1413 cd $(srcdir); $(MAKEINFO) gcc.texi
f780d21b 1414
8dbda01e
RS
1415dvi: $(srcdir)/gcc.dvi $(srcdir)/cpp.dvi
1416
dd08cdda
RS
1417# This works with GNU Make's default rule.
1418$(srcdir)/gcc.dvi: gcc.texi extend.texi install.texi invoke.texi \
1419 md.texi rtl.texi tm.texi
d8984b6e 1420 $(TEXI2DVI) $<
dd08cdda
RS
1421
1422# This works with GNU Make's default rule.
1423$(srcdir)/cpp.dvi: cpp.texi
d8984b6e 1424 $(TEXI2DVI) $<
dd08cdda 1425
f780d21b 1426$(srcdir)/INSTALL: install1.texi install.texi
fcd40e95 1427 $(MAKEINFO) -D INSTALLONLY --no-header `echo $(srcdir)/install1.texi | sed 's,^\./,,'`
79d8453e
RS
1428\f
1429# Deletion of files made during compilation.
1430# There are four levels of this:
47547081 1431# `mostlyclean', `clean', `distclean' and `realclean'.
79d8453e 1432# `mostlyclean' is useful while working on a particular type of machine.
2e494f70 1433# It deletes most, but not all, of the files made by compilation.
79d8453e 1434# It does not delete libgcc.a or its parts, so it won't have to be recompiled.
2e494f70 1435# `clean' deletes everything made by running `make all'.
47547081 1436# `distclean' also deletes the files made by config.
79d8453e
RS
1437# `realclean' also deletes everything that could be regenerated automatically.
1438
47547081 1439
79d8453e
RS
1440mostlyclean:
1441 -rm -f $(STAGESTUFF)
b7677189
RS
1442# Clean the objc subdir if we created one.
1443 if [ -d objc ]; then \
1444 srcdir1=`cd $(srcdir); pwd`; \
dbe56a66 1445 cd objc; $(MAKE) -f $$srcdir1/objc/Makefile mostlyclean; \
b7677189 1446 else true; fi
8ba23f20 1447 -rm -f libobjc.a
79d8453e
RS
1448# Delete the temporary source copies for cross compilation.
1449 -rm -f $(HOST_PREFIX_1)rtl.c $(HOST_PREFIX_1)rtlanal.c
1450 -rm -f $(HOST_PREFIX_1)alloca.c $(HOST_PREFIX_1)malloc.c
1451 -rm -f $(HOST_PREFIX_1)obstack.c
1452# Delete the temp files made in the course of building libgcc.a.
7c65f72c 1453 -rm -f tmplibgcc* tmpcopy xlimits.h
79d8453e
RS
1454 for name in $(LIB1FUNCS); do rm -f $${name}.c; done
1455# Delete other temporary files.
cadb41d5 1456 -rm -f tmp-float.h tmp-gcc.xtar.gz
c21cf0a7 1457 -rm -f tmp-foo1 tmp-foo2 tmp-proto.* tmp-unproto.1 tmp-SYSCALLS.s
79d8453e
RS
1458# Delete the stamp files.
1459 -rm -f stamp-* tmp-*
2e494f70 1460# Delete debugging dump files.
79d8453e 1461 -rm -f *.greg *.lreg *.combine *.flow *.cse *.jump *.rtl *.tree *.loop
2e494f70
RS
1462 -rm -f *.dbr *.jump2 *.sched *.cse2 *.sched2 *.stack
1463# Delete some files made during installation.
42118350 1464 -rm -f specs gfloat.h float.h-* enquire SYSCALLS.c.X SYSCALLS.c
47547081 1465 -rm -f collect collect2 ld mips-tfile mips-tdump alloca.s
2e494f70
RS
1466# Delete unwanted output files from TeX.
1467 -rm -f *.toc *.log *.vr *.fn *.cp *.tp *.ky *.pg
47547081
RS
1468# Delete sorted indices we don't actually use.
1469 -rm -f gcc.vrs gcc.kys gcc.tps gcc.pgs gcc.fns
2e494f70 1470# Delete core dumps.
99f1660f 1471 -rm -f core config/core
79d8453e 1472
47547081
RS
1473# Delete all files made by compilation
1474# that don't exist in the distribution.
79d8453e 1475clean: mostlyclean
20bd0ab1
RS
1476# It may not be quite desirable to delete unprotoize.c here,
1477# but the spec for `make clean' requires it.
1478# Using unprotoize.c is not quite right in the first place,
1479# but what better way is there?
3aa072f2 1480 -rm -f libgcc.a libgcc1.a libgcc2.a libgcc2.ready libgcc1.null
be0d23ff 1481 -rm -f *.dvi
ba1811f1 1482# Delete the include directory.
adb65c99 1483 -rm -rf stmp-* include objc-headers
79d8453e 1484
47547081
RS
1485# Delete all files that users would normally create
1486# while building and installing GCC.
2e494f70 1487distclean: clean
4ee660d2 1488 -rm -f tm.h aux-output.c config.h md config.status tconfig.h hconfig.h
2e0b13db 1489 -rm -f Makefile *.oaux
47547081 1490 -rm -fr stage1 stage2 stage3 stage4
3dab45b7
RS
1491 -rm -f cp-parse.output
1492 -rm -f objc-parse.output
1493 -rm -f c-parse.output
2e494f70
RS
1494
1495# Delete anything likely to be found in the source directory
1496# that shouldn't be in the distribution.
1497extraclean: distclean
fb92d909 1498 -rm -rf =* ./"#"* *~* config/=* config/"#"* config/*~*
be0d23ff 1499 -rm -f patch* *.orig *.rej config/patch* config/*.orig config/*.rej
3dab45b7
RS
1500 -rm -f config/*/=* config/*/"#"* config/*/*~*
1501 -rm -f config/*/*.orig config/*/*.rej
b5b5f410
RS
1502 -rm -f objc/=* objc/"#"* objc/*~*
1503 -rm -f objc/*.orig objc/*.rej
184be4bf
RS
1504 -rm -f *.dvi *.oaux *.d *.[zZ] *.gz
1505 -rm -f *.tar *.xtar *diff *.diff.* *.tar.* *.xtar.* *diffs
3dab45b7 1506 -rm -f *lose config/*lose config/*/*lose
32e6e69a 1507 -rm -f *.s *.s[0-9] *.i install1.texi config/ChangeLog
79d8453e
RS
1508
1509# Get rid of every file that's generated from some other file.
1510# Most of these files ARE PRESENT in the GCC distribution.
2e494f70 1511realclean: distclean
75d20d4f 1512 -rm -f c-parse.y objc-parse.y
79d8453e
RS
1513 -rm -f cp-parse.c cp-parse.h cp-parse.output
1514 -rm -f objc-parse.c objc-parse.output
79d8453e
RS
1515 -rm -f c-parse.c c-parse.h c-parse.output
1516 -rm -f cexp.c cexp.output TAGS
2e494f70
RS
1517 -rm -f cpp.info* cpp.??s cpp.*aux
1518 -rm -f gcc.info* gcc.??s gcc.*aux
1519 -rm -f gplus.info* gplus.??s gplus.*aux
79d8453e
RS
1520\f
1521# Entry points `install' and `uninstall'.
2e494f70 1522# Also use `install-collect2' to install collect2 when the config files don't.
79d8453e 1523
1402d22c 1524# The semicolon is to prevent the install.sh -> install default rule
7bd95cc1
BK
1525# from doing anything. Having it run true helps avoid problems and
1526# noise from versions of make which don't like to have null commands.
d960abef 1527install: $(INSTALL_TARGET) ; @true
79d8453e 1528
ba1811f1 1529# Copy the compiler files into directories where they will be run.
b583eed8
DE
1530install-normal: install-common $(INSTALL_HEADERS) $(INSTALL_LIBGCC) \
1531 install-man install-info
79d8453e 1532
057f494b
RS
1533# Do nothing while making gcc with a cross-compiler. The person who
1534# makes gcc for the target machine has to know how to put a complete
1535# gcc together by hand.
1536install-build: force
1537 @echo You have to install gcc on your target machine by hand.
1538
79d8453e
RS
1539# Run this on the target machine
1540# to finish installation of cross compiler.
1541install-cross-rest: install-float-h-cross
1542
1543# Install float.h for cross compiler.
1544# Run this on the target machine!
1545install-float-h-cross:
3f7531db
RS
1546# if [ -f enquire ] ; then true; else false; fi
1547# Note: don't use -. We should fail right away if enquire was not made.
1548 ./enquire -f > $(tmpdir)/float.h
79d8453e 1549 -rm -f $(libsubdir)/include/float.h
62c13b81
RS
1550 $(INSTALL_DATA) $(tmpdir)/float.h $(libsubdir)/include/float.h
1551 -rm -f $(tmpdir)/float.h
79d8453e
RS
1552 chmod a-x $(libsubdir)/include/float.h
1553
1554# Create the installation directory.
1555install-dir:
935e11b0
TW
1556 -if [ -d $(libdir) ] ; then true ; else mkdir $(libdir) ; fi
1557 -if [ -d $(libdir)/gcc-lib ] ; then true ; else mkdir $(libdir)/gcc-lib ; fi
316bd062
RS
1558# This dir isn't curretly searched by cpp.
1559# -if [ -d $(libdir)/gcc-lib/include ] ; then true ; else mkdir $(libdir)/gcc-lib/include ; fi
935e11b0
TW
1560 -if [ -d $(libdir)/gcc-lib/$(target) ] ; then true ; else mkdir $(libdir)/gcc-lib/$(target) ; fi
1561 -if [ -d $(libdir)/gcc-lib/$(target)/$(version) ] ; then true ; else mkdir $(libdir)/gcc-lib/$(target)/$(version) ; fi
f780d21b 1562 -if [ -d $(libdir)/gcc-lib/$(target)/$(version)/include ] ; then true ; else mkdir $(libdir)/gcc-lib/$(target)/$(version)/include ; fi
935e11b0 1563 -if [ -d $(bindir) ] ; then true ; else mkdir $(bindir) ; fi
51e787ca 1564 -if [ -d $(includedir) ] ; then true ; else mkdir $(includedir) ; fi
1a5e5e4b 1565 -if [ -d $(tooldir) ] ; then true ; else mkdir $(tooldir) ; fi
7b4d5f42 1566 -if [ -d $(assertdir) ] ; then true ; else mkdir $(assertdir) ; fi
0b2fbcb2 1567 -if [ -d $(infodir) ] ; then true ; else mkdir $(infodir) ; fi
79d8453e
RS
1568# We don't use mkdir -p to create the parents of mandir,
1569# because some systems don't support it.
1570# Instead, we use this technique to create the immediate parent of mandir.
935e11b0 1571 -parent=`echo $(mandir)|sed -e 's@/[^/]*$$@@'`; \
79d8453e
RS
1572 if [ -d $$parent ] ; then true ; else mkdir $$parent ; fi
1573 -if [ -d $(mandir) ] ; then true ; else mkdir $(mandir) ; fi
1574
1575# Install the compiler executables built during cross compilation.
c3279a01
RS
1576# Deps on $(srcdir)/g++ $(srcdir)/c++ would be natural here,
1577# but the latter would get confused with the target `c++'.
1578install-common: native install-dir xgcc $(EXTRA_PARTS)
79d8453e
RS
1579 for file in $(COMPILERS); do \
1580 if [ -f $$file ] ; then \
1581 rm -f $(libsubdir)/$$file; \
1582 $(INSTALL_PROGRAM) $$file $(libsubdir)/$$file; \
1583 else true; \
1584 fi; \
1585 done
47547081 1586 for file in $(EXTRA_PASSES) $(EXTRA_PARTS) $(EXTRA_PROGRAMS) $(USE_COLLECT2) ..; do \
79d8453e
RS
1587 if [ x"$$file" != x.. ]; then \
1588 rm -f $(libsubdir)/$$file; \
1589 $(INSTALL_PROGRAM) $$file $(libsubdir)/$$file; \
1590 else true; fi; \
1591 done
f0ec1f64 1592# Don't mess with specs if it doesn't exist yet.
2a7bccbb
TG
1593 -if [ -f specs ] ; then \
1594 rm -f $(libsubdir)/specs; \
f0ec1f64
RS
1595 $(INSTALL_DATA) specs $(libsubdir)/specs; \
1596 fi
97ac9064 1597# Install the driver program as $(target)-gcc
79d8453e
RS
1598# and also as either gcc (if native) or $(tooldir)/bin/gcc.
1599 -if [ -f gcc-cross ] ; then \
dab8915b 1600 rm -f $(bindir)/$(target)-gcc; \
97ac9064 1601 $(INSTALL_PROGRAM) gcc-cross $(bindir)/$(target)-gcc; \
79d8453e
RS
1602 if [ -d $(tooldir)/bin/. ] ; then \
1603 rm -f $(tooldir)/bin/gcc; \
1604 $(INSTALL_PROGRAM) gcc-cross $(tooldir)/bin/gcc; \
79d8453e
RS
1605 else true; fi; \
1606 else \
1607 rm -f $(bindir)/gcc; \
acbbf3d9 1608 $(INSTALL_PROGRAM) xgcc $(bindir)/gcc; \
97ac9064
ILT
1609 rm -f $(bindir)/$(target)-gcc-1; \
1610 ln $(bindir)/gcc $(bindir)/$(target)-gcc-1; \
1611 mv $(bindir)/$(target)-gcc-1 $(bindir)/$(target)-gcc; \
79d8453e 1612 fi
cfa88f62 1613# Install protoize if it was compiled.
17d4d0e0 1614 -if [ -f protoize ]; \
cfa88f62
RS
1615 then \
1616 rm -f $(bindir)/protoize; \
1617 $(INSTALL_PROGRAM) protoize $(bindir)/protoize; \
1618 rm -f $(bindir)/unprotoize; \
1619 $(INSTALL_PROGRAM) unprotoize $(bindir)/unprotoize; \
1620 rm -f $(libsubdir)/SYSCALLS.c.X; \
1621 $(INSTALL_DATA) SYSCALLS.c.X $(libsubdir)/SYSCALLS.c.X; \
1622 chmod a-x $(libsubdir)/SYSCALLS.c.X; \
1623 fi
8f80892b
JW
1624 -if [ -f cc1plus ] ; then \
1625 rm -f $(bindir)/c++ ; \
1626 $(INSTALL_PROGRAM) $(srcdir)/c++ $(bindir)/c++ ; \
1627 rm -f $(bindir)/g++ ; \
1628 $(INSTALL_PROGRAM) $(srcdir)/g++ $(bindir)/g++ ; \
1629 fi
79d8453e
RS
1630 -rm -f $(libsubdir)/cpp
1631 $(INSTALL_PROGRAM) cpp $(libsubdir)/cpp
1632
0b2fbcb2
RS
1633# Install the info files.
1634install-info: doc
1635 -rm -f $(infodir)/cpp.info* $(infodir)/gcc.info*
1636 cd $(srcdir); for f in cpp.info* gcc.info*; \
1637 do $(INSTALL_DATA) $$f $(infodir)/$$f; done
1638 -chmod a-x $(infodir)/cpp.info* $(infodir)/gcc.info*
1639
79d8453e 1640# Install the man pages.
acbbf3d9 1641install-man: install-dir $(srcdir)/gcc.1 $(srcdir)/cccp.1 $(srcdir)/g++.1
79d8453e 1642 -rm -f $(mandir)/gcc$(manext)
2e0b13db
RS
1643 -$(INSTALL_DATA) $(srcdir)/gcc.1 $(mandir)/gcc$(manext)
1644 -chmod a-x $(mandir)/gcc$(manext)
2e494f70 1645 -rm -f $(mandir)/cccp$(manext)
2e0b13db
RS
1646 -$(INSTALL_DATA) $(srcdir)/cccp.1 $(mandir)/cccp$(manext)
1647 -chmod a-x $(mandir)/cccp$(manext)
2e0b13db
RS
1648 -$(INSTALL_DATA) $(srcdir)/g++.1 $(mandir)/g++$(manext)
1649 -chmod a-x $(mandir)/g++$(manext)
79d8453e
RS
1650
1651# Install the library.
4b3c8365 1652install-libgcc: libgcc.a install-dir
79d8453e
RS
1653 -if [ -f libgcc.a ] ; then \
1654 rm -f $(libsubdir)/libgcc.a; \
1655 $(INSTALL_DATA) libgcc.a $(libsubdir)/libgcc.a; \
1656 if $(RANLIB_TEST) ; then \
1657 (cd $(libsubdir); $(RANLIB) libgcc.a); else true; fi; \
1658 chmod a-x $(libsubdir)/libgcc.a; \
1659 else true; fi
1660
62c13b81
RS
1661# Install the objc run time library.
1662install-libobjc: libobjc.a install-dir
1663 -if [ -f libobjc.a ] ; then \
1664 rm -f $(libsubdir)/libobjc.a; \
1665 $(INSTALL_DATA) libobjc.a $(libsubdir)/libobjc.a; \
1666 if $(RANLIB_TEST) ; then \
1667 (cd $(libsubdir); $(RANLIB) libobjc.a); else true; fi; \
1668 chmod a-x $(libsubdir)/libobjc.a; \
1669 else true; fi
1670
ba1811f1
ILT
1671# Install all the header files built in the include subdirectory.
1672install-headers: install-include-dir $(INSTALL_HEADERS_DIR) install-assert-h
1673# Fix symlinks to absolute paths in the installed include directory to
1674# point to the installed directory, not the build directory.
1675 -files=`cd $(libsubdir)/include; find . -type l -print 2>/dev/null`; \
1676 if [ $$? -eq 0 ]; then \
1677 dir=`cd include; pwd`; \
1678 for i in $$files; do \
1679 dest=`ls -ld $(libsubdir)/include/$$i | sed -n 's/.*-> //p'`; \
1680 if expr "$$dest" : "$$dir.*" > /dev/null; then \
1681 rm -f $(libsubdir)/include/$$i; \
44735512 1682 ln -s `echo $$i | sed "s|/[^/]*|/..|g" | sed 's|/..$$||'``echo "$$dest" | sed "s|$$dir||"` $(libsubdir)/include/$$i; \
ba1811f1
ILT
1683 fi; \
1684 done; \
1685 fi
79d8453e 1686
ba1811f1 1687# Create or recreate the gcc private include file directory.
4808d7a7 1688install-include-dir: install-dir
ba1811f1
ILT
1689 -rm -rf $(libsubdir)/include
1690 mkdir $(libsubdir)/include
1691 -chmod a+rx $(libsubdir)/include
1692
1693# Install the include directory using tar.
1694install-headers-tar: stmp-headers install-include-dir
e6431ec5
RS
1695 cd include; \
1696 (tar cf - .; exit 0) | (cd $(libsubdir)/include; tar $(TAROUTOPTS) - )
1697# /bin/sh on some systems returns the status of the first tar,
1698# and that can lose with GNU tar which always writes a full block.
1699# So use `exit 0' to ignore its exit status.
ba1811f1
ILT
1700
1701# Install the include directory using cpio.
1702install-headers-cpio: stmp-headers install-include-dir
585ec938 1703 cd include; find . -print | cpio -pdum $(libsubdir)/include
79d8453e 1704
49ba557e
RS
1705# Put assert.h where it won't override GNU libc's assert.h.
1706# It goes in a dir that is searched after GNU libc's headers;
1707# thus, the following conditionals are no longer needed.
1708# But it's not worth deleting them now.
1709## Don't replace the assert.h already there if it is not from GCC.
1710## This code would be simpler if it tested for -f ... && ! grep ...
1711## but supposedly the ! operator is missing in sh on some systems.
ba1811f1 1712install-assert-h: assert.h install-dir
c9d929d7
RS
1713 if [ -f $(assertdir)/assert.h ]; \
1714 then \
998812ac 1715 if grep "__eprintf" $(assertdir)/assert.h >/dev/null; \
396f9edb 1716 then \
c9d929d7
RS
1717 rm -f $(assertdir)/assert.h; \
1718 $(INSTALL_DATA) $(srcdir)/assert.h $(assertdir)/assert.h; \
0cd4060d 1719 chmod a-x $(assertdir)/assert.h; \
c9d929d7
RS
1720 else true; \
1721 fi; \
9fcedbef 1722 else \
6204c24f
RS
1723 rm -f $(assertdir)/assert.h; \
1724 $(INSTALL_DATA) $(srcdir)/assert.h $(assertdir)/assert.h; \
0cd4060d 1725 chmod a-x $(assertdir)/assert.h; \
9fcedbef 1726 fi
79d8453e 1727
2e494f70
RS
1728# Use this target to install the program `collect2' under the name `ld'.
1729install-collect2: collect2
1730 $(INSTALL_PROGRAM) collect2 $(libsubdir)/ld
1731# Install the driver program as $(libsubdir)/gcc for collect2.
acbbf3d9 1732 $(INSTALL_PROGRAM) xgcc $(libsubdir)/gcc
2e494f70 1733
79d8453e
RS
1734# Cancel installation by deleting the installed files.
1735uninstall:
1736 -rm -rf $(libsubdir)
1737 -rm -rf $(bindir)/gcc
79d8453e
RS
1738 -rm -rf $(bindir)/protoize
1739 -rm -rf $(bindir)/unprotoize
1740 -rm -rf $(mandir)/gcc$(manext)
976876dd 1741 -rm -rf $(mandir)/g++$(manext)
2e494f70 1742 -rm -rf $(mandir)/cccp$(manext)
79d8453e
RS
1743 -rm -rf $(mandir)/protoize$(manext)
1744 -rm -rf $(mandir)/unprotoize$(manext)
1745\f
1746# These exist for maintenance purposes.
1747
1748# Update the tags table.
1749TAGS: force
1750 cd $(srcdir); \
1751 mkdir temp; \
abd09f97 1752 mv -f c-parse.[ch] cp-parse.[ch] objc-parse.c cexp.c =*.[chy] temp; \
79d8453e
RS
1753 etags *.y *.h *.c; \
1754 mv temp/* .; \
1755 rmdir temp
1756
1757# Create the distribution tar file.
cadb41d5
RS
1758#dist: gcc-$(version).tar.gz
1759dist: gcc.xtar.gz
79d8453e 1760
cadb41d5
RS
1761gcc.xtar.gz: gcc.xtar
1762 gzip < gcc.xtar > tmp-gcc.xtar.gz
1763 mv tmp-gcc.xtar.gz gcc.xtar.gz
79d8453e 1764
cadb41d5
RS
1765#gcc-$(version).tar.gz: gcc-$(version).tar
1766# gzip < gcc-$(version).tar > gcc-$(version).tar.gz
79d8453e
RS
1767
1768#gcc-$(version).tar:
7d27b36c
RS
1769gcc.xtar: distdir
1770# Make the distribution.
1771 tar chf gcc.xtar gcc-$(version)
1772
976876dd
RS
1773distdir: doc $(srcdir)/INSTALL c-parse.y objc-parse.y cp-parse.y \
1774 c-parse.c cp-parse.c objc-parse.c cexp.c
f780d21b
RS
1775 if grep -s "for version ${version}" gcc.texi; \
1776 then true; \
96b5daff 1777 else echo "You must update the version number in \`gcc.texi'"; sleep 10;\
f780d21b 1778 fi
be0d23ff
RS
1779# Update the version number in README
1780 awk '$$1 " " $$2 " " $$3 == "This directory contains" \
1781 { $$6 = version; print $$0 } \
1782 $$1 " " $$2 " " $$3 != "This directory contains"' \
1783 version=$(version) README > tmp.README
1784 mv tmp.README README
2e494f70 1785 -rm -rf gcc-$(version) tmp
79d8453e
RS
1786# Put all the files in a temporary subdirectory
1787# which has the name that we want to have in the tar file.
2e494f70
RS
1788 mkdir tmp
1789 mkdir tmp/config
ea727bbf 1790 mkdir tmp/objc
2e494f70 1791 for file in *[0-9a-zA-Z+]; do \
be0d23ff 1792 ln $$file tmp > /dev/null 2>&1 || cp $$file tmp; \
2e494f70
RS
1793 done
1794 cd config; \
1795 for file in *[0-9a-zA-Z+]; do \
f95640cc 1796 if test -d $$file && test "$$file" != RCS; then \
e52114f8
RM
1797 mkdir ../tmp/config/$$file; \
1798 cd $$file; \
1799 for subfile in *[0-9a-zA-Z+]; do \
1800 ln $$subfile ../../tmp/config/$$file >/dev/null 2>&1 \
1801 || cp $$subfile ../../tmp/config/$$file; \
1802 done; \
1803 cd ..; \
1804 else \
1805 ln $$file ../tmp/config >/dev/null 2>&1 \
1806 || cp $$file ../tmp/config; \
1807 fi; \
79d8453e 1808 done
ea727bbf
RS
1809 cd objc; \
1810 for file in *[0-9a-zA-Z+]; do \
057f494b 1811 ln $$file ../tmp/objc >/dev/null 2>&1 || cp $$file ../tmp/objc; \
ea727bbf 1812 done
2e494f70
RS
1813 ln .gdbinit tmp
1814 mv tmp gcc-$(version)
79d8453e 1815# Get rid of everything we don't want in the distribution.
2e494f70 1816 cd gcc-$(version); make -f Makefile.in extraclean
79d8453e
RS
1817
1818# do make -f ../gcc/Makefile maketest DIR=../gcc
1819# in the intended test directory to make it a suitable test directory.
1820# THIS IS OBSOLETE; use the -srcdir operand in configure instead.
1821maketest:
1822 ln -s $(DIR)/*.[chy] .
1823 ln -s $(DIR)/configure .
1824 ln -s $(DIR)/*.def .
1825 -rm -f =*
1826 ln -s $(DIR)/.gdbinit .
1827 ln -s $(DIR)/$(FIXINCLUDES) .
1828 -ln -s $(DIR)/bison.simple .
1829 ln -s $(DIR)/config .
1830 ln -s $(DIR)/move-if-change .
1831# The then and else were swapped to avoid a problem on Ultrix.
1832 if [ ! -f Makefile ] ; then ln -s $(DIR)/Makefile .; else false; fi
1833 -rm tm.h aux-output.c config.h md
1834 make clean
1835# You must then run config to set up for compilation.
acbbf3d9 1836
9c4614c3
TW
1837bootstrap: force
1838# Only build the C compiler for stage1, because that is the only one that
1839# we can guarantee will build with the native compiler, and also it is the
1840# only thing useful for building stage2.
676ce223 1841 $(MAKE) CC="$(CC)" libdir=$(libdir) LANGUAGES=c
79d8453e 1842 $(MAKE) stage1
2e494f70
RS
1843# This used to define ALLOCA as empty, but that would lead to bad results
1844# for a subsequent `make install' since that would not have ALLOCA empty.
1845# To prevent `make install' from compiling alloca.o and then relinking cc1
1846# because alloca.o is newer, we permit these recursive makes to compile
1847# alloca.o. Then cc1 is newer, so it won't have to be relinked.
a2ecc7b9 1848 $(MAKE) CC="stage1/xgcc -Bstage1/" CFLAGS="$(BOOT_CFLAGS)" LDFLAGS="$(BOOT_LDFLAGS)" libdir=$(libdir) LANGUAGES="$(LANGUAGES)"
79d8453e 1849 $(MAKE) stage2
a2ecc7b9 1850 $(MAKE) CC="stage2/xgcc -Bstage2/" CFLAGS="$(BOOT_CFLAGS)" LDFLAGS="$(BOOT_LDFLAGS)" libdir=$(libdir) LANGUAGES="$(LANGUAGES)"
79d8453e
RS
1851
1852bootstrap2: force
a2ecc7b9 1853 $(MAKE) CC="stage1/xgcc -Bstage1/" CFLAGS="$(BOOT_CFLAGS)" LDFLAGS="$(BOOT_LDFLAGS)" libdir=$(libdir) LANGUAGES="$(LANGUAGES)"
79d8453e 1854 $(MAKE) stage2
a2ecc7b9 1855 $(MAKE) CC="stage2/xgcc -Bstage2/" CFLAGS="$(BOOT_CFLAGS)" LDFLAGS="$(BOOT_LDFLAGS)" libdir=$(libdir) LANGUAGES="$(LANGUAGES)"
79d8453e
RS
1856
1857bootstrap3: force
a2ecc7b9 1858 $(MAKE) CC="stage2/xgcc -Bstage2/" CFLAGS="$(BOOT_CFLAGS)" LDFLAGS="$(BOOT_LDFLAGS)" libdir=$(libdir) LANGUAGES="$(LANGUAGES)"
79d8453e 1859
dcfedcd0
RK
1860# Compare the object files in the current directory with those in the
1861# stage2 directory.
1862
1863compare: force
1864 for file in *.o; do \
acbbf3d9
RS
1865 tail +16c $$file > tmp-foo1; \
1866 tail +16c stage2/$$file > tmp-foo2 2>/dev/null \
1867 && (cmp tmp-foo1 tmp-foo2 || echo $$file differs); \
dcfedcd0
RK
1868 done
1869 -rm -f tmp-foo*
1870
1871# Similar, but compare with stage3 directory
1872compare3: force
1873 for file in *.o; do \
acbbf3d9
RS
1874 tail +16c $$file > tmp-foo1; \
1875 tail +16c stage3/$$file > tmp-foo2 2>/dev/null \
1876 && (cmp tmp-foo1 tmp-foo2 || echo $$file differs); \
dcfedcd0
RK
1877 done
1878 -rm -f tmp-foo*
1879
79d8453e
RS
1880# Copy the object files from a particular stage into a subdirectory.
1881stage1: force
2e494f70 1882 -if [ -d stage1 ] ; then true ; else mkdir stage1 ; fi
79d8453e
RS
1883 -mv $(STAGESTUFF) stage1
1884 -rm -f stage1/libgcc.a
1885 -cp libgcc.a stage1
1886 -if $(RANLIB_TEST) ; then $(RANLIB) stage1/libgcc.a; else true; fi
1887
1888stage2: force
2e494f70 1889 -if [ -d stage2 ] ; then true ; else mkdir stage2 ; fi
79d8453e
RS
1890 -mv $(STAGESTUFF) stage2
1891 -rm -f stage2/libgcc.a
1892 -cp libgcc.a stage2
1893 -if $(RANLIB_TEST) ; then $(RANLIB) stage2/libgcc.a; else true; fi
1894
1895stage3: force
935e11b0 1896 -if [ -d stage3 ] ; then true ; else mkdir stage3 ; fi
79d8453e
RS
1897 -mv $(STAGESTUFF) stage3
1898 -rm -f stage3/libgcc.a
1899 -cp libgcc.a stage3
1900 -if $(RANLIB_TEST) ; then $(RANLIB) stage3/libgcc.a; else true; fi
1901
1902stage4: force
935e11b0 1903 -if [ -d stage4 ] ; then true ; else mkdir stage4 ; fi
79d8453e
RS
1904 -mv $(STAGESTUFF) stage4
1905 -rm -f stage4/libgcc.a
1906 -cp libgcc.a stage4
1907 -if $(RANLIB_TEST) ; then $(RANLIB) stage4/libgcc.a; else true; fi
1908
1909# Copy just the executable files from a particular stage into a subdirectory,
1910# and delete the object files. Use this if you're just verifying a version
1911# that is pretty sure to work, and you are short of disk space.
1912risky-stage1: force
935e11b0 1913 -if [ -d stage1 ] ; then true ; else mkdir stage1 ; fi
6fb26153 1914 -mv $(GCC_PARTS) stage1
79d8453e
RS
1915 -rm -f stage1/libgcc.a
1916 -cp libgcc.a stage1 && $(RANLIB) stage1/libgcc.a
1917 -make clean
1918
1919risky-stage2: force
935e11b0 1920 -if [ -d stage2 ] ; then true ; else mkdir stage2 ; fi
6fb26153 1921 -mv $(GCC_PARTS) stage2
79d8453e
RS
1922 -rm -f stage2/libgcc.a
1923 -cp libgcc.a stage2 && $(RANLIB) stage2/libgcc.a
1924 -make clean
1925
1926risky-stage3: force
935e11b0 1927 -if [ -d stage3 ] ; then true ; else mkdir stage3 ; fi
6fb26153 1928 -mv $(GCC_PARTS) stage3
79d8453e
RS
1929 -rm -f stage3/libgcc.a
1930 -cp libgcc.a stage3 && $(RANLIB) stage3/libgcc.a
1931 -make clean
1932
1933risky-stage4: force
935e11b0 1934 -if [ -d stage4 ] ; then true ; else mkdir stage4 ; fi
6fb26153 1935 -mv $(GCC_PARTS) stage4
79d8453e
RS
1936 -rm -f stage4/libgcc.a
1937 -cp libgcc.a stage4 && $(RANLIB) stage4/libgcc.a
1938 -make clean
1939
1940#In GNU Make, ignore whether `stage*' exists.
1941.PHONY: stage1 stage2 stage3 stage4 clean realclean TAGS bootstrap
1942.PHONY: risky-stage1 risky-stage2 risky-stage3 risky-stage4
1943
1944force:
This page took 0.40422 seconds and 5 git commands to generate.