OSDN Git Service

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