clang-format generated code for easier debugging

This commit is contained in:
Nicolas Williams
2021-01-19 14:23:58 -06:00
parent 37ab2a5308
commit 6d85ba384f
2 changed files with 12 additions and 2 deletions

View File

@@ -143,11 +143,20 @@ check-local::
SUFFIXES += .x .z .hx
# It's useful for debugging to format generated sources. The default for all
# clang-format styles is to sort includes, but in many cases in-tree we really
# don't want to do that.
.x.c:
@cmp -s $< $@ 2> /dev/null || cp $< $@
@if [ -z "$(CLANG_FORMAT)" ]; then \
cmp -s $< $@ 2> /dev/null || cp $< $@; \
else \
cp $< $@.tmp.c; \
$(CLANG_FORMAT) -style='{BasedOnStyle: Chromium, SortIncludes: false}' -i $@.tmp.c; \
cmp -s $@.tmp.c $@ 2> /dev/null || mv $@.tmp.c $@; \
fi
.hx.h:
@cmp -s $< $@ 2> /dev/null || cp $< $@
@cmp -s $< $@ 2> /dev/null || cp $< $@;
SUFFIXES += .1 .3 .5 .7 .8 .cat1 .cat3 .cat5 .cat7 .cat8