Skip to content

Commit 6d857c0

Browse files
committed
Fix error where make check would not produce compilers first, due to make's infinite-recursion-prevention heuristic.
1 parent 3c1de96 commit 6d857c0

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

Makefile.in

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -505,6 +505,38 @@ stage2/glue.bc: stage2/rustc$(X) stage1/$(CFG_STDLIB) \
505505
@$(call E, generate: $@)
506506
$(STAGE2) -o $@ -glue
507507

508+
# Due to make not wanting to run the same implicit rules twice on the same
509+
# rule tree (implicit-rule recursion prevention, see "Chains of Implicit
510+
# Rules" in GNU Make manual) we have to re-state the %.o and %.s patterns here
511+
# for different directories, to handle cases where (say) a test relies on a
512+
# compiler that relies on a .o file.
513+
514+
stage0/%.o: stage0/%.s
515+
@$(call E, assemble [llvm]: $@)
516+
$(Q)gcc $(CFG_GCC_CFLAGS) -o $@ -c $<
517+
518+
stage0/%.s: stage0/%.bc
519+
@$(call E, compile [llvm]: $@)
520+
$(Q)$(CFG_LLVM_BINDIR)/llc $(CFG_LLC_CFLAGS) -o $@ $<
521+
522+
stage1/%.o: stage1/%.s
523+
@$(call E, assemble [llvm]: $@)
524+
$(Q)gcc $(CFG_GCC_CFLAGS) -o $@ -c $<
525+
526+
stage1/%.s: stage1/%.bc
527+
@$(call E, compile [llvm]: $@)
528+
$(Q)$(CFG_LLVM_BINDIR)/llc $(CFG_LLC_CFLAGS) -o $@ $<
529+
530+
stage2/%.o: stage2/%.s
531+
@$(call E, assemble [llvm]: $@)
532+
$(Q)gcc $(CFG_GCC_CFLAGS) -o $@ -c $<
533+
534+
stage2/%.s: stage2/%.bc
535+
@$(call E, compile [llvm]: $@)
536+
$(Q)$(CFG_LLVM_BINDIR)/llc $(CFG_LLC_CFLAGS) -o $@ $<
537+
538+
539+
508540
######################################################################
509541
# Library and boot rules
510542
######################################################################

0 commit comments

Comments
 (0)