From bece629f9c7d2e41b84c03f7891e610324054fe0 Mon Sep 17 00:00:00 2001 From: Philippe Teuwen Date: Thu, 7 Nov 2019 12:36:34 +0100 Subject: [PATCH] make style proposition --- Firmware/Chameleon-Mini/Makefile | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/Firmware/Chameleon-Mini/Makefile b/Firmware/Chameleon-Mini/Makefile index 47dbd29..388ba23 100644 --- a/Firmware/Chameleon-Mini/Makefile +++ b/Firmware/Chameleon-Mini/Makefile @@ -173,3 +173,18 @@ dfu-prog: $(TARGET).hex $(TARGET).eep dfu-programmer $(MCU) flash-eeprom $(TARGET).eep dfu-programmer $(MCU) flash $(TARGET).hex dfu-programmer $(MCU) reset + +style: + # Make sure astyle is installed + @which astyle >/dev/null || ( echo "Please install 'astyle' package first" ; exit 1 ) + # Remove spaces & tabs at EOL, add LF at EOF if needed on *.c, *.h, Makefile + find . \( -name "*.[ch]" -or -name "Makefile" \) \ + -exec perl -pi -e 's/[ \t]+$$//' {} \; \ + -exec sh -c "tail -c1 {} | xxd -p | tail -1 | grep -q -v 0a$$" \; \ + -exec sh -c "echo >> {}" \; + # Apply astyle on *.c, *.h + find . -name "*.[ch]" -exec astyle --formatted --mode=c --suffix=none \ + --indent=spaces=4 --indent-switches \ + --keep-one-line-blocks --max-instatement-indent=60 \ + --style=google --pad-oper --unpad-paren --pad-header \ + --align-pointer=name {} \;