]> git.lizzy.rs Git - rust.git/blob - mk/pp.mk
doc: 'if' expressions no longer require parens
[rust.git] / mk / pp.mk
1 # Create a way to reformat just some files
2 ifdef PPFILES
3   PP_INPUTS_FILTERED := $(wildcard $(PPFILES))
4 else
5   PP_INPUTS = $(wildcard $(addprefix $(S)src/lib/,*.rs */*.rs)) \
6               $(wildcard $(addprefix $(S)src/comp/,*.rs */*.rs */*/*.rs)) \
7               $(wildcard $(S)src/test/*/*.rs   \
8                          $(S)src/test/*/*/*.rs) \
9               $(wildcard $(S)src/fuzzer/*.rs)
10
11   PP_INPUTS_FILTERED = $(shell echo $(PP_INPUTS) | xargs grep -L \
12                        "no-reformat\|xfail-pretty\|xfail-test")
13 endif
14
15 reformat: $(SREQ1$(CFG_HOST_TRIPLE))
16         @$(call E, reformat [stage1]: $@)
17         for i in $(PP_INPUTS_FILTERED);  \
18     do $(call CFG_RUN_TARG,1,stage1/rustc$(X)) \
19        --pretty normal $$i >$$i.tmp; \
20     if [ $$? -ne 0 ]; \
21         then echo failed to print $$i; rm $$i.tmp; \
22         else if cmp --silent $$i.tmp $$i; \
23             then echo no changes to $$i; rm $$i.tmp; \
24             else echo reformated $$i; mv $$i.tmp $$i; \
25         fi; \
26     fi; \
27     done