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