@@ -186,9 +186,9 @@ X := $(CFG_EXE_SUFFIX)
186
186
VPATH := $(S ) doc $(S ) src
187
187
188
188
# Compilers we build, we now know how to run.
189
- BOOT := $(Q ) OCAMLRUNPARAM="b1" boot/rustboot$(X ) $(CFG_BOOT_FLAGS ) -L stage0
190
- STAGE0 := $(Q )$(CFG_RUN_TARG ) stage0/rustc$(X ) $(CFG_RUSTC_FLAGS ) -L stage1
191
- STAGE1 := $(Q )$(CFG_RUN_TARG ) stage1/rustc$(X ) $(CFG_RUSTC_FLAGS ) -L stage2
189
+ BOOT := $(Q ) OCAMLRUNPARAM="b1" boot/rustboot$(X ) $(CFG_BOOT_FLAGS ) -L boot
190
+ STAGE0 := $(Q )$(CFG_RUN_TARG ) stage0/rustc$(X ) $(CFG_RUSTC_FLAGS ) -L stage0
191
+ STAGE1 := $(Q )$(CFG_RUN_TARG ) stage1/rustc$(X ) $(CFG_RUSTC_FLAGS ) -L stage1
192
192
193
193
# "Source" files we generate in builddir along the way.
194
194
GENERATED := boot/fe/lexer.ml boot/version.ml
@@ -384,6 +384,7 @@ boot/version.ml: $(MKFILES)
384
384
--pretty =format:'let version = "prerelease (%h %ci)";;' >$@ || exit 1
385
385
386
386
387
+
387
388
boot/$(CFG_STDLIB ) : $(S ) src/$(STDLIB_CRATE ) $(STDLIB_INPUTS ) \
388
389
boot/rustboot$(X) $(MKFILES)
389
390
@$(call E, compile: $@)
@@ -394,6 +395,17 @@ stage0/$(CFG_STDLIB): $(S)src/$(STDLIB_CRATE) $(STDLIB_INPUTS) \
394
395
@$(call E, compile: $@)
395
396
$(STAGE0) -shared -o $@ $<
396
397
398
+ stage1/$(CFG_STDLIB ) : $(S ) src/$(STDLIB_CRATE ) $(STDLIB_INPUTS ) \
399
+ stage1/rustc$(X) $(MKFILES)
400
+ @$(call E, compile: $@)
401
+ $(STAGE1) -shared -o $@ $<
402
+
403
+ stage2/$(CFG_STDLIB ) : $(S ) src/$(STDLIB_CRATE ) $(STDLIB_INPUTS ) \
404
+ stage2/rustc$(X) $(MKFILES)
405
+ @$(call E, compile: $@)
406
+ $(STAGE2) -shared -o $@ $<
407
+
408
+
397
409
398
410
stage0/rustc$(X ) : $(S ) src/$(COMPILER_CRATE ) $(COMPILER_INPUTS ) \
399
411
$(BREQ)
@@ -407,6 +419,13 @@ stage1/rustc$(X): $(S)src/$(COMPILER_CRATE) $(COMPILER_INPUTS) \
407
419
$(STAGE0) -o $@ $<
408
420
$(Q)chmod 0755 $@
409
421
422
+ stage2/rustc$(X ) : $(S ) src/$(COMPILER_CRATE ) $(COMPILER_INPUTS ) \
423
+ $(SREQ1) stage1/$(CFG_STDLIB)
424
+ @$(call E, compile: $@)
425
+ $(STAGE1) -o $@ $<
426
+ $(Q)chmod 0755 $@
427
+
428
+
410
429
411
430
stage0/glue.bc : stage0/rustc$(X ) stage0/$(CFG_STDLIB ) \
412
431
llvmext/$(CFG_LLVMEXT) rt/$(CFG_RUNTIME)
@@ -418,6 +437,11 @@ stage1/glue.bc: stage1/rustc$(X) stage1/$(CFG_STDLIB) \
418
437
@$(call E, generate: $@)
419
438
$(STAGE1) -o $@ -glue
420
439
440
+ stage2/glue.bc : stage2/rustc$(X ) stage2/$(CFG_STDLIB ) \
441
+ llvmext/$(CFG_LLVMEXT) rt/$(CFG_RUNTIME)
442
+ @$(call E, generate: $@)
443
+ $(STAGE2) -o $@ -glue
444
+
421
445
# #####################################################################
422
446
# Library and boot rules
423
447
# #####################################################################
@@ -449,14 +473,6 @@ llvmext/%.o: llvmext/%.cpp $(MKFILES)
449
473
# Testing rules
450
474
# #####################################################################
451
475
452
- % .boot$(X ) : % .rs $(BREQ )
453
- @$(call E, compile [boot]: $@ )
454
- $(BOOT ) -o $@ $<
455
-
456
- % .boot$(X ) : % .rc $(BREQ )
457
- @$(call E, compile [boot]: $@ )
458
- $(BOOT ) -o $@ $<
459
-
460
476
% .stage0$(X ) : % .stage0.o rt/$(CFG_RUNTIME ) stage0/glue.o
461
477
@$(call E, link [llvm]: $@ )
462
478
$(Q ) gcc $(CFG_GCC_CFLAGS ) stage0/glue.o -o $@ $< -Lstage0 -lrustrt
@@ -465,6 +481,32 @@ llvmext/%.o: llvmext/%.cpp $(MKFILES)
465
481
@# programs, I\'ll live with the noise.
466
482
-$(Q )$(DSYMUTIL ) $@
467
483
484
+ % .stage1(X) : % .stage1.o rt/$(CFG_RUNTIME ) stage1/glue.o
485
+ @$(call E, link [llvm]: $@ )
486
+ $(Q ) gcc $(CFG_GCC_CFLAGS ) stage1/glue.o -o $@ $< -Lstage1 -lrustrt
487
+ @# dsymutil sometimes fails or prints a warning, but the
488
+ @# program still runs. Since it simplifies debugging other
489
+ @# programs, I\'ll live with the noise.
490
+ -$(Q )$(DSYMUTIL ) $@
491
+
492
+ % .stage2(X) : % .stage2.o rt/$(CFG_RUNTIME ) stage2/glue.o
493
+ @$(call E, link [llvm]: $@ )
494
+ $(Q ) gcc $(CFG_GCC_CFLAGS ) stage2/glue.o -o $@ $< -Lstage2 -lrustrt
495
+ @# dsymutil sometimes fails or prints a warning, but the
496
+ @# program still runs. Since it simplifies debugging other
497
+ @# programs, I\'ll live with the noise.
498
+ -$(Q )$(DSYMUTIL ) $@
499
+
500
+
501
+
502
+ % .boot$(X ) : % .rs $(BREQ )
503
+ @$(call E, compile [boot]: $@ )
504
+ $(BOOT ) -o $@ $<
505
+
506
+ % .boot$(X ) : % .rc $(BREQ )
507
+ @$(call E, compile [boot]: $@ )
508
+ $(BOOT ) -o $@ $<
509
+
468
510
% .stage0.bc : % .rc $(SREQ0 )
469
511
@$(call E, compile [stage0]: $@ )
470
512
$(STAGE0 ) -o $@ $<
@@ -473,6 +515,24 @@ llvmext/%.o: llvmext/%.cpp $(MKFILES)
473
515
@$(call E, compile [stage0]: $@ )
474
516
$(STAGE0 ) -o $@ $<
475
517
518
+ % .stage1.bc : % .rc $(SREQ1 )
519
+ @$(call E, compile [stage1]: $@ )
520
+ $(STAGE1 ) -o $@ $<
521
+
522
+ % .stage1.bc : % .rs $(SREQ1 )
523
+ @$(call E, compile [stage1]: $@ )
524
+ $(STAGE1 ) -o $@ $<
525
+
526
+ % .stage2.bc : % .rc $(SREQ2 )
527
+ @$(call E, compile [stage2]: $@ )
528
+ $(STAGE2 ) -o $@ $<
529
+
530
+ % .stage2.bc : % .rs $(SREQ2 )
531
+ @$(call E, compile [stage2]: $@ )
532
+ $(STAGE2 ) -o $@ $<
533
+
534
+
535
+
476
536
% .o : % .s
477
537
@$(call E, assemble [llvm]: $@ )
478
538
$(Q ) gcc $(CFG_GCC_CFLAGS ) -o $@ -c $<
0 commit comments