diff --git a/Makefile.am b/Makefile.am
index dfeac5ce8274dd17010d232f01f0a3ea52c49209..9c9fd6c1cdd8b7e1b3176b4af26b0b48b5f18bb0 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -23,3 +23,11 @@
 SUBDIRS = lib tests
 
 ACLOCAL_AMFLAGS = -I m4
+
+# 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/ngtcp2/*.h