aboutsummaryrefslogtreecommitdiff
path: root/gas/Makefile.generic
blob: 1bf57a3266721f9087bd3eddbce726efd2c84126 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
host = generic
target = generic
# Makefile for GNU Assembler
#   Copyright (C) 1987, 1988, 1990, 1991 Free Software Foundation, Inc.

#This file is part of GNU GAS.

#GNU GAS is free software; you can redistribute it and/or modify
#it under the terms of the GNU General Public License as published by
#the Free Software Foundation; either version 1, or (at your option)
#any later version.

#GNU GAS is distributed in the hope that it will be useful,
#but WITHOUT ANY WARRANTY; without even the implied warranty of
#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#GNU General Public License for more details.

#You should have received a copy of the GNU General Public License
#along with GNU GAS; see the file COPYING.  If not, write to
#the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.

# $Id$

# The targets for external use include:
# all, doc, proto, install, uninstall, includes, TAGS,
# clean, cleanconfig, realclean, stage1, stage2, stage3, stage4.

# Variables that exist for you to override.
# See below for how to change them for certain systems.

ALLOCA =
CFLAGS = -g $(XCFLAGS) # -I$(srcdir)/../include
INTERNAL_CFLAGS = $(CROSS)
OLDCC = cc
BISON = bison
BISONFLAGS = -v
AR = ar
OLDAR_FLAGS = qc
AR_FLAGS = rc
SHELL = /bin/sh
# on sysV, define this as cp.
INSTALL = install -c
# These permit overriding just for certain files.
INSTALL_PROGRAM = $(INSTALL)
INSTALL_FILE = $(INSTALL)

# Define this as & to perform parallel make on a Sequent.
# Note that this has some bugs, and it seems currently necessary 
# to compile all the gen* files first by hand to avoid erroneous results.
P =

# How to invoke ranlib.
RANLIB = ranlib
# Test to use to see whether ranlib exists on the system.
RANLIB_TEST = [ -f /usr/bin/ranlib -o -f /bin/ranlib ]

# CFLAGS for use with OLDCC, for compiling gnulib.
# NOTE: -O does not work on some Unix systems!
CCLIBFLAGS = -O

# Version of ar to use when compiling gnulib. 
OLDAR = ar

version=`./gcc -dumpversion`

# Directory where sources are, from where we are.
srcdir = .
# Common prefix for installation directories.
# NOTE: This directory must exist when you start installation.
prefix = /usr/local
# Directory in which to put the executable for the command `gcc'
bindir = $(prefix)/bin
# Directory in which to put the directories used by the compiler.
libdir = $(prefix)/lib
# Directory in which the compiler finds executables, libraries, etc.
libsubdir = $(libdir)/gcc/$(target)/$(version)
# Number to put in man-page filename.
manext = 1
# Directory in which to put man pages.
mandir = $(prefix)/man/man$(manext)

# Additional system libraries to link with.
CLIB=

# Change this to a null string if obstacks are installed in the
# system library.
OBSTACK=obstack.o

# Specify the rule for actually making gnulib.
GNULIB = gnulib.portable

# Specify the rule for actually making gnulib2.
GNULIB2 = gnulib2.portable

# List of extra C and assembler files to add to gnulib.
# Assembler files should have names ending in `.asm'.
LIBFUNCS_EXTRA = 

# Program to convert libraries.
LIBCONVERT = 

# Control whether header files are installed.
INSTALL_HEADERS=install-headers

# Change this to empty to prevent installing limits.h
LIMITS_H = limits.h

# Directory to link to, when using the target `maketest'.
DIR = ../gcc

# For better debugging under COFF, define SEPARATE_AUX_OUTPUT in config.h
# and define the following variable as `aux-output2.c' in make-...
AUX_OUTPUT2 =

# Flags to use when cross-building GCC.
# Prefix to apply to names of object files when using them
# to run on the machine we are compiling on.
HOST_PREFIX=
# Prefix to apply to names of object files when compiling them
# to run on the machine we are compiling on.
# The default for this variable is chosen to keep these rules 
# out of the way of the other rules for compiling the same source files.
HOST_PREFIX_1=loser-
HOST_CC=$(CC)
HOST_CFLAGS=$(ALL_CFLAGS)
HOST_LDFLAGS=$(LDFLAGS)
HOST_CPPFLAGS=$(CPPFLAGS)

# Choose the real default target.
ALL=bootstrap

# End of variables for you to override.

# Lists of files for various purposes.

REAL_SOURCES = \
	$(srcdir)/app.c \
	$(srcdir)/as.c \
	$(srcdir)/atof-generic.c \
	$(srcdir)/bignum-copy.c \
	$(srcdir)/cond.c \
	$(srcdir)/expr.c \
	$(srcdir)/flonum-const.c \
	$(srcdir)/flonum-copy.c \
	$(srcdir)/flonum-mult.c \
	$(srcdir)/frags.c \
	$(srcdir)/hash.c \
	$(srcdir)/hex-value.c \
	$(srcdir)/input-file.c \
	$(srcdir)/input-scrub.c \
	$(srcdir)/messages.c \
	$(srcdir)/output-file.c \
	$(srcdir)/read.c \
	$(srcdir)/strstr.c \
	$(srcdir)/subsegs.c \
	$(srcdir)/symbols.c \
	$(srcdir)/version.c \
	$(srcdir)/write.c \
	$(srcdir)/xmalloc.c \
	$(srcdir)/xrealloc.c

# in an expedient order
LINKED_SOURCES = \
	targ-cpu.c \
	obj-format.c \
	atof-targ.c

SOURCES = $(LINKED_SOURCES) $(REAL_SOURCES)

REAL_HEADERS = \
	$(srcdir)/as.h \
	$(srcdir)/bignum.h \
	$(srcdir)/expr.h \
	$(srcdir)/flonum.h \
	$(srcdir)/frags.h \
	$(srcdir)/hash.h \
	$(srcdir)/input-file.h \
	$(srcdir)/tc.h \
	$(srcdir)/obj.h \
	$(srcdir)/read.h \
	$(srcdir)/reloc.h \
	$(srcdir)/struc-symbol.h \
	$(srcdir)/subsegs.h \
	$(srcdir)/symbols.h \
	$(srcdir)/syscalls.h \
	$(srcdir)/write.h

LINKED_HEADERS = \
	a.out.gnu.h \
	a.out.h \
	host.h \
	targ-env.h \
	targ-cpu.h \
	obj-format.h \
	atof-targ.h

HEADERS = $(LINKED_HEADERS) $(REAL_HEADERS)

OBJS = \
	targ-cpu.o \
	obj-format.o \
	atof-targ.o \
	app.o \
	as.o \
	atof-generic.o \
	bignum-copy.o \
	cond.o \
	expr.o \
	flonum-const.o \
	flonum-copy.o \
	flonum-mult.o \
	frags.o \
	hash.o \
	hex-value.o \
	input-file.o \
	input-scrub.o \
	messages.o \
	output-file.o \
	read.o \
	strstr.o \
	subsegs.o \
	symbols.o \
	version.o \
	write.o \
	xmalloc.o \
	xrealloc.o

# Definition of `all' is here so that new rules inserted by sed
# do not specify the default target.
# The real definition is under `all.internal'.

all: $(ALL)

# sed inserts variable overrides after the following line.
####

# Now figure out from those variables how to compile and link.

# This is the variable actually used when we compile.
ALL_CFLAGS = $(INTERNAL_CFLAGS) $(CFLAGS)

# Even if ALLOCA is set, don't use it if compiling with GCC.
USE_ALLOCA= `if [ x"${CC}" = x"${OLDCC}" ] ; then echo ${ALLOCA}; else true; fi`
USE_HOST_ALLOCA= `if [ x"${CC}" = x"${OLDCC}" ] ; then echo ${HOST_PREFIX}${ALLOCA}; else true; fi`

# Dependency on obstack, alloca, malloc or whatever library facilities
# are not installed in the system libraries.
# We don't use USE_ALLOCA because backquote expansion doesn't work in deps.
LIBDEPS= $(OBSTACK) $(ALLOCA) $(MALLOC)

# Likewise, for use in the tools that must run on this machine
# even if we are cross-building GCC.
# We don't use USE_ALLOCA because backquote expansion doesn't work in deps.
HOST_LIBDEPS= $(HOST_PREFIX)$(OBSTACK) $(HOST_PREFIX)$(ALLOCA) $(HOST_PREFIX)$(MALLOC)

# How to link with both our special library facilities
# and the system's installed libraries.
LIBS = $(OBSTACK) $(USE_ALLOCA) $(MALLOC) $(CLIB)

# Likewise, for use in the tools that must run on this machine
# even if we are cross-building GCC.
HOST_LIBS = $(HOST_PREFIX)$(OBSTACK) $(USE_HOST_ALLOCA) $(HOST_PREFIX)$(MALLOC) $(CLIB)

# Specify the directories to be searched for header files.
# Both . and srcdir are used, in that order,
# so that tm.h and config.h will be found in the compilation
# subdirectory rather than in the source directory.
INCLUDES = -I. -I$(srcdir) -I$(srcdir)/config
SUBDIR_INCLUDES = -I.. -I../$(srcdir) -I../$(srcdir)/config

# Always use -I$(srcdir)/config when compiling.
.c.o:
	$(CC) -c $(ALL_CFLAGS) $(CPPFLAGS) $(INCLUDES) $<

# This tells GNU make version 3 not to export all the variables
# defined in this file into the environment.
.NOEXPORT:

# Files to be copied away after each stage in building.
STAGE_GCC=gcc
STAGESTUFF = *.o gas 

# The files that "belong" in CONFIG_H are deliberately omitted
# because having them there would not be useful in actual practice.
# All they would do is cause complete recompilation every time
# one of the machine description files is edited.
# That may or may not be what one wants to do.
# If it is, rm *.o is an easy way to do it.
# CONFIG_H = config.h tm.h
CONFIG_H =

gas: $(OBJS) $(LIBDEPS)
	$(CC) $(ALL_CFLAGS) $(LDFLAGS) -o gas $(OBJS) $(LIBS)

all.internal: native
# This is what is made with the host's compiler if making a cross assembler.
native: config.status gas

config.status:
	@echo You must configure gas.  Look at the INSTALL file for details.
	@false

compilations: ${OBJS}

# Compiling object files from source files.

# Note that dependencies on obstack.h are not written
# because that file is not part of GAS.

app.o : app.c as.h host.h targ-env.h obj-format.h \
  targ-cpu.h struc-symbol.h reloc.h \
  write.h flonum.h bignum.h expr.h frags.h hash.h read.h symbols.h tc.h obj.h 
as.o : as.c as.h host.h targ-env.h obj-format.h \
  targ-cpu.h struc-symbol.h reloc.h \
  write.h flonum.h bignum.h expr.h frags.h hash.h read.h symbols.h tc.h obj.h 
atof-generic.o : atof-generic.c as.h host.h targ-env.h obj-format.h \
  targ-cpu.h struc-symbol.h reloc.h \
  write.h flonum.h bignum.h expr.h frags.h hash.h read.h symbols.h tc.h obj.h 
bignum-copy.o : bignum-copy.c as.h host.h \
  targ-env.h obj-format.h \
  targ-cpu.h struc-symbol.h reloc.h \
  write.h flonum.h bignum.h expr.h frags.h hash.h read.h symbols.h tc.h obj.h 
cond.o : cond.c as.h host.h targ-env.h obj-format.h \
  targ-cpu.h struc-symbol.h reloc.h \
  write.h flonum.h bignum.h expr.h frags.h hash.h read.h symbols.h tc.h obj.h \
  obstack.h 
debug.o : debug.c as.h host.h targ-env.h obj-format.h \
  targ-cpu.h struc-symbol.h reloc.h \
  write.h flonum.h bignum.h expr.h frags.h hash.h read.h symbols.h tc.h obj.h \
  subsegs.h 
expr.o : expr.c as.h host.h targ-env.h obj-format.h \
  targ-cpu.h  struc-symbol.h reloc.h \
  write.h flonum.h bignum.h expr.h frags.h hash.h read.h symbols.h tc.h obj.h \
  obstack.h 
flonum-const.o : flonum-const.c flonum.h bignum.h 
flonum-copy.o : flonum-copy.c as.h host.h targ-env.h obj-format.h \
  targ-cpu.h  struc-symbol.h reloc.h \
  write.h flonum.h bignum.h expr.h frags.h hash.h read.h symbols.h tc.h obj.h 
flonum-mult.o : flonum-mult.c flonum.h bignum.h 
frags.o : frags.c as.h host.h targ-env.h obj-format.h \
  targ-cpu.h  struc-symbol.h reloc.h \
  write.h flonum.h bignum.h expr.h frags.h hash.h read.h symbols.h tc.h obj.h \
  subsegs.h obstack.h 
hash.o : hash.c as.h host.h targ-env.h obj-format.h \
  targ-cpu.h  struc-symbol.h reloc.h \
  write.h flonum.h bignum.h expr.h frags.h hash.h read.h symbols.h tc.h obj.h 
hex-value.o : hex-value.c 
input-file.o : input-file.c as.h host.h \
   targ-env.h obj-format.h targ-cpu.h \
   struc-symbol.h reloc.h write.h flonum.h bignum.h expr.h \
  frags.h hash.h read.h symbols.h tc.h obj.h input-file.h 
input-scrub.o : input-scrub.c /usr/include/errno.h /usr/include/sys/errno.h \
  as.h host.h targ-env.h obj-format.h \
  targ-cpu.h  struc-symbol.h reloc.h \
  write.h flonum.h bignum.h expr.h frags.h hash.h read.h symbols.h tc.h obj.h \
  input-file.h 
messages.o : messages.c as.h host.h targ-env.h obj-format.h \
  targ-cpu.h  struc-symbol.h reloc.h \
  write.h flonum.h bignum.h expr.h frags.h hash.h read.h symbols.h tc.h obj.h
obstack.o : obstack.c obstack.h 
output-file.o : output-file.c as.h host.h targ-env.h obj-format.h \
  targ-cpu.h  struc-symbol.h reloc.h \
  write.h flonum.h bignum.h expr.h frags.h hash.h read.h symbols.h tc.h obj.h \
  output-file.h 
read.o : read.c as.h host.h targ-env.h obj-format.h \
  targ-cpu.h  struc-symbol.h reloc.h \
  write.h flonum.h bignum.h expr.h frags.h hash.h read.h symbols.h tc.h obj.h \
  obstack.h 
strstr.o : strstr.c   
subsegs.o : subsegs.c as.h host.h targ-env.h obj-format.h \
  targ-cpu.h  struc-symbol.h reloc.h \
  write.h flonum.h bignum.h expr.h frags.h hash.h read.h symbols.h tc.h obj.h \
  subsegs.h obstack.h 
symbols.o : symbols.c as.h host.h targ-env.h obj-format.h \
  targ-cpu.h  struc-symbol.h reloc.h \
  write.h flonum.h bignum.h expr.h frags.h hash.h read.h symbols.h tc.h obj.h \
  obstack.h subsegs.h 
version.o : version.c 
write.o : write.c as.h host.h targ-env.h obj-format.h \
  targ-cpu.h  struc-symbol.h reloc.h \
  write.h flonum.h bignum.h expr.h frags.h hash.h read.h symbols.h tc.h obj.h \
  subsegs.h obstack.h output-file.h 
xmalloc.o : xmalloc.c
xrealloc.o : xrealloc.c 
atof-targ.o : atof-targ.c as.h host.h targ-env.h obj-format.h \
  targ-cpu.h struc-symbol.h reloc.h \
  write.h flonum.h bignum.h expr.h frags.h hash.h read.h \
  symbols.h tc.h obj.h 
obj-format.o : obj-format.c as.h host.h targ-env.h obj-format.h \
  targ-cpu.h struc-symbol.h reloc.h \
  write.h flonum.h bignum.h expr.h frags.h hash.h read.h \
  symbols.h tc.h obj.h obstack.h 
targ-cpu.o : targ-cpu.c targ-env.h obj-format.h \
  targ-cpu.h struc-symbol.h reloc.h \
  write.h flonum.h bignum.h expr.h frags.h hash.h read.h \
  symbols.h tc.h obj.h obstack.h

# Normally this target is not used; but it is used if you
# define ALLOCA=alloca.o.  In that case, you must get a suitable alloca.c
# from the GNU Emacs distribution.
# Note some machines won't allow $(CC) without -S on this source file.
alloca.o:	alloca.c
	$(CC) $(ALL_CFLAGS) $(CPPFLAGS) -S `echo $(srcdir)/alloca.c | sed 's,^\./,,'`
	as alloca.s -o alloca.o

# Compile the libraries to be used by gen*.
# If we are not cross-building, gen* use the same .o's that cc1 will use,
# and HOST_PREFIX_1 is `foobar', just to ensure these rules don't conflict
# with the rules for rtl.o, alloca.o, etc.
$(HOST_PREFIX_1)alloca.o: alloca.c
	rm -f $(HOST_PREFIX)alloca.c
	cp $(srcdir)/alloca.c $(HOST_PREFIX)alloca.c
	$(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(HOST_PREFIX)alloca.c

$(HOST_PREFIX_1)obstack.o: obstack.c
	rm -f $(HOST_PREFIX)obstack.c
	cp $(srcdir)/obstack.c $(HOST_PREFIX)obstack.c
	$(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(HOST_PREFIX)obstack.c

$(HOST_PREFIX_1)malloc.o: malloc.c
	rm -f $(HOST_PREFIX)malloc.c
	cp $(srcdir)/malloc.c $(HOST_PREFIX)malloc.c
	$(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(HOST_PREFIX)malloc.c

# Remake the info files.

doc: $(srcdir)/gas.info

$(srcdir)/gas.info: $(srcdir)/gas.texinfo
	makeinfo `echo $(srcdir)/gas.texinfo | sed 's,^\./,,'`


# Deletion of files made during compilation.
# There are three levels of this: `clean', `cleanconfig' and `realclean'.
# `clean' deletes what you want to delete ordinarily to save space.
# This is most, but not all, of the files made by compilation.
# `cleanconfig' also deletes everything depending
# on the choice of config files.
# `realclean' also deletes everything that could be regenerated automatically.

clean:
	-rm -f $(STAGESTUFF)
# Delete the temporary source copies for cross compilation.
	-rm -f $(HOST_PREFIX_1)alloca.c $(HOST_PREFIX_1)malloc.c
	-rm -f $(HOST_PREFIX_1)obstack.c 
# Delete the stamp files except stamp-gnulib2.
	-rm -f core

# Like clean but also delete the links made to configure gas.
cleanconfig: clean
	-rm -f config.status Makefile host.h targ-env.h
	-rm -f targ-cpu.h targ-cpu.c
	-rm -f obj-format.h obj-format.c
	-rm -f atof-targ.c

# Get rid of every file that's generated from some other file (except INSTALL).
realclean: cleanconfig
	-rm -f gas.aux gas.cps gas.fns gas.info gas.kys gas.pgs gas.tps gas.vrs
	-rm -f TAGS 
	-rm -f gas.info* gas.?? gas.??s gas.log gas.toc gas.*aux
	-rm -f *.dvi

# Entry points `install', `includes' and `uninstall'.

# Copy the files into directories where they will be run.
install:
	$(INSTALL_PROGRAM) gas $(bindir)/as

# Create the installation directory.
install-dir:
	-mkdir $(libdir)
	-mkdir $(libdir)/gcc
	-mkdir $(libdir)/gcc/$(target)
	-mkdir $(libdir)/gcc/$(target)/$(version)

# Install the compiler executables built during cross compilation.
install-cross: native install-dir
	-if [ -f cc1 ] ; then $(INSTALL_PROGRAM) cc1 $(libsubdir)/cc1; else true; fi
	-if [ -f cc1plus ] ; then $(INSTALL_PROGRAM) cc1plus $(libsubdir)/cc1plus; else true; fi
	$(INSTALL_PROGRAM) cpp $(libsubdir)/cpp
	./gcc -dumpspecs > $(libsubdir)/specs
	$(INSTALL_PROGRAM) gcc $(bindir)/gcc

# Install the man pages.
install-man: install-dir $(srcdir)/gcc.1 protoize.1 unprotoize.1
	$(INSTALL_FILE) $(srcdir)/gcc.1 $(mandir)/gcc.$(manext)
	chmod a-x $(mandir)/gcc.$(manext)
	$(INSTALL_FILE) $(srcdir)/protoize.1 $(mandir)/protoize.$(manext)
	chmod a-x $(mandir)/protoize.$(manext)
	$(INSTALL_FILE) $(srcdir)/unprotoize.1 $(mandir)/unprotoize.$(manext)
	chmod a-x $(mandir)/unprotoize.$(manext)

# Cancel installation by deleting the installed files.
uninstall:
	-rm -rf $(libsubdir)
	-rm -rf $(bindir)/gas
	-rm -rf $(mandir)/gas.$(manext)


# These exist for maintenance purposes.

tags TAGS: force
	etags $(REAL_SOURCES) $(REAL_HEADERS) README Makefile config/*.[hc]
	
bootstrap: gas force
	$(MAKE) stage1
	$(MAKE) CC="$(CC)" CFLAGS="-O -Bstage1/ $(CFLAGS)" libdir=$(libdir) ALLOCA= gas
	$(MAKE) stage2
	$(MAKE) CC="$(CC)" CFLAGS="-O -Bstage2/ $(CFLAGS)" libdir=$(libdir) ALLOCA= gas
	for i in *.o; do cmp $$i stage2/$$i; done

bootstrap2: force
	$(MAKE) CC="$(CC)" CFLAGS="-O -Bstage1/ $(CFLAGS)" libdir=$(libdir) ALLOCA= gas
	$(MAKE) stage2
	$(MAKE) CC="$(CC)" CFLAGS="-O -Bstage2/ $(CFLAGS)" libdir=$(libdir) ALLOCA= gas
	for i in *.o; do cmp $$i stage2/$$i; done

bootstrap3: force
	$(MAKE) CC="$(CC)" CFLAGS="-O -Bstage2/ $(CFLAGS)" libdir=$(libdir) ALLOCA= gas
	for i in *.o; do cmp $$i stage2/$$i; done

# Copy the object files from a particular stage into a subdirectory.
stage1: force
	-mkdir stage1
	-mv $(STAGESTUFF) stage1
	-(cd stage1 ; ln -s gas as)

stage2: force
	-mkdir stage2
	-mv $(STAGESTUFF) stage2
	-(cd stage2 ; ln -s gas as)


stage3: force
	-mkdir stage3
	-mv $(STAGESTUFF) $(STAGE_GCC) stage3
	-rm -f stage3/gnulib
	-cp gnulib stage3
	-if $(RANLIB_TEST) ; then $(RANLIB) stage3/gnulib; else true; fi

stage4: force
	-mkdir stage4
	-mv $(STAGESTUFF) $(STAGE_GCC) stage4
	-rm -f stage4/gnulib
	-cp gnulib stage4
	-if $(RANLIB_TEST) ; then $(RANLIB) stage4/gnulib; else true; fi

# Copy just the executable files from a particular stage into a subdirectory,
# and delete the object files.  Use this if you're just verifying a version
# that is pretty sure to work, and you are short of disk space.
risky-stage1: force
	-mkdir stage1
	-mv cc1 cpp cccp gcc stage1
	-rm -f stage1/gnulib
	-cp gnulib stage1 && $(RANLIB) stage1/gnulib
	-make clean

risky-stage2: force
	-mkdir stage2
	-mv cc1 cpp cccp gcc stage2
	-rm -f stage2/gnulib
	-cp gnulib stage2 && $(RANLIB) stage2/gnulib
	-make clean

risky-stage3: force
	-mkdir stage3
	-mv cc1 cpp cccp gcc stage3
	-rm -f stage3/gnulib
	-cp gnulib stage3 && $(RANLIB) stage3/gnulib
	-make clean

risky-stage4: force
	-mkdir stage4
	-mv cc1 cpp cccp gcc stage4
	-rm -f stage4/gnulib
	-cp gnulib stage4 && $(RANLIB) stage4/gnulib
	-make clean

#In GNU Make, ignore whether `stage*' exists.
.PHONY: stage1 stage2 stage3 stage4 clean realclean TAGS bootstrap
.PHONY: risky-stage1 risky-stage2 risky-stage3 risky-stage4

force:

Makefile: $(srcdir)/Makefile.in $(srcdir)/configure
	$(srcdir)/configure.was -srcdir=$(srcdir) -host=$(host) $(target)