]> gcc.gnu.org Git - gcc.git/blame - gcc/Makefile.in
*** empty log message ***
[gcc.git] / gcc / Makefile.in
CommitLineData
79d8453e
RS
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,
2e494f70 22# uninstall, TAGS, mostlyclean, clean, distclean, realclean,
79d8453e
RS
23# stage1, stage2, stage3, stage4.
24
2e494f70
RS
25# Suppress smart makes who think they know how to automake Yacc files
26.y.c:
27
79d8453e
RS
28.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
2e494f70 90# Version of ar to use when compiling libgcc1.a.
79d8453e
RS
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
2e494f70
RS
127# Directory in which to put host dependent programs and libraries
128exec_prefix = $(prefix)
79d8453e 129# Directory in which to put the executable for the command `gcc'
2e494f70 130bindir = $(exec_prefix)/bin
79d8453e 131# Directory in which to put the directories used by the compiler.
2e494f70 132libdir = $(exec_prefix)/lib
79d8453e 133# Directory in which the compiler finds executables, libraries, etc.
2e494f70 134libsubdir = $(libdir)/gcc-lib/$(target)/$(version)
79d8453e
RS
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.
2e494f70
RS
151# The value may be empty; that means to do absolutely nothing
152# with or for libgcc1.a.
79d8453e
RS
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
2e494f70
RS
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.
79d8453e
RS
173# The rules for compiling them should be in the t-* file for the machine.
174EXTRA_PARTS =
175
2e494f70
RS
176# List of extra object files that should be compiled and linked with
177# compiler proper (cc1, cc1obj, cc1plus).
178EXTRA_OBJS =
179
47547081
RS
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
79d8453e
RS
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.
47547081 210GCC_PARTS=$(GCC_PASSES) libgcc.a $(EXTRA_PROGRAMS) $(USE_COLLECT2) $(EXTRA_PARTS)
79d8453e
RS
211
212# Change this to empty to prevent installing limits.h.
2e494f70 213# Actually, this currently has no effect,
79d8453e 214# and if that causes no problems, it can be deleted.
2e494f70 215# Otherwise, it must be replaced so as to control
79d8453e
RS
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)
2e494f70 233HOST_CLIB=$(CLIB)
79d8453e
RS
234HOST_LDFLAGS=$(LDFLAGS)
235HOST_CPPFLAGS=$(ALL_CPPFLAGS)
2e494f70
RS
236HOST_ALLOCA=$(ALLOCA)
237HOST_MALLOC=$(MALLOC)
238HOST_OBSTACK=$(OBSTACK)
79d8453e
RS
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).
2e494f70 252all: all.indirect
79d8453e
RS
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
2e494f70
RS
259all.indirect: $(ALL)
260
79d8453e
RS
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.
2e494f70
RS
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 `
79d8453e
RS
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.
2e494f70 283HOST_LIBDEPS= $(HOST_PREFIX)$(HOST_OBSTACK) $(HOST_PREFIX)$(HOST_ALLOCA) $(HOST_PREFIX)$(HOST_MALLOC)
79d8453e
RS
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.
2e494f70
RS
291HOST_LIBS = $(USE_HOST_OBSTACK) $(USE_HOST_ALLOCA) $(USE_HOST_MALLOC) \
292 $(HOST_CLIB)
79d8453e
RS
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 \
47547081
RS
336 rtl.o print-rtl.o rtlanal.o emit-rtl.o \
337 dbxout.o sdbout.o dwarfout.o xcoffout.o \
79d8453e
RS
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 \
47547081 342 insn-attrtab.o aux-output.o getpwd.o $(EXTRA_OBJS)
79d8453e
RS
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 \
47547081
RS
358 $(GCC_PASSES) $(EXTRA_PARTS) $(EXTRA_PROGRAMS) gcc-cross cccp \
359 cc1plus cc1obj enquire protoize unprotoize specs collect2
79d8453e
RS
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
47547081 401Makefile: $(srcdir)/Makefile.in $(srcdir)/configure $(srcdir)/version.c \
79d8453e
RS
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.
2e494f70 413rest.encap: libgcc.a float.h $(EXTRA_PARTS)
79d8453e
RS
414# This is what is made with the host's compiler
415# whether making a cross compiler or not.
47547081 416native: config.status cpp $(LANGUAGES) $(EXTRA_PASSES) $(EXTRA_PROGRAMS) $(USE_COLLECT2)
79d8453e
RS
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
2e494f70
RS
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.
79d8453e 428config.status:
2e494f70
RS
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
79d8453e
RS
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)
469 -cp $(srcdir)/enquire.c . > /dev/null 2>&1
2e494f70
RS
470# Breaking this line caused a problem with one version of GNU make.
471 $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(ALL_CPPFLAGS) $(ENQUIRE_CFLAGS) -I. -c enquire.c
79d8453e
RS
472\f
473# Build libgcc.a.
474# This is done in two parts because some functions, in libgcc1.c,
475# must be compiled with something other than gcc,
476# while the rest, in libgcc2.c, must be compiled with gcc.
477# That means we can't do libgcc2.c until after gcc, cc1, etc.
478
479# Use this as value of LIBGCC1 to cause conversion to GNU library format.
480# LIBCONVERT should put its output in libgcc1.conv.
481libgcc1.conv: libgcc1.a
482 $(LIBCONVERT) libgcc1.a libgcc1.conv
483
484# Use this as value of LIBGCC1 to inhibit use of libgcc1.c entirely.
485# Make an empty file instead.
486libgcc1.null: $(CROSS_TOOLS) $(GCC_PASSES)
487 echo "__foo () {}" > dummy.c
488 $(GCC_FOR_TARGET) $(GCC_CFLAGS) -c dummy.c
489 $(OLDAR) $(OLDAR_FLAGS) libgcc1.null dummy.o
490 rm -f dummy.o dummy.c
491
492# Compile the library of arithmetic subroutines with the native compiler.
493# Don't compile it with gcc!
494# (That would cause most arithmetic functions to call themselves.)
495libgcc1.a: libgcc1.c $(CONFIG_H) $(LIB1FUNCS_EXTRA) config.status
496 -rm -f tmplibgcc1.a
497# Actually build it in tmplibgcc1.a, then rename at end,
498# so that libgcc1.a itself remains nonexistent if compilation is aborted.
499# -e causes any failing command to make this rule fail.
500# -e doesn't work in certain shells, so we test $$? as well.
501 set -e; \
502 for name in $(LIB1FUNCS); \
503 do \
504 echo $${name}; \
505 rm -f $${name}.o; \
506 $(OLDCC) $(CCLIBFLAGS) $(INCLUDES) -c -DL$${name} $(srcdir)/libgcc1.c; \
507 if [ $$? -eq 0 ] ; then true; else exit 1; fi; \
508 mv libgcc1.o $${name}.o; \
509 $(OLDAR) $(OLDAR_FLAGS) tmplibgcc1.a $${name}.o; \
510 rm -f $${name}.o; \
511 done
512# Some shells crash when a loop has no items.
513# So make sure there is always at least one--`..'.
514# Then ignore it.
515# We don't use -e here because there are if statements
516# that should not make the command give up when the if condition is false.
517# Instead, we test for failure after each command where it matters.
2e494f70 518 -for file in .. $(LIB1FUNCS_EXTRA); \
79d8453e
RS
519 do \
520 if [ x$${file} != x.. ]; then \
521 name=`echo $${file} | sed -e 's/[.]c$$//' -e 's/[.]asm$$//'`; \
522 echo $${name}; \
523 if [ $${name}.asm = $${file} ]; then \
524 cp $${file} $${name}.s; file=$${name}.s; \
525 if [ $$? -eq 0 ] ; then true; else exit 1; fi; \
526 else true; fi; \
527 $(OLDCC) $(CCLIBFLAGS) $(INCLUDES) -c $${file}; \
528 if [ $$? -eq 0 ] ; then true; else exit 1; fi; \
529 $(OLDAR) $(OLDAR_FLAGS) tmplibgcc1.a $${name}.o; \
530 if [ $$? -eq 0 ] ; then true; else exit 1; fi; \
531 rm -f $${name}.[so]; \
532 else true; \
533 fi; \
534 done
535 mv tmplibgcc1.a libgcc1.a
536
537# Compiling libgcc2.a requires making sure that cc1, etc. have been compiled.
538# But recompiling cc1 should not force recompilation of libgcc2.a.
539# If you want to force recompilation, delete libgcc2.a.
540# Depend on install-cross-tools to make sure we set up properly
541# to run the assembler before we try compiling anything.
542# install-cross-tools does nothing if not cross compiling.
543libgcc2.ready: $(GCC_PASSES) $(CROSS_TOOLS)
544 -if [ -f libgcc2.ready ] ; then \
545 true; \
546 else \
547 touch libgcc2.ready; \
548 fi
549
550libgcc2.a: libgcc2.c libgcc2.ready $(CONFIG_H) $(LIB2FUNCS_EXTRA) \
551 longlong.h gbl-ctors.h config.status
552# Actually build it in tmplibgcc2.a, then rename at end,
553# so that libgcc2.a itself remains nonexistent if compilation is aborted.
554 -rm -f tmplibgcc2.a
555# -e causes any failing command to make this rule fail.
556# -e doesn't work in certain shells, so we test $$? as well.
557 set -e; \
558 for name in $(LIB2FUNCS); \
559 do \
560 echo $${name}; \
2e494f70 561 $(GCC_FOR_TARGET) $(LIBGCC2_CFLAGS) $(INCLUDES) -c -DL$${name} \
79d8453e
RS
562 $(srcdir)/libgcc2.c -o $${name}.o; \
563 if [ $$? -eq 0 ] ; then true; else exit 1; fi; \
564 $(AR) $(AR_FLAGS) tmplibgcc2.a $${name}.o; \
565 rm -f $${name}.o; \
566 done
567# Some shells crash when a loop has no items.
568# So make sure there is always at least one--`..'.
569# Then ignore it.
570# We don't use -e here because there are if statements
571# that should not make the command give up when the if condition is false.
572# Instead, we test for failure after each command where it matters.
2e494f70 573 -for file in .. $(LIB2FUNCS_EXTRA); \
79d8453e
RS
574 do \
575 if [ x$${file} != x.. ]; then \
576 name=`echo $${file} | sed -e 's/[.]c$$//' -e 's/[.]asm$$//'`; \
577 echo $${name}; \
578 if [ $${name}.asm = $${file} ]; then \
579 cp $${file} $${name}.s; file=$${name}.s; \
580 if [ $$? -eq 0 ] ; then true; else exit 1; fi; \
581 else true; fi; \
2e494f70 582 $(GCC_FOR_TARGET) $(LIBGCC2_CFLAGS) $(INCLUDES) -c $${file}; \
79d8453e
RS
583 if [ $$? -eq 0 ] ; then true; else exit 1; fi; \
584 $(AR) $(AR_FLAGS) tmplibgcc2.a $${name}.o; \
585 rm -f $${name}.[so]; \
586 else true; \
587 fi; \
588 done
589 mv tmplibgcc2.a libgcc2.a
590# These lines were deleted from above the mv command
591# because ranlibing libgcc.a itself should suffice.
592# -if [ x${HPUX_GAS} = x ] ; then \
593# if $(RANLIB_TEST) ; then $(RANLIB) tmplibgcc2.a; else true; fi \
594# else true; fi
595
596# Combine the various libraries into a single library, libgcc.a.
597libgcc.a: $(LIBGCC1) $(LIBGCC2)
598 -rm -rf tmplibgcc.a libgcc.a tmpcopy
599 mkdir tmpcopy
2e494f70
RS
600 -if [ x$(LIBGCC1) != x ]; \
601 then (cd tmpcopy; $(AR) x ../$(LIBGCC1)); \
602 else true; \
603 fi
79d8453e
RS
604 (cd tmpcopy; $(AR) x ../$(LIBGCC2))
605 (cd tmpcopy; $(AR) $(AR_FLAGS) ../tmplibgcc.a *.o)
606 rm -rf tmpcopy
607 -if $(RANLIB_TEST) ; then $(RANLIB) tmplibgcc.a; else true; fi
608# Actually build it in tmplibgcc.a, then rename at end,
609# so that libgcc.a itself remains nonexistent if compilation is aborted.
610 mv tmplibgcc.a libgcc.a
611
612
613# Compile two additional files that are linked with every program
614# linked using GCC on system V, for the sake of C++ constructors.
615crtbegin.o: crtstuff.c $(GCC_PASSES) $(CONFIG_H) gbl-ctors.h
616 $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(INCLUDES) -DCRT_BEGIN \
2e494f70 617 -finhibit-size-directive -g0 -c $(srcdir)/crtstuff.c -o crtbegin.o
79d8453e
RS
618
619crtend.o: crtstuff.c $(GCC_PASSES) $(CONFIG_H) gbl-ctors.h
620 $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(INCLUDES) -DCRT_END \
2e494f70 621 -finhibit-size-directive -g0 -c $(srcdir)/crtstuff.c -o crtend.o
79d8453e
RS
622\f
623# Compiling object files from source files.
624
625# Note that dependencies on obstack.h are not written
626# because that file is not part of GCC.
627# Dependencies on gvarargs.h are not written
628# because all that file does, when not compiling with GCC,
629# is include the system varargs.h.
630
631# C language specific files.
632
633c-parse.o : $(srcdir)/c-parse.c $(CONFIG_H) $(TREE_H) c-lex.h c-tree.h input.h flags.h
634 $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) -c $(srcdir)/c-parse.c
635$(srcdir)/c-parse.c $(srcdir)/c-parse.h: $(srcdir)/c-parse.y
636 cd $(srcdir); $(BISON) $(BISONFLAGS) -d c-parse.y -o c-parse.c
637
638c-decl.o : c-decl.c $(CONFIG_H) $(TREE_H) c-tree.h c-lex.h flags.h
639c-typeck.o : c-typeck.c $(CONFIG_H) $(TREE_H) c-tree.h flags.h
640c-lang.o : c-lang.c $(CONFIG_H) $(TREE_H)
641c-lex.o : c-lex.c $(CONFIG_H) $(TREE_H) c-lex.h c-tree.h c-parse.h \
642 input.h flags.h
643c-aux-info.o : c-aux-info.c $(CONFIG_H) $(TREE_H) c-tree.h flags.h
644c-convert.o : c-convert.c $(CONFIG_H) $(TREE_H) flags.h
645
646# C++ language specific files.
647
648cp-parse.o : $(srcdir)/cp-parse.c $(CONFIG_H) $(CPLUS_TREE_H) flags.h
649 $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \
650 `echo $(srcdir)/cp-parse.c | sed 's,^\./,,'`
651
652$(srcdir)/cp-parse.c $(srcdir)/cp-parse.h : $(srcdir)/cp-parse.y
2e494f70 653 @echo expect 30 shift/reduce conflicts and 14 reduce/reduce conflicts
79d8453e
RS
654 cd $(srcdir); $(BISON) $(BISONFLAGS) -d -o cp-parse.c cp-parse.y
655
656cp-spew.o : cp-spew.c $(CONFIG_H) $(CPLUS_TREE_H) \
657 $(srcdir)/cp-parse.h flags.h
658cp-lex.o : cp-lex.c $(CONFIG_H) $(CPLUS_TREE_H) \
659 $(srcdir)/cp-parse.h $(srcdir)/cp-input.c flags.h
660cp-decl.o : cp-decl.c $(CONFIG_H) $(CPLUS_TREE_H) flags.h \
661 cp-lex.h cp-decl.h stack.h
662cp-decl2.o : cp-decl2.c $(CONFIG_H) $(CPLUS_TREE_H) flags.h \
663 cp-lex.h cp-decl.h
664cp-type2.o : cp-type2.c $(CONFIG_H) $(CPLUS_TREE_H) flags.h
665cp-typeck.o : cp-typeck.c $(CONFIG_H) $(CPLUS_TREE_H) flags.h
666cp-class.o : cp-class.c $(CONFIG_H) $(CPLUS_TREE_H) stack.h \
667 cp-class.h flags.h
668cp-call.o : cp-call.c $(CONFIG_H) $(CPLUS_TREE_H) stack.h cp-class.h \
669 flags.h
670cp-init.o : cp-init.c $(CONFIG_H) $(CPLUS_TREE_H) flags.h
671cp-method.o : cp-method.c $(CONFIG_H) $(CPLUS_TREE_H)
672cp-cvt.o : cp-cvt.c $(CONFIG_H) $(CPLUS_TREE_H)
673cp-search.o : cp-search.c $(CONFIG_H) $(CPLUS_TREE_H) stack.h flags.h
674cp-tree.o : cp-tree.c $(CONFIG_H) $(CPLUS_TREE_H) flags.h
675cp-ptree.o : cp-ptree.c $(CONFIG_H) $(CPLUS_TREE_H)
676cp-gc.o : cp-gc.c $(CONFIG_H) $(CPLUS_TREE_H) flags.h
677cp-except.o : cp-except.c $(CONFIG_H) $(CPLUS_TREE_H) flags.h
678cp-expr.o : cp-expr.c $(CONFIG_H) $(CPLUS_TREE_H) $(RTL_H) flags.h \
679 expr.h insn-codes.h
680cp-edsel.o : cp-edsel.c $(CONFIG_H) $(CPLUS_TREE_H) stack.h flags.h
681cp-xref.o : cp-xref.c $(CONFIG_H) $(CPLUS_TREE_H)
682cp-pt.o : cp-pt.c $(CONFIG_H) $(CPLUS_TREE_H) cp-decl.h cp-parse.h
683
47547081
RS
684# To make a configuration always use collect2, set USE_COLLECT2 to ld.
685ld: collect2
686 rm -f ld
687 ln collect2 ld
688
79d8453e
RS
689collect2 : collect2.o version.o $(LIBDEPS)
690 $(CC) $(ALL_CFLAGS) $(LDFLAGS) -o collect2 collect2.o version.o $(LIBS)
691
692collect2.o : collect2.c $(CONFIG_H) gstab.h
47547081
RS
693 $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \
694 -DSTANDARD_STARTFILE_PREFIX=\"$(libdir)/\" \
695 -DSTANDARD_BIN_PREFIX=\"$(bindir)/\" \
696 -DSTANDARD_EXEC_PREFIX=\"$(libdir)/gcc-lib/\" \
697 -DDEFAULT_TARGET_MACHINE=\"$(target)\" \
698 -c `echo $(srcdir)/collect2.c | sed 's,^\./,,'`
79d8453e
RS
699
700# Objectionable C language specific files.
701
702objc-parse.o : $(srcdir)/objc-parse.c $(CONFIG_H) $(TREE_H) c-lex.h \
703 c-tree.h input.h flags.h objc-actions.h
704 $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) -c $(srcdir)/objc-parse.c
705$(srcdir)/objc-parse.c : $(srcdir)/objc-parse.y
706 cd $(srcdir); $(BISON) $(BISONFLAGS) objc-parse.y -o objc-parse.c
707
708objc-actions.o : objc-actions.c $(CONFIG_H) $(TREE_H) c-tree.h c-lex.h \
709 flags.h objc-actions.h
710
711# A file used by all variants of C.
712
713c-common.o : c-common.c $(CONFIG_H) $(TREE_H) c-tree.h c-lex.h flags.h
714
715# Language-independent files.
716
717gcc.o: gcc.c $(CONFIG_H) gvarargs.h obstack.h
718 $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \
719 -DSTANDARD_STARTFILE_PREFIX=\"$(libdir)/\" \
2e494f70 720 -DSTANDARD_EXEC_PREFIX=\"$(libdir)/gcc-lib/\" \
79d8453e
RS
721 -DDEFAULT_TARGET_MACHINE=\"$(target)\" \
722 -c `echo $(srcdir)/gcc.c | sed 's,^\./,,'`
723
724dumpvers: dumpvers.c
725
726version.o: version.c
727obstack.o: obstack.c
728
729tree.o : tree.c $(CONFIG_H) $(TREE_H) gvarargs.h flags.h function.h
730print-tree.o : print-tree.c $(CONFIG_H) $(TREE_H)
731stor-layout.o : stor-layout.c $(CONFIG_H) $(TREE_H) function.h
732fold-const.o : fold-const.c $(CONFIG_H) $(TREE_H) flags.h
2e494f70 733toplev.o : toplev.c $(CONFIG_H) $(TREE_H) $(RTL_H) flags.h input.h \
47547081
RS
734 insn-attr.h xcoffout.h
735 $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \
736 $(MAYBE_USE_COLLECT2) -c `echo $(srcdir)/toplev.c | sed 's,^\./,,'`
79d8453e
RS
737
738rtl.o : rtl.c $(CONFIG_H) $(RTL_H)
739
740print-rtl.o : print-rtl.c $(CONFIG_H) $(RTL_H)
741rtlanal.o : rtlanal.c $(CONFIG_H) $(RTL_H)
742
743varasm.o : varasm.c $(CONFIG_H) $(TREE_H) $(RTL_H) flags.h \
47547081 744 insn-codes.h expr.h hard-reg-set.h regs.h xcoffout.h
79d8453e
RS
745function.o : function.c $(CONFIG_H) $(RTL_H) $(TREE_H) flags.h function.h \
746 insn-flags.h insn-codes.h expr.h regs.h hard-reg-set.h insn-config.h \
747 recog.h output.h
748stmt.o : stmt.c $(CONFIG_H) $(RTL_H) $(TREE_H) flags.h function.h \
749 insn-flags.h insn-config.h insn-codes.h hard-reg-set.h expr.h loop.h recog.h
750expr.o : expr.c $(CONFIG_H) $(RTL_H) $(TREE_H) gvarargs.h flags.h function.h \
751 insn-flags.h insn-codes.h expr.h insn-config.h recog.h output.h typeclass.h
752calls.o : calls.c $(CONFIG_H) $(RTL_H) $(TREE_H) flags.h expr.h insn-codes.h \
753 insn-flags.h
754expmed.o : expmed.c $(CONFIG_H) $(RTL_H) $(TREE_H) flags.h \
755 insn-flags.h insn-config.h insn-codes.h expr.h recog.h real.h
756explow.o : explow.c $(CONFIG_H) $(RTL_H) $(TREE_H) flags.h hard-reg-set.h \
757 insn-config.h expr.h recog.h insn-flags.h insn-codes.h
758optabs.o : optabs.c $(CONFIG_H) $(RTL_H) $(TREE_H) flags.h \
759 insn-flags.h insn-config.h insn-codes.h expr.h recog.h
760dbxout.o : dbxout.c $(CONFIG_H) $(TREE_H) $(RTL_H) flags.h regs.h \
47547081 761 insn-config.h reload.h gstab.h xcoffout.h
79d8453e
RS
762sdbout.o : sdbout.c $(CONFIG_H) $(TREE_H) $(RTL_H) gsyms.h flags.h \
763 insn-config.h reload.h
764dwarfout.o : dwarfout.c $(CONFIG_H) $(TREE_H) $(RTL_H) dwarf.h flags.h \
765 insn-config.h reload.h output.h
47547081 766xcoffout.o : xcoffout.c $(CONFIG_H) $(TREE_H) $(RTL_H) xcoffout.h flags.h
79d8453e
RS
767emit-rtl.o : emit-rtl.c $(CONFIG_H) $(RTL_H) flags.h gvarargs.h function.h \
768 regs.h insn-config.h insn-codes.h real.h expr.h
2e494f70 769getpwd.o : getpwd.c $(CONFIG_H)
79d8453e
RS
770
771integrate.o : integrate.c $(CONFIG_H) $(RTL_H) $(TREE_H) flags.h integrate.h \
772 insn-flags.h insn-config.h insn-codes.h expr.h real.h function.h
773
774jump.o : jump.c $(CONFIG_H) $(RTL_H) flags.h hard-reg-set.h regs.h \
775 insn-config.h insn-flags.h insn-codes.h expr.h real.h
776stupid.o : stupid.c $(CONFIG_H) $(RTL_H) regs.h hard-reg-set.h flags.h
777
778cse.o : cse.c $(CONFIG_H) $(RTL_H) regs.h hard-reg-set.h flags.h real.h \
779 insn-config.h recog.h
780loop.o : loop.c $(CONFIG_H) $(RTL_H) flags.h loop.h insn-config.h \
781 insn-flags.h insn-codes.h regs.h hard-reg-set.h recog.h expr.h real.h
782unroll.o : unroll.c $(CONFIG_H) $(RTL_H) insn-config.h insn-codes.h \
783 integrate.h regs.h flags.h expr.h loop.h
784flow.o : flow.c $(CONFIG_H) $(RTL_H) flags.h insn-config.h \
785 basic-block.h regs.h hard-reg-set.h output.h
786combine.o : combine.c $(CONFIG_H) $(RTL_H) gvarargs.h flags.h \
787 insn-config.h insn-flags.h insn-codes.h insn-attr.h regs.h expr.h \
788 basic-block.h recog.h real.h
789regclass.o : regclass.c $(CONFIG_H) $(RTL_H) hard-reg-set.h flags.h \
790 basic-block.h regs.h insn-config.h recog.h
791local-alloc.o : local-alloc.c $(CONFIG_H) $(RTL_H) flags.h basic-block.h \
792 regs.h hard-reg-set.h insn-config.h recog.h output.h
793global-alloc.o : global-alloc.c $(CONFIG_H) $(RTL_H) flags.h \
794 basic-block.h regs.h hard-reg-set.h insn-config.h output.h
795
796reload.o : reload.c $(CONFIG_H) $(RTL_H) flags.h \
797 reload.h recog.h hard-reg-set.h insn-config.h insn-codes.h regs.h real.h
798reload1.o : reload1.c $(CONFIG_H) $(RTL_H) flags.h expr.h \
799 reload.h regs.h hard-reg-set.h insn-config.h insn-flags.h insn-codes.h \
800 basic-block.h recog.h output.h
801caller-save.o : caller-save.c $(CONFIG_H) $(RTL_H) flags.h \
802 regs.h hard-reg-set.h insn-config.h basic-block.h recog.h reload.h expr.h
803reorg.o : reorg.c $(CONFIG_H) $(RTL_H) conditions.h hard-reg-set.h \
804 basic-block.h regs.h insn-config.h insn-attr.h insn-flags.h recog.h \
805 flags.h output.h
806sched.o : sched.c $(CONFIG_H) $(RTL_H) basic-block.h regs.h hard-reg-set.h \
807 flags.h insn-config.h insn-attr.h
808final.o : final.c $(CONFIG_H) $(RTL_H) gvarargs.h flags.h regs.h \
809 recog.h conditions.h insn-config.h insn-attr.h real.h output.h \
47547081 810 hard-reg-set.h insn-codes.h gstab.h xcoffout.h
79d8453e
RS
811recog.o : recog.c $(CONFIG_H) $(RTL_H) \
812 regs.h recog.h hard-reg-set.h flags.h insn-config.h insn-attr.h \
813 insn-flags.h insn-codes.h real.h
814reg-stack.o : reg-stack.c $(CONFIG_H) $(RTL_H) $(TREE_H) \
815 regs.h hard-reg-set.h flags.h insn-config.h
dcfedcd0 816
79d8453e
RS
817aux-output.o : aux-output.c $(CONFIG_H) \
818 $(RTL_H) regs.h hard-reg-set.h real.h insn-config.h conditions.h \
819 insn-flags.h output.h insn-attr.h insn-codes.h
820
821# Normally this target is not used; but it is used if you
822# define ALLOCA=alloca.o. In that case, you must get a suitable alloca.c
823# from the GNU Emacs distribution.
824# Note some machines won't allow $(CC) without -S on this source file.
825alloca.o: alloca.c
826# sed is used to strip the comments from the assembler output.
827 $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $(ALLOCA_FLAGS) \
828 `echo $(srcdir)/alloca.c | sed 's,^\./,,'`
829 $(ALLOCA_FINISH)
47547081 830 -rm alloca.s
79d8453e
RS
831\f
832# Generate header and source files from the machine description,
833# and compile them.
834
835.PRECIOUS: insn-config.h insn-flags.h insn-codes.h \
836 insn-emit.c insn-recog.c insn-extract.c insn-output.c insn-peep.c \
837 insn-attr.h insn-attrtab.c
838
839# The following pair of rules has this effect:
840# genconfig is run only if the md has changed since genconfig was last run;
841# but the file insn-config.h is touched only when its contents actually change.
842
843# Each of the other insn-* files is handled by a similar pair of rules.
844
845# Each of the insn-*.[ch] rules has a semicolon at the end,
846# for otherwise the system Make on SunOS 4.1 never tries
847# to recompile insn-*.o.
848
849insn-config.h: stamp-config ;
850stamp-config : md genconfig $(srcdir)/move-if-change
851 ./genconfig md > tmp-config.h
852 $(srcdir)/move-if-change tmp-config.h insn-config.h
853 touch stamp-config
854
855insn-flags.h: stamp-flags ;
856stamp-flags : md genflags $(srcdir)/move-if-change
857 ./genflags md > tmp-flags.h
858 $(srcdir)/move-if-change tmp-flags.h insn-flags.h
859 touch stamp-flags
860
861insn-codes.h: stamp-codes ;
862stamp-codes : md gencodes $(srcdir)/move-if-change
863 ./gencodes md > tmp-codes.h
864 $(srcdir)/move-if-change tmp-codes.h insn-codes.h
865 touch stamp-codes
866
867insn-emit.o : insn-emit.c $(CONFIG_H) $(RTL_H) expr.h real.h output.h \
868 insn-config.h insn-flags.h insn-codes.h
869 $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) -c insn-emit.c
870
871insn-emit.c: stamp-emit ;
872stamp-emit : md genemit $(srcdir)/move-if-change
873 ./genemit md > tmp-emit.c
874 $(srcdir)/move-if-change tmp-emit.c insn-emit.c
875 touch stamp-emit
876
877insn-recog.o : insn-recog.c $(CONFIG_H) $(RTL_H) insn-config.h recog.h \
878 real.h output.h flags.h
879 $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) -c insn-recog.c
880
881insn-recog.c: stamp-recog ;
882stamp-recog : md genrecog $(srcdir)/move-if-change
883 ./genrecog md > tmp-recog.c
884 $(srcdir)/move-if-change tmp-recog.c insn-recog.c
885 touch stamp-recog
886
887insn-extract.o : insn-extract.c $(CONFIG_H) $(RTL_H)
888 $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) -c insn-extract.c
889
890insn-extract.c: stamp-extract ;
891stamp-extract : md genextract $(srcdir)/move-if-change
892 ./genextract md > tmp-extract.c
893 $(srcdir)/move-if-change tmp-extract.c insn-extract.c
894 touch stamp-extract
895
896insn-peep.o : insn-peep.c $(CONFIG_H) $(RTL_H) regs.h output.h real.h
897 $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) -c insn-peep.c
898
899insn-peep.c: stamp-peep ;
900stamp-peep : md genpeep $(srcdir)/move-if-change
901 ./genpeep md > tmp-peep.c
902 $(srcdir)/move-if-change tmp-peep.c insn-peep.c
903 touch stamp-peep
904
905insn-attrtab.o : insn-attrtab.c $(CONFIG_H) $(RTL_H) regs.h real.h output.h \
906 insn-attr.h insn-config.h
907 $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) -c insn-attrtab.c
908
909insn-attr.h: stamp-attr ;
910stamp-attr : md genattr $(srcdir)/move-if-change
911 ./genattr md > tmp-attr.h
912 $(srcdir)/move-if-change tmp-attr.h insn-attr.h
913 touch stamp-attr
914
915insn-attrtab.c: stamp-attrtab ;
916stamp-attrtab : md genattrtab $(srcdir)/move-if-change
917 ./genattrtab md > tmp-attrtab.c
918 $(srcdir)/move-if-change tmp-attrtab.c insn-attrtab.c
919 touch stamp-attrtab
920
921insn-output.o : insn-output.c $(CONFIG_H) $(RTL_H) regs.h real.h conditions.h \
922 hard-reg-set.h insn-config.h insn-flags.h insn-attr.h output.h recog.h \
923 insn-codes.h
924 $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) -c insn-output.c
925
926insn-output.c: stamp-output ;
927stamp-output : md genoutput $(srcdir)/move-if-change
928 ./genoutput md > tmp-output.c
929 $(srcdir)/move-if-change tmp-output.c insn-output.c
930 touch stamp-output
931\f
932# Compile the programs that generate insn-* from the machine description.
933# They are compiled with $(HOST_CC), and associated libraries,
934# since they need to run on this machine
935# even if GCC is being compiled to run on some other machine.
936
937# $(CONFIG_H) is omitted from the deps of the gen*.o
938# because these programs don't really depend on anything
939# about the target machine. They do depend on config.h itself,
940# since that describes the host machine.
941
942genconfig : genconfig.o $(HOST_RTL) $(HOST_LIBDEPS)
943 $(HOST_CC) $(HOST_CFLAGS) $(HOST_LDFLAGS) -o genconfig \
944 genconfig.o $(HOST_RTL) $(HOST_LIBS)
945
946genconfig.o : genconfig.c $(RTL_H) config.h
947 $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(srcdir)/genconfig.c
948
949genflags : genflags.o $(HOST_RTL) $(HOST_LIBDEPS)
950 $(HOST_CC) $(HOST_CFLAGS) $(HOST_LDFLAGS) -o genflags \
951 genflags.o $(HOST_RTL) $(HOST_LIBS)
952
953genflags.o : genflags.c $(RTL_H) config.h
954 $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(srcdir)/genflags.c
955
956gencodes : gencodes.o $(HOST_RTL) $(HOST_LIBDEPS)
957 $(HOST_CC) $(HOST_CFLAGS) $(HOST_LDFLAGS) -o gencodes \
958 gencodes.o $(HOST_RTL) $(HOST_LIBS)
959
960gencodes.o : gencodes.c $(RTL_H) config.h
961 $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(srcdir)/gencodes.c
962
963genemit : genemit.o $(HOST_RTL) $(HOST_LIBDEPS)
964 $(HOST_CC) $(HOST_CFLAGS) $(HOST_LDFLAGS) -o genemit \
965 genemit.o $(HOST_RTL) $(HOST_LIBS)
966
967genemit.o : genemit.c $(RTL_H) config.h
968 $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(srcdir)/genemit.c
969
970genrecog : genrecog.o $(HOST_RTL) $(HOST_LIBDEPS)
971 $(HOST_CC) $(HOST_CFLAGS) $(HOST_LDFLAGS) -o genrecog \
972 genrecog.o $(HOST_RTL) $(HOST_LIBS)
973
974genrecog.o : genrecog.c $(RTL_H) config.h
975 $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(srcdir)/genrecog.c
976
977genextract : genextract.o $(HOST_RTL) $(HOST_LIBDEPS)
978 $(HOST_CC) $(HOST_CFLAGS) $(HOST_LDFLAGS) -o genextract \
979 genextract.o $(HOST_RTL) $(HOST_LIBS)
980
981genextract.o : genextract.c $(RTL_H) config.h
982 $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(srcdir)/genextract.c
983
984genpeep : genpeep.o $(HOST_RTL) $(HOST_LIBDEPS)
985 $(HOST_CC) $(HOST_CFLAGS) $(HOST_LDFLAGS) -o genpeep \
986 genpeep.o $(HOST_RTL) $(HOST_LIBS)
987
988genpeep.o : genpeep.c $(RTL_H) config.h
989 $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(srcdir)/genpeep.c
990
991genattr : genattr.o $(HOST_RTL) $(HOST_LIBDEPS)
992 $(HOST_CC) $(HOST_CFLAGS) $(HOST_LDFLAGS) -o genattr \
993 genattr.o $(HOST_RTL) $(HOST_LIBS)
994
995genattr.o : genattr.c $(RTL_H) config.h
996 $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(srcdir)/genattr.c
997
998genattrtab : genattrtab.o $(HOST_RTL) $(HOST_RTLANAL) $(HOST_LIBDEPS)
999 $(HOST_CC) $(HOST_CFLAGS) $(HOST_LDFLAGS) -o genattrtab \
1000 genattrtab.o $(HOST_RTL) $(HOST_RTLANAL) $(HOST_LIBS)
1001
1002genattrtab.o : genattrtab.c $(RTL_H) config.h insn-config.h
1003 $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(srcdir)/genattrtab.c
1004
1005genoutput : genoutput.o $(HOST_RTL) $(HOST_LIBDEPS)
1006 $(HOST_CC) $(HOST_CFLAGS) $(HOST_LDFLAGS) -o genoutput \
1007 genoutput.o $(HOST_RTL) $(HOST_LIBS)
1008
1009genoutput.o : genoutput.c $(RTL_H) config.h
1010 $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(srcdir)/genoutput.c
1011\f
1012# Compile the libraries to be used by gen*.
1013# If we are not cross-building, gen* use the same .o's that cc1 will use,
1014# and HOST_PREFIX_1 is `foobar', just to ensure these rules don't conflict
1015# with the rules for rtl.o, alloca.o, etc.
1016$(HOST_PREFIX_1)rtl.o: $(srcdir)/rtl.c $(CONFIG_H) $(RTL_H)
1017 rm -f $(HOST_PREFIX)rtl.c
1018 cp $(srcdir)/rtl.c $(HOST_PREFIX)rtl.c
1019 $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(HOST_PREFIX)rtl.c
1020
1021$(HOST_PREFIX_1)rtlanal.o: $(srcdir)/rtlanal.c $(CONFIG_H) $(RTL_H)
1022 rm -f $(HOST_PREFIX)rtlanal.c
1023 cp $(srcdir)/rtlanal.c $(HOST_PREFIX)rtlanal.c
1024 $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(HOST_PREFIX)rtlanal.c
1025
1026$(HOST_PREFIX_1)alloca.o: alloca.c
1027 rm -f $(HOST_PREFIX)alloca.c
1028 cp $(srcdir)/alloca.c $(HOST_PREFIX)alloca.c
1029 $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(HOST_PREFIX)alloca.c
1030
1031$(HOST_PREFIX_1)obstack.o: obstack.c
1032 rm -f $(HOST_PREFIX)obstack.c
1033 cp $(srcdir)/obstack.c $(HOST_PREFIX)obstack.c
1034 $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(HOST_PREFIX)obstack.c
1035
1036$(HOST_PREFIX_1)malloc.o: malloc.c
1037 rm -f $(HOST_PREFIX)malloc.c
1038 cp $(srcdir)/malloc.c $(HOST_PREFIX)malloc.c
1039 $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(HOST_PREFIX)malloc.c
1040
1041# This satisfies the dependency that we get if you cross-compile a compiler
1042# that does not need to compile alloca, malloc or whatever.
1043$(HOST_PREFIX_1):
1044 touch $(HOST_PREFIX_1)
1045\f
1046# Remake cpp and protoize.
1047
1048# Making the preprocessor
1049cpp: cccp
1050 -rm -f cpp
1051 ln cccp cpp
1052cccp: cccp.o cexp.o version.o $(LIBDEPS)
1053 $(CC) $(ALL_CFLAGS) $(LDFLAGS) -o cccp cccp.o cexp.o version.o $(LIBS)
1054cexp.o: $(srcdir)/cexp.c $(CONFIG_H)
1055 $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) -c $(srcdir)/cexp.c
1056$(srcdir)/cexp.c: $(srcdir)/cexp.y
1057 cd $(srcdir); $(BISON) -o cexp.c cexp.y
1058cccp.o: cccp.c $(CONFIG_H) pcp.h version.c
1059# The reason we use $(libdir)/g++-include rather than using libsubdir
1060# is for compatibility with the current version of libg++.
1061 $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \
2e494f70
RS
1062 -DGCC_INCLUDE_DIR=\"$(libsubdir)/include\" \
1063 -DGPLUSPLUS_INCLUDE_DIR=\"$(libdir)/g++-include\" \
79d8453e 1064 -DLOCAL_INCLUDE_DIR=\"$(prefix)/include\" \
2e494f70 1065 -DCROSS_INCLUDE_DIR=\"$(libsubdir)/sys-include\" \
79d8453e
RS
1066 -c `echo $(srcdir)/cccp.c | sed 's,^\./,,'`
1067
1068proto: config.status protoize unprotoize SYSCALLS.c.X protoize.1 unprotoize.1
1069
2e494f70 1070protoize: protoize.o getopt.o getopt1.o getpwd.o version.o $(LIBDEPS)
79d8453e 1071 $(CC) $(ALL_CFLAGS) $(LDFLAGS) \
2e494f70 1072 protoize.o getopt.o getopt1.o getpwd.o version.o $(LIBS) -o $@
79d8453e
RS
1073protoize.o: $(srcdir)/protoize.c getopt.h $(CONFIG_H)
1074 $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \
1075 -DGCC_INCLUDE_DIR=\"$(libsubdir)/include\" \
2e494f70 1076 -DGPLUSPLUS_INCLUDE_DIR=\"$(libdir)/g++-include\" \
79d8453e
RS
1077 -DCROSS_INCLUDE_DIR=\"$(libsubdir)/sys-include\" \
1078 -DLOCAL_INCLUDE_DIR=\"$(prefix)/include\" \
1079 -DSTD_PROTO_DIR=\"$(libsubdir)\" \
1080 $(srcdir)/protoize.c
1081
2e494f70 1082unprotoize: unprotoize.o getopt.o getopt1.o getpwd.o version.o $(LIBDEPS)
79d8453e 1083 $(CC) $(ALL_CFLAGS) $(LDFLAGS) \
2e494f70 1084 unprotoize.o getopt.o getopt1.o getpwd.o version.o $(LIBS) -o $@
79d8453e
RS
1085unprotoize.o: $(srcdir)/protoize.c getopt.h $(CONFIG_H)
1086 cp $(srcdir)/protoize.c unprotoize.c
1087 $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \
1088 -DGCC_INCLUDE_DIR=\"$(libsubdir)/include\" \
2e494f70 1089 -DGPLUSPLUS_INCLUDE_DIR=\"$(libdir)/g++-include\" \
79d8453e
RS
1090 -DCROSS_INCLUDE_DIR=\"$(libsubdir)/sys-include\" \
1091 -DLOCAL_INCLUDE_DIR=\"$(prefix)/include\" \
1092 -DSTD_PROTO_DIR=\"$(libsubdir)\" \
1093 -DUNPROTOIZE unprotoize.c
1094 rm -f unprotoize.c
1095
1096getopt.o: $(srcdir)/getopt.c getopt.h
1097 $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $(srcdir)/getopt.c
1098getopt1.o: $(srcdir)/getopt1.c getopt.h
1099 $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $(srcdir)/getopt1.c
1100
1101protoize.1: $(srcdir)/proto-man ./cpp
1102 ./cpp -traditional $(srcdir)/proto-man \
1103 | grep -v '^#' \
2e494f70
RS
1104 | awk 'NF > 0 {print}' > tmp-proto.1
1105 mv tmp-proto.1 protoize.1
79d8453e
RS
1106
1107unprotoize.1: $(srcdir)/proto-man ./cpp
1108 ./cpp -traditional -DUNPRO $(srcdir)/proto-man \
1109 | grep -v '^#' \
2e494f70
RS
1110 | awk 'NF > 0 {print}' > tmp-unproto.1
1111 mv tmp-unproto.1 unprotoize.1
1112
79d8453e 1113# This info describes the target machine, so compile with GCC just built.
47547081
RS
1114SYSCALLS.c.X: $(srcdir)/sys-types.h $(srcdir)/sys-protos.h $(GCC_PASSES)
1115 -rm -f SYSCALLS.c
1116 cat $(srcdir)/sys-types.h $(srcdir)/sys-protos.h > SYSCALLS.c
79d8453e 1117 $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \
47547081
RS
1118 -aux-info $@ -S -o /dev/null SYSCALLS.c
1119 -rm -f SYSCALLS.c
79d8453e
RS
1120\f
1121# Remake the info files.
1122
47547081 1123doc: $(srcdir)/cpp.info $(srcdir)/gcc.info
79d8453e
RS
1124
1125$(srcdir)/cpp.info: $(srcdir)/cpp.texi
1126 makeinfo `echo $(srcdir)/cpp.texi | sed 's,^\./,,'`
1127
47547081
RS
1128#$(srcdir)/gplus.info: $(srcdir)/gplus.texi
1129# makeinfo `echo $(srcdir)/gplus.texi | sed 's,^\./,,'`
79d8453e
RS
1130
1131$(srcdir)/gcc.info: $(srcdir)/gcc.texi
1132 makeinfo `echo $(srcdir)/gcc.texi | sed 's,^\./,,'`
1133\f
1134# Deletion of files made during compilation.
1135# There are four levels of this:
47547081 1136# `mostlyclean', `clean', `distclean' and `realclean'.
79d8453e 1137# `mostlyclean' is useful while working on a particular type of machine.
2e494f70 1138# It deletes most, but not all, of the files made by compilation.
79d8453e 1139# It does not delete libgcc.a or its parts, so it won't have to be recompiled.
2e494f70 1140# `clean' deletes everything made by running `make all'.
47547081 1141# `distclean' also deletes the files made by config.
79d8453e
RS
1142# `realclean' also deletes everything that could be regenerated automatically.
1143
47547081 1144
79d8453e
RS
1145mostlyclean:
1146 -rm -f $(STAGESTUFF)
1147# Delete the temporary source copies for cross compilation.
1148 -rm -f $(HOST_PREFIX_1)rtl.c $(HOST_PREFIX_1)rtlanal.c
1149 -rm -f $(HOST_PREFIX_1)alloca.c $(HOST_PREFIX_1)malloc.c
1150 -rm -f $(HOST_PREFIX_1)obstack.c
1151# Delete the temp files made in the course of building libgcc.a.
2e494f70 1152 -rm -f tmplibgcc* tmpcopy
79d8453e
RS
1153 for name in $(LIB1FUNCS); do rm -f $${name}.c; done
1154# Delete other temporary files.
2e494f70 1155 -rm -f tmp-float.h tmp-*proto.1 tmp-gcc.xtar.Z tmp-limits.h gccnew
dcfedcd0 1156 -rm -f tmp-foo1 tmp-foo2
79d8453e
RS
1157# Delete the stamp files.
1158 -rm -f stamp-* tmp-*
2e494f70 1159# Delete debugging dump files.
79d8453e 1160 -rm -f *.greg *.lreg *.combine *.flow *.cse *.jump *.rtl *.tree *.loop
2e494f70
RS
1161 -rm -f *.dbr *.jump2 *.sched *.cse2 *.sched2 *.stack
1162# Delete some files made during installation.
1163 -rm -f specs float.h enquire SYSCALLS.c SYSCALLS.c.X
47547081 1164 -rm -f collect collect2 ld mips-tfile mips-tdump alloca.s
2e494f70
RS
1165# Delete unwanted output files from TeX.
1166 -rm -f *.toc *.log *.vr *.fn *.cp *.tp *.ky *.pg
47547081
RS
1167# Delete sorted indices we don't actually use.
1168 -rm -f gcc.vrs gcc.kys gcc.tps gcc.pgs gcc.fns
2e494f70
RS
1169# Delete core dumps.
1170 -rm -f core
79d8453e 1171
47547081
RS
1172# Delete all files made by compilation
1173# that don't exist in the distribution.
79d8453e
RS
1174clean: mostlyclean
1175 -rm -f libgcc.a libgcc1.a libgcc2.a libgcc2.ready
79d8453e 1176
47547081
RS
1177# Delete all files that users would normally create
1178# while building and installing GCC.
2e494f70 1179distclean: clean
79d8453e 1180 -rm -f tm.h aux-output.c config.h md config.status tconfig.h
2e494f70 1181 -rm -f Makefile *.dvi *.oaux
47547081 1182 -rm -fr stage1 stage2 stage3 stage4
2e494f70
RS
1183
1184# Delete anything likely to be found in the source directory
1185# that shouldn't be in the distribution.
1186extraclean: distclean
47547081
RS
1187 -rm -rf =* #* *~* config/=* config/#* config/*~*
1188 -rm -f *.dvi *.oaux patch* config/patch* *.orig *.rej *.d *.Z *.tar
2e494f70 1189 -rm -f *.s *.s[0-9] *.i
79d8453e
RS
1190
1191# Get rid of every file that's generated from some other file.
1192# Most of these files ARE PRESENT in the GCC distribution.
2e494f70 1193realclean: distclean
79d8453e
RS
1194 -rm -f cp-parse.c cp-parse.h cp-parse.output
1195 -rm -f objc-parse.c objc-parse.output
1196 -rm -f protoize.1 unprotoize.1
1197 -rm -f c-parse.c c-parse.h c-parse.output
1198 -rm -f cexp.c cexp.output TAGS
2e494f70
RS
1199 -rm -f cpp.info* cpp.??s cpp.*aux
1200 -rm -f gcc.info* gcc.??s gcc.*aux
1201 -rm -f gplus.info* gplus.??s gplus.*aux
79d8453e
RS
1202\f
1203# Entry points `install' and `uninstall'.
1204# Also temporarily `install-fixincludes' could replace `install-headers'.
2e494f70 1205# Also use `install-collect2' to install collect2 when the config files don't.
79d8453e
RS
1206
1207install: $(INSTALL_TARGET)
1208
1209# Copy the files of native compiler into directories where they will be run.
1210install-native: install-common install-libgcc $(INSTALL_HEADERS) \
2e494f70 1211 install-man
79d8453e
RS
1212
1213# Copy the files of cross compiler into directories where they will be run.
1214install-cross: install-common install-common-headers \
1215 install-man install-cross-tools install-libgcc
1216
1217# Install the tools, libraries and header files for the target machine
1218# where cross-compilation will look for them.
1219# Use tooldir to find them.
1220install-cross-tools: install-dir
1221# The first if makes this a no-op except for a cross compiler.
1222# The /. after the dirname causes test to follow symlinks.
1223# Before making a link or an indirection script,
1224# we verify the desired file does not already exist.
1225# If a symlink does exist, then making a symlink would certainly fail,
1226# leading us to overwrite the real file through the symlink.
1227 -if [ -f gcc-cross ] ; \
1228 then \
1229 if [ -d $(tooldir)/. ] ; \
1230 then \
1231 for file in as ld ar ranlib; do \
1232 if [ -f $(libsubdir)/$$file ] ; \
1233 then true; \
1234 else \
1235 $(SYMLINK) $(tooldir)/bin/$$file $(libsubdir)/$$file \
1236 || (echo "#!/bin/sh"; echo $(tooldir)/bin/$$file "$$@") > $(libsubdir)/$$file; \
1237 fi; \
1238 done; \
1239 for file in $(tooldir)/lib/*; do \
1240 if [ -f $$file ] ; \
1241 then \
1242 if [ -f $(libsubdir)/`basename $$file` ] ; \
1243 then true; \
1244 else \
1245 $(SYMLINK) $$file $(libsubdir)/`basename $$file` \
1246 || $(INSTALL_DATA) $$file $(libsubdir)/`basename $$file`; \
1247 fi; \
1248 else true; \
1249 fi; \
1250 done; \
1251 if [ -d $(tooldir)/include/. ] ; then \
1252 $(SYMLINK) $(tooldir)/include $(libsubdir)/sys-include \
1253 || (if [ -d $(libsubdir)/sys-include ] ; then true ; else mkdir $(libsubdir)/sys-include ; fi; \
1254 cd $(tooldir)/include; tar cf - . | (cd $(libsubdir)/sys-include; tar xpf -)); \
1255 else true; fi; \
1256 else true; \
1257 fi; \
1258 else true; \
1259 fi;
1260
1261# Run this on the target machine
1262# to finish installation of cross compiler.
1263install-cross-rest: install-float-h-cross
1264
1265# Install float.h for cross compiler.
1266# Run this on the target machine!
1267install-float-h-cross:
1268 if [ -f enquire ] ; then true; else false; done
1269 -./enquire -f > float.h
1270 -rm -f $(libsubdir)/include/float.h
1271 $(INSTALL_DATA) float.h $(libsubdir)/include/float.h
1272 chmod a-x $(libsubdir)/include/float.h
1273
1274# Create the installation directory.
1275install-dir:
935e11b0
TW
1276 -if [ -d $(libdir) ] ; then true ; else mkdir $(libdir) ; fi
1277 -if [ -d $(libdir)/gcc-lib ] ; then true ; else mkdir $(libdir)/gcc-lib ; fi
1278 -if [ -d $(libdir)/gcc-lib/include ] ; then true ; else mkdir $(libdir)/gcc-lib/include ; fi
1279 -if [ -d $(libdir)/gcc-lib/$(target) ] ; then true ; else mkdir $(libdir)/gcc-lib/$(target) ; fi
1280 -if [ -d $(libdir)/gcc-lib/$(target)/$(version) ] ; then true ; else mkdir $(libdir)/gcc-lib/$(target)/$(version) ; fi
1281 -if [ -d $(bindir) ] ; then true ; else mkdir $(bindir) ; fi
79d8453e
RS
1282# We don't use mkdir -p to create the parents of mandir,
1283# because some systems don't support it.
1284# Instead, we use this technique to create the immediate parent of mandir.
935e11b0 1285 -parent=`echo $(mandir)|sed -e 's@/[^/]*$$@@'`; \
79d8453e
RS
1286 if [ -d $$parent ] ; then true ; else mkdir $$parent ; fi
1287 -if [ -d $(mandir) ] ; then true ; else mkdir $(mandir) ; fi
1288
1289# Install the compiler executables built during cross compilation.
1290install-common: native install-dir
1291 for file in $(COMPILERS); do \
1292 if [ -f $$file ] ; then \
1293 rm -f $(libsubdir)/$$file; \
1294 $(INSTALL_PROGRAM) $$file $(libsubdir)/$$file; \
1295 else true; \
1296 fi; \
1297 done
47547081 1298 for file in $(EXTRA_PASSES) $(EXTRA_PARTS) $(EXTRA_PROGRAMS) $(USE_COLLECT2) ..; do \
79d8453e
RS
1299 if [ x"$$file" != x.. ]; then \
1300 rm -f $(libsubdir)/$$file; \
1301 $(INSTALL_PROGRAM) $$file $(libsubdir)/$$file; \
1302 else true; fi; \
1303 done
1304 -rm -f $(libsubdir)/specs
1305 $(INSTALL_DATA) specs $(libsubdir)/specs
1306# Install the driver program as gcc-$(target)
1307# and also as either gcc (if native) or $(tooldir)/bin/gcc.
1308 -if [ -f gcc-cross ] ; then \
2e494f70 1309 $(INSTALL_PROGRAM) gcc-cross $(bindir)/gcc-$(target); \
79d8453e
RS
1310 if [ -d $(tooldir)/bin/. ] ; then \
1311 rm -f $(tooldir)/bin/gcc; \
1312 $(INSTALL_PROGRAM) gcc-cross $(tooldir)/bin/gcc; \
79d8453e
RS
1313 else true; fi; \
1314 else \
1315 rm -f $(bindir)/gcc; \
1316 $(INSTALL_PROGRAM) gcc $(bindir)/gcc; \
1317 rm -f $(bindir)/gcc-$(target)-1; \
1318 ln $(bindir)/gcc $(bindir)/gcc-$(target)-1; \
1319 mv $(bindir)/gcc-$(target)-1 $(bindir)/gcc-$(target); \
1320 fi
1321 $(INSTALL_PROGRAM) $(srcdir)/c++ $(bindir)/c++
1322 $(INSTALL_PROGRAM) $(srcdir)/g++ $(bindir)/g++
1323 -rm -f $(libsubdir)/cpp
1324 $(INSTALL_PROGRAM) cpp $(libsubdir)/cpp
1325
1326# Install protoize.
1327install-proto: proto install-dir
1328 -rm -f $(bindir)/protoize
1329 $(INSTALL_PROGRAM) protoize $(bindir)/protoize
1330 -rm -f $(bindir)/unprotoize
1331 $(INSTALL_PROGRAM) unprotoize $(bindir)/unprotoize
1332 -rm -f $(libsubdir)/SYSCALLS.c.X
1333 $(INSTALL_DATA) SYSCALLS.c.X $(libsubdir)/SYSCALLS.c.X
1334 chmod a-x $(libsubdir)/SYSCALLS.c.X
1335
1336# Install the man pages.
2e494f70
RS
1337install-man: install-dir $(srcdir)/gcc.1 $(srcdir)/cccp.1 \
1338 protoize.1 unprotoize.1 $(srcdir)/g++.1
79d8453e
RS
1339 -rm -f $(mandir)/gcc$(manext)
1340 $(INSTALL_DATA) $(srcdir)/gcc.1 $(mandir)/gcc$(manext)
1341 chmod a-x $(mandir)/gcc$(manext)
2e494f70
RS
1342 -rm -f $(mandir)/cccp$(manext)
1343 $(INSTALL_DATA) $(srcdir)/cccp.1 $(mandir)/cccp$(manext)
1344 chmod a-x $(mandir)/cccp$(manext)
79d8453e
RS
1345 -rm -f $(mandir)/protoize$(manext)
1346 $(INSTALL_DATA) protoize.1 $(mandir)/protoize$(manext)
1347 chmod a-x $(mandir)/protoize$(manext)
1348 -rm -f $(mandir)/unprotoize$(manext)
1349 $(INSTALL_DATA) unprotoize.1 $(mandir)/unprotoize$(manext)
1350 chmod a-x $(mandir)/unprotoize$(manext)
2e494f70
RS
1351 -rm -f $(mandir)/g++$(manext)
1352 $(INSTALL_DATA) $(srcdir)/g++.1 $(mandir)/g++$(manext)
1353 chmod a-x $(mandir)/g++$(manext)
79d8453e
RS
1354
1355# Install the library.
1356install-libgcc: libgcc.a
1357 -if [ -f libgcc.a ] ; then \
1358 rm -f $(libsubdir)/libgcc.a; \
1359 $(INSTALL_DATA) libgcc.a $(libsubdir)/libgcc.a; \
1360 if $(RANLIB_TEST) ; then \
1361 (cd $(libsubdir); $(RANLIB) libgcc.a); else true; fi; \
1362 chmod a-x $(libsubdir)/libgcc.a; \
1363 else true; fi
1364
1365# Install all the header files for native compiler.
1366install-headers: install-common-headers install-float-h install-limits-h
1367
1368# Install float.h for native compiler.
1369install-float-h: float.h
1370 -rm -f $(libsubdir)/include/float.h
1371 $(INSTALL_DATA) float.h $(libsubdir)/include/float.h
1372 chmod a-x $(libsubdir)/include/float.h
1373
1374# Install limits.h, optionally inheriting from the standard system version.
1375install-limits-h: limits.h limitx.h
1376 -rm -f $(libsubdir)/include/limits.h tmp-limits.h
1377 if [ -f /usr/include/limits.h ] ; then \
1378 cat $(srcdir)/limitx.h $(srcdir)/limits.h > tmp-limits.h; \
1379 else \
1380 cat $(srcdir)/limits.h > tmp-limits.h; \
1381 fi
1382 $(INSTALL_DATA) tmp-limits.h $(libsubdir)/include/limits.h
1383 chmod a-x $(libsubdir)/include/limits.h
1384 rm tmp-limits.h
1385
1386# Install the fixed headers that are the same for all machines.
1387install-common-headers: install-dir $(USER_H) gvarargs.h gstdarg.h gstddef.h
935e11b0 1388 -if [ -d $(libsubdir)/include ] ; then true ; else mkdir $(libsubdir)/include ; fi
79d8453e
RS
1389 -chmod ugo+rx $(libsubdir)/include
1390# Must compute $(libsubdir) before the cd; the awk script won't work after.
1391 shelllibsubdir=$(libsubdir); \
1392 cd $(srcdir); \
1393 for file in $(USER_H); do \
1394 rm -f $$shelllibsubdir/include/`basename $$file`; \
1395 $(INSTALL_DATA) `basename $$file` $$shelllibsubdir/include/`basename $$file`; \
1396 chmod a-x $$shelllibsubdir/include/`basename $$file`; \
1397 done
1398 -rm -f $(libsubdir)/include/varargs.h
1399 $(INSTALL_DATA) $(srcdir)/gvarargs.h $(libsubdir)/include/varargs.h
1400 chmod a-x $(libsubdir)/include/varargs.h
1401 -rm -f $(libsubdir)/include/stdarg.h
1402 $(INSTALL_DATA) $(srcdir)/gstdarg.h $(libsubdir)/include/stdarg.h
1403 chmod a-x $(libsubdir)/include/stdarg.h
1404 -rm -f $(libsubdir)/include/stddef.h
1405 $(INSTALL_DATA) $(srcdir)/gstddef.h $(libsubdir)/include/stddef.h
1406 chmod a-x $(libsubdir)/include/stddef.h
2e494f70
RS
1407# Copy byteorder.h into the object file directory
1408# so that fixinc.svr4 can get at it if necessary.
1409# If the dirs are the same, this won't do anything.
1410 -cp $(srcdir)/byteorder.h .
79d8453e
RS
1411
1412# $(libsubdir)/include:
935e11b0 1413# -if [ -d $(libsubdir)/include ] ; then true ; else mkdir $(libsubdir)/include ; fi
79d8453e
RS
1414# -chmod ugo+rx $(libsubdir)/include
1415
1416# This appears not to work. It isn't clear how to fix it.
2e494f70
RS
1417# $(libsubdir)/include/README: $(libsubdir)/include $(srcdir)/$(FIXINCLUDES)
1418# LIB=$(libsubdir)/include $(srcdir)/$(FIXINCLUDES)
79d8453e
RS
1419# $(INSTALL_DATA) $(srcdir)/fixincludes-README $@
1420# chmod a-x $@
1421
1422# Run fixincludes in the proper directory.
1423install-fixincludes: install-headers
1424 rm -rf $(libsubdir)/tmp
1425 mkdir $(libsubdir)/tmp
1426# Move aside the headers that come from GCC; delete all else.
2e494f70
RS
1427# The sed command gets just the last file name component;
1428# this is necessary because VPATH could add a dirname.
1429# Using basename would be simpler, but some systems don't have it.
1430 cd $(libsubdir)/include; \
1431 for file in $(INSTALLED_H); do \
1432 realfile=`echo $$file | sed -e 's|.*/\([^/]*\)$$|\1|'`; \
1433 mv $$realfile ../tmp; \
1434 done; \
1435 rm -rf *
79d8453e
RS
1436# Install fixed copies of system files.
1437 $(srcdir)/$(FIXINCLUDES) $(libsubdir)/include
1438# Bring back gcc's header files.
1439 cd $(libsubdir)/include; mv ../tmp/* .; rmdir ../tmp
1440# Install the README
1441 $(INSTALL_DATA) $(srcdir)/README-fixinc $(libsubdir)/include/README
1442 chmod a-x $(libsubdir)/include/README
1443
2e494f70
RS
1444# Use this target to install the program `collect2' under the name `ld'.
1445install-collect2: collect2
1446 $(INSTALL_PROGRAM) collect2 $(libsubdir)/ld
1447# Install the driver program as $(libsubdir)/gcc for collect2.
1448 -if [ -f gcc-cross ] ; then \
1449 $(INSTALL_PROGRAM) gcc-cross $(libsubdir)/gcc; \
1450 else \
1451 $(INSTALL_PROGRAM) gcc $(libsubdir)/gcc; \
1452 fi
1453
79d8453e
RS
1454# Cancel installation by deleting the installed files.
1455uninstall:
1456 -rm -rf $(libsubdir)
1457 -rm -rf $(bindir)/gcc
79d8453e
RS
1458 -rm -rf $(bindir)/protoize
1459 -rm -rf $(bindir)/unprotoize
1460 -rm -rf $(mandir)/gcc$(manext)
2e494f70 1461 -rm -rf $(mandir)/cccp$(manext)
79d8453e
RS
1462 -rm -rf $(mandir)/protoize$(manext)
1463 -rm -rf $(mandir)/unprotoize$(manext)
1464\f
1465# These exist for maintenance purposes.
1466
1467# Update the tags table.
1468TAGS: force
1469 cd $(srcdir); \
1470 mkdir temp; \
1471 mv -f c-parse.c c-parse.h cp-parse.c cp-parse.h objc-parse.c cexp.c temp; \
1472 etags *.y *.h *.c; \
1473 mv temp/* .; \
1474 rmdir temp
1475
1476# Create the distribution tar file.
1477#dist: gcc-$(version).tar.Z
1478dist: gcc.xtar.Z
1479
2e494f70 1480gcc.xtar.Z: gcc.xtar
79d8453e
RS
1481 compress < gcc.xtar > tmp-gcc.xtar.Z
1482 mv tmp-gcc.xtar.Z gcc.xtar.Z
1483
1484#gcc-$(version).tar.Z: gcc-$(version).tar
1485# compress < gcc-$(version).tar > gcc-$(version).tar.Z
1486
1487#gcc-$(version).tar:
1488gcc.xtar:
2e494f70 1489 -rm -rf gcc-$(version) tmp
79d8453e
RS
1490# Put all the files in a temporary subdirectory
1491# which has the name that we want to have in the tar file.
2e494f70
RS
1492 mkdir tmp
1493 mkdir tmp/config
1494 for file in *[0-9a-zA-Z+]; do \
1495 ln $$file tmp || cp $$file tmp; \
1496 done
1497 cd config; \
1498 for file in *[0-9a-zA-Z+]; do \
1499 ln $$file ../tmp/config || cp $$file ../tmp/config; \
79d8453e 1500 done
2e494f70
RS
1501 ln .gdbinit tmp
1502 mv tmp gcc-$(version)
79d8453e 1503# Get rid of everything we don't want in the distribution.
2e494f70 1504 cd gcc-$(version); make -f Makefile.in extraclean
79d8453e
RS
1505# Make the distribution.
1506 tar chf gcc.xtar gcc-$(version)
1507# Get rid of the temporary directory.
1508 rm -rf gcc-$(version)
47547081
RS
1509# Update the version number in README
1510 awk '$$1 " " $$2 " " $$3 == "This directory contains" \
1511 { $$6 = version; print $$0 } \
1512 $$1 " " $$2 " " $$3 != "This directory contains"' \
1513 version=$(version) README > tmp.README
1514 mv tmp.README README
79d8453e
RS
1515
1516# do make -f ../gcc/Makefile maketest DIR=../gcc
1517# in the intended test directory to make it a suitable test directory.
1518# THIS IS OBSOLETE; use the -srcdir operand in configure instead.
1519maketest:
1520 ln -s $(DIR)/*.[chy] .
1521 ln -s $(DIR)/configure .
1522 ln -s $(DIR)/*.def .
1523 -rm -f =*
1524 ln -s $(DIR)/.gdbinit .
1525 ln -s $(DIR)/$(FIXINCLUDES) .
1526 -ln -s $(DIR)/bison.simple .
1527 ln -s $(DIR)/config .
1528 ln -s $(DIR)/move-if-change .
1529# The then and else were swapped to avoid a problem on Ultrix.
1530 if [ ! -f Makefile ] ; then ln -s $(DIR)/Makefile .; else false; fi
1531 -rm tm.h aux-output.c config.h md
1532 make clean
1533# You must then run config to set up for compilation.
1534
1535bootstrap: all force
1536 $(MAKE) stage1
2e494f70
RS
1537# This used to define ALLOCA as empty, but that would lead to bad results
1538# for a subsequent `make install' since that would not have ALLOCA empty.
1539# To prevent `make install' from compiling alloca.o and then relinking cc1
1540# because alloca.o is newer, we permit these recursive makes to compile
1541# alloca.o. Then cc1 is newer, so it won't have to be relinked.
1542 $(MAKE) CC="stage1/gcc -Bstage1/" CFLAGS="$(BOOT_CFLAGS)" libdir=$(libdir) LANGUAGES="$(LANGUAGES)"
79d8453e 1543 $(MAKE) stage2
2e494f70 1544 $(MAKE) CC="stage2/gcc -Bstage2/" CFLAGS="$(BOOT_CFLAGS)" libdir=$(libdir) LANGUAGES="$(LANGUAGES)"
79d8453e
RS
1545
1546bootstrap2: force
2e494f70 1547 $(MAKE) CC="stage1/gcc -Bstage1/" CFLAGS="$(BOOT_CFLAGS)" libdir=$(libdir) LANGUAGES="$(LANGUAGES)"
79d8453e 1548 $(MAKE) stage2
2e494f70 1549 $(MAKE) CC="stage2/gcc -Bstage2/" CFLAGS="$(BOOT_CFLAGS)" libdir=$(libdir) LANGUAGES="$(LANGUAGES)"
79d8453e
RS
1550
1551bootstrap3: force
2e494f70 1552 $(MAKE) CC="stage2/gcc -Bstage2/" CFLAGS="$(BOOT_CFLAGS)" libdir=$(libdir) LANGUAGES="$(LANGUAGES)"
79d8453e 1553
dcfedcd0
RK
1554# Compare the object files in the current directory with those in the
1555# stage2 directory.
1556
1557compare: force
1558 for file in *.o; do \
1559 tail +10c $file > tmp-foo1; \
1560 tail +10c stage2/$file > tmp-foo2; \
1561 cmp tmp-foo1 tmp-foo2 || echo $file differs; \
1562 done
1563 -rm -f tmp-foo*
1564
1565# Similar, but compare with stage3 directory
1566compare3: force
1567 for file in *.o; do \
1568 tail +10c $file > tmp-foo1; \
1569 tail +10c stage3/$file > tmp-foo2; \
1570 cmp tmp-foo1 tmp-foo2 || echo $file differs; \
1571 done
1572 -rm -f tmp-foo*
1573
79d8453e
RS
1574# Copy the object files from a particular stage into a subdirectory.
1575stage1: force
2e494f70 1576 -if [ -d stage1 ] ; then true ; else mkdir stage1 ; fi
79d8453e
RS
1577 -mv $(STAGESTUFF) stage1
1578 -rm -f stage1/libgcc.a
1579 -cp libgcc.a stage1
1580 -if $(RANLIB_TEST) ; then $(RANLIB) stage1/libgcc.a; else true; fi
1581
1582stage2: force
2e494f70 1583 -if [ -d stage2 ] ; then true ; else mkdir stage2 ; fi
79d8453e
RS
1584 -mv $(STAGESTUFF) stage2
1585 -rm -f stage2/libgcc.a
1586 -cp libgcc.a stage2
1587 -if $(RANLIB_TEST) ; then $(RANLIB) stage2/libgcc.a; else true; fi
1588
1589stage3: force
935e11b0 1590 -if [ -d stage3 ] ; then true ; else mkdir stage3 ; fi
79d8453e
RS
1591 -mv $(STAGESTUFF) stage3
1592 -rm -f stage3/libgcc.a
1593 -cp libgcc.a stage3
1594 -if $(RANLIB_TEST) ; then $(RANLIB) stage3/libgcc.a; else true; fi
1595
1596stage4: force
935e11b0 1597 -if [ -d stage4 ] ; then true ; else mkdir stage4 ; fi
79d8453e
RS
1598 -mv $(STAGESTUFF) stage4
1599 -rm -f stage4/libgcc.a
1600 -cp libgcc.a stage4
1601 -if $(RANLIB_TEST) ; then $(RANLIB) stage4/libgcc.a; else true; fi
1602
1603# Copy just the executable files from a particular stage into a subdirectory,
1604# and delete the object files. Use this if you're just verifying a version
1605# that is pretty sure to work, and you are short of disk space.
1606risky-stage1: force
935e11b0 1607 -if [ -d stage1 ] ; then true ; else mkdir stage1 ; fi
79d8453e
RS
1608 -mv cc1 cpp cccp gcc stage1
1609 -rm -f stage1/libgcc.a
1610 -cp libgcc.a stage1 && $(RANLIB) stage1/libgcc.a
1611 -make clean
1612
1613risky-stage2: force
935e11b0 1614 -if [ -d stage2 ] ; then true ; else mkdir stage2 ; fi
79d8453e
RS
1615 -mv cc1 cpp cccp gcc stage2
1616 -rm -f stage2/libgcc.a
1617 -cp libgcc.a stage2 && $(RANLIB) stage2/libgcc.a
1618 -make clean
1619
1620risky-stage3: force
935e11b0 1621 -if [ -d stage3 ] ; then true ; else mkdir stage3 ; fi
79d8453e
RS
1622 -mv cc1 cpp cccp gcc stage3
1623 -rm -f stage3/libgcc.a
1624 -cp libgcc.a stage3 && $(RANLIB) stage3/libgcc.a
1625 -make clean
1626
1627risky-stage4: force
935e11b0 1628 -if [ -d stage4 ] ; then true ; else mkdir stage4 ; fi
79d8453e
RS
1629 -mv cc1 cpp cccp gcc stage4
1630 -rm -f stage4/libgcc.a
1631 -cp libgcc.a stage4 && $(RANLIB) stage4/libgcc.a
1632 -make clean
1633
1634#In GNU Make, ignore whether `stage*' exists.
1635.PHONY: stage1 stage2 stage3 stage4 clean realclean TAGS bootstrap
1636.PHONY: risky-stage1 risky-stage2 risky-stage3 risky-stage4
1637
1638force:
This page took 0.210974 seconds and 5 git commands to generate.