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