mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2024-12-30 20:23:46 +08:00
make style: take care of EOF LF
This commit is contained in:
parent
346af6e3d1
commit
f205f9db87
2 changed files with 10 additions and 6 deletions
|
@ -258,9 +258,7 @@ you shouldn't use it (same for _FOOBAR_H).
|
|||
|
||||
=== WHITESPACE ===
|
||||
|
||||
Avoid trailing whitespace (no line should end in tab or space). People forget
|
||||
this all the time if their editor doesn't handle it, but don't be surprised if
|
||||
you see someone fixing it from time to time.
|
||||
"make style" will take care of that.
|
||||
|
||||
Avoid trailing whitespace (no line should end in tab or space).
|
||||
Keep a newline (blank line) at the end of each file.
|
||||
|
||||
"make style" will take care of both.
|
||||
|
|
8
Makefile
8
Makefile
|
@ -106,8 +106,14 @@ endif
|
|||
print-%: ; @echo $* = $($*)
|
||||
|
||||
style:
|
||||
# Make sure astyle is installed
|
||||
@which astyle >/dev/null || ( echo "Please install 'astyle' package first" ; exit 1 )
|
||||
find . \( -name "*.[ch]" -or -name "*.cpp" -or -name "*.lua" -or -name "Makefile" \) -exec perl -pi -e 's/[ \t\r]+$$//' {} \;
|
||||
# Remove spaces & tabs at EOL, add LF at EOF if needed on *.c, *.h, *.cpp. *.lua, *.py, *.pl, Makefile
|
||||
find . \( -name "*.[ch]" -or -name "*.cpp" -or -name "*.lua" -or -name "*.py" -or -name "*.pl" -or -name "Makefile" \) \
|
||||
-exec perl -pi -e 's/[ \t\r]+$$//' {} \; \
|
||||
-exec sh -c "tail -c1 {} | xxd -p | tail -1 | grep -q -v 0a$$" \; \
|
||||
-exec sh -c "echo >> {}" \;
|
||||
# Apply astyle on *.c, *.h, *.cpp
|
||||
find . \( -name "*.[ch]" -or -name "*.cpp" \) -exec astyle --formatted --mode=c --suffix=none \
|
||||
--indent=spaces=4 --indent-switches --indent-preprocessor \
|
||||
--keep-one-line-blocks --max-instatement-indent=60 \
|
||||
|
|
Loading…
Reference in a new issue