Add format target
Signed-off-by: Tomasz Michalak <tmichalak@antmicro.com>
diff --git a/.clang-format b/.clang-format
new file mode 100644
index 0000000..f9a8b1f
--- /dev/null
+++ b/.clang-format
@@ -0,0 +1,12 @@
+# Default Linux style
+BasedOnStyle: LLVM
+IndentWidth: 4
+UseTab: Never
+BreakBeforeBraces: Linux
+AllowShortIfStatementsOnASingleLine: false
+IndentCaseLabels: false
+
+# From CodingReadme
+TabWidth: 4
+ContinuationIndentWidth: 2
+ColumnLimit: 150
diff --git a/Makefile b/Makefile
index d142d31..1fe1c9e 100644
--- a/Makefile
+++ b/Makefile
@@ -29,3 +29,8 @@
test: $(PLUGINS_TEST)
clean: $(PLUGINS_CLEAN)
+
+CLANG_FORMAT ?= clang-format-5.0
+format:
+ find . -name \*.cc -print0 | xargs -0 -P $$(nproc) ${CLANG_FORMAT} -style=file -i
+ find . -name \*.h -print0 | xargs -0 -P $$(nproc) ${CLANG_FORMAT} -style=file -i