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