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