]> git.proxmox.com Git - rustc.git/blob - src/test/run-make/graphviz-flowgraph/Makefile
1533729de945f9b27bdf6f7fc44364fabcd55170
[rustc.git] / src / test / run-make / graphviz-flowgraph / Makefile
1 -include ../tools.mk
2
3 FILES=f00.rs f01.rs f02.rs f03.rs f04.rs f05.rs f06.rs f07.rs \
4 f08.rs f09.rs f10.rs f11.rs f12.rs f13.rs f14.rs f15.rs \
5 f16.rs f17.rs f18.rs f19.rs f20.rs f21.rs f22.rs f23.rs \
6 f24.rs f25.rs
7
8
9 # all: $(patsubst %.rs,$(TMPDIR)/%.dot,$(FILES)) $(patsubst %.rs,$(TMPDIR)/%.pp,$(FILES))
10 all: $(patsubst %.rs,$(TMPDIR)/%.check,$(FILES))
11
12
13 RUSTC_LIB=$(RUSTC) --crate-type=lib
14
15 define FIND_LAST_BLOCK
16 LASTBLOCKNUM_$(1) := $(shell $(RUSTC_LIB) -Z unstable-options --pretty=expanded,identified $(1) \
17 | grep block
18 | tail -1
19 | sed -e 's@.*/\* block \([0-9]*\) \*/.*@\1@')
20 endef
21
22 ifeq ($(findstring rustc,$(RUSTC)),)
23 $(error Must set RUSTC)
24 endif
25
26 $(TMPDIR)/%.pp: %.rs
27 $(RUSTC_LIB) --pretty=expanded,identified $< -o $@
28
29 $(TMPDIR)/%.dot: %.rs
30 $(eval $(call FIND_LAST_BLOCK,$<))
31 $(RUSTC_LIB) -Z unstable-options --xpretty flowgraph,unlabelled=$(LASTBLOCKNUM_$<) $< -o $@.tmp
32 cat $@.tmp | sed -e 's@ (id=[0-9]*)@@g' \
33 -e 's@\[label=""\]@@' \
34 -e 's@digraph [a-zA-Z0-9_]* @digraph block @' \
35 > $@
36
37 $(TMPDIR)/%.check: %.rs $(TMPDIR)/%.dot
38 diff -u $(patsubst %.rs,$(TMPDIR)/%.dot,$<) $(patsubst %.rs,%.dot-expected.dot,$<)