PageRenderTime 6ms CodeModel.GetById 1ms app.highlight 3ms RepoModel.GetById 1ms app.codeStats 0ms

/mk/pp.mk

http://github.com/jruderman/rust
Makefile | 29 lines | 26 code | 2 blank | 1 comment | 5 complexity | 5b3deb6121759e9f6f69f7aba9aa55a6 MD5 | raw file
 1# Create a way to reformat just some files
 2ifdef PPFILES
 3  PP_INPUTS_FILTERED := $(wildcard $(PPFILES))
 4else
 5  PP_INPUTS = $(wildcard $(addprefix $(S)src/libcore/,*.rs */*.rs)) \
 6              $(wildcard $(addprefix $(S)src/libstd/,*.rs */*.rs)) \
 7              $(wildcard $(addprefix $(S)src/rustc/,*.rs */*.rs */*/*.rs)) \
 8              $(wildcard $(S)src/test/*/*.rs    \
 9                         $(S)src/test/*/*/*.rs) \
10              $(wildcard $(S)src/fuzzer/*.rs)   \
11              $(wildcard $(S)src/cargo/*.rs)
12
13  PP_INPUTS_FILTERED = $(shell echo $(PP_INPUTS) | xargs grep -L \
14                       "no-reformat\|xfail-pretty\|xfail-test")
15endif
16
17reformat: $(SREQ1$(CFG_HOST_TRIPLE))
18	@$(call E, reformat [stage1]: $@)
19	for i in $(PP_INPUTS_FILTERED);  \
20    do $(call CFG_RUN_TARG,1,$(CFG_HOST_TRIPLE)/stage1/rustc$(X)) \
21       --pretty normal $$i >$$i.tmp; \
22    if [ $$? -ne 0 ]; \
23        then echo failed to print $$i; rm $$i.tmp; \
24        else if cmp --silent $$i.tmp $$i; \
25            then echo no changes to $$i; rm $$i.tmp; \
26            else echo reformated $$i; mv $$i.tmp $$i; \
27        fi; \
28    fi; \
29    done