diff --git a/Makefile.am b/Makefile.am index 5657382e..10dd98c3 100644 --- a/Makefile.am +++ b/Makefile.am @@ -28,3 +28,15 @@ dist_doc_DATA = README.rst EXTRA_DIST = nghttpx.conf.sample proxy.pac.sample android-config android-make \ Dockerfile.android + +.PONY: clang-format + +# Format source files using clang-format. Don't format source files +# under third-party directory since we are not responsible for thier +# coding style. +clang-format: + CLANGFORMAT=`git config --get clangformat.binary`; \ + test -z $${CLANGFORMAT} && CLANGFORMAT="clang-format"; \ + $${CLANGFORMAT} -i lib/*.{c,h} lib/includes/nghttp2/*.h \ + src/*.{c,cc,h} src/includes/nghttp2/*.h examples/*.{c,cc} \ + tests/*.{c,h}