File: Makefile

package info (click to toggle)
rustc-web 1.78.0%2Bdfsg1-2~deb11u3
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 1,245,360 kB
  • sloc: xml: 147,985; javascript: 18,022; sh: 11,083; python: 10,265; ansic: 6,172; cpp: 5,023; asm: 4,390; makefile: 4,269
file content (45 lines) | stat: -rw-r--r-- 1,838 bytes parent folder | download | duplicates (4)
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
# ignore-cross-compile
include ../tools.mk

# rust-lang/rust#70924: Test that if we add rust-src component in between two
# incremental compiles, the compiler does not ICE on the second.

# This test uses `ln -s` rather than copying to save testing time, but its
# usage doesn't work on windows. So ignore windows.

# ignore-windows

SYSROOT:=$(shell $(RUSTC) --print sysroot)
FAKEROOT=$(TMPDIR)/fakeroot
INCR=$(TMPDIR)/incr

# Make a local copy of the sysroot; then remove the rust-src part of it, if
# present, for the *first* build. Then put in a facsimile of the rust-src
# component for the second build, in order to expose the ICE from issue #70924.
#
# Note that it is much easier to just do `cp -a $(SYSROOT)/* $(FAKEROOT)` as a
# first step, but I am concerned that would be too expensive in a unit test
# compared to making symbolic links.
#
# Anyway, the pattern you'll see here is: For every prefix in
# root/lib/rustlib/src, link all of prefix parent content, then remove the
# prefix, then loop on the next prefix. This way, we basically create a copy of
# the context around root/lib/rustlib/src, and can freely add/remove the src
# component itself.
all:
	mkdir $(FAKEROOT)
	ln -s $(SYSROOT)/* $(FAKEROOT)
	rm -f $(FAKEROOT)/lib
	mkdir $(FAKEROOT)/lib
	ln -s $(SYSROOT)/lib/* $(FAKEROOT)/lib
	rm -f $(FAKEROOT)/lib/rustlib
	mkdir $(FAKEROOT)/lib/rustlib
	ln -s $(SYSROOT)/lib/rustlib/* $(FAKEROOT)/lib/rustlib
	rm -f $(FAKEROOT)/lib/rustlib/src
	mkdir $(FAKEROOT)/lib/rustlib/src
	ln -s $(SYSROOT)/lib/rustlib/src/* $(FAKEROOT)/lib/rustlib/src
	rm -f $(FAKEROOT)/lib/rustlib/src/rust
	$(RUSTC) --sysroot $(FAKEROOT) -C incremental=$(INCR) main.rs
	mkdir -p $(FAKEROOT)/lib/rustlib/src/rust/src/libstd
	touch $(FAKEROOT)/lib/rustlib/src/rust/src/libstd/lib.rs
	$(RUSTC) --sysroot $(FAKEROOT) -C incremental=$(INCR) main.rs