/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
  2. ifdef PPFILES
  3. PP_INPUTS_FILTERED := $(wildcard $(PPFILES))
  4. else
  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. PP_INPUTS_FILTERED = $(shell echo $(PP_INPUTS) | xargs grep -L \
  13. "no-reformat\|xfail-pretty\|xfail-test")
  14. endif
  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,$(CFG_HOST_TRIPLE)/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