Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(170)

Unified Diff: Makefile.standalone

Issue 372133002: Subzero: Add "make format-diff" target. (Closed) Base URL: https://gerrit.chromium.org/gerrit/p/native_client/pnacl-subzero.git@master
Patch Set: Fix paths. Include all .h and .cpp files in "make format". Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Makefile.standalone
diff --git a/Makefile.standalone b/Makefile.standalone
index 6a50f9a0302b8687c86509254db370d32b400f2f..b0addadf436e4c3c5f3bf7078b3f643588056d14 100644
--- a/Makefile.standalone
+++ b/Makefile.standalone
@@ -76,9 +76,23 @@ check: llvm2ice
(cd crosstest; LLVM_BIN_PATH=$(LLVM_BIN_PATH) ./runtests.sh)
# TODO: Fix the use of wildcards.
+# Assumes clang-format is within $PATH.
format:
- $(LLVM_BIN_PATH)/clang-format -style=LLVM -i \
- src/Ice*.h src/Ice*.cpp src/llvm2ice.cpp
+ clang-format -style=LLVM -i src/*.h src/*.cpp
+
+# Assumes clang-format-diff.py is within $PATH, and that the
+# clang-format it calls is also within $PATH. This may require adding
+# a component to $PATH, or creating symlinks within some existing
+# $PATH component. Uses the one in /usr/lib/clang-format/ if it
+# exists.
+ifeq (,$(wildcard /usr/lib/clang-format/clang-format-diff.py))
+ CLANG_FORMAT_DIFF = clang-format-diff.py
+else
+ CLANG_FORMAT_DIFF = /usr/lib/clang-format/clang-format-diff.py
+endif
+format-diff:
+ git diff -U0 HEAD^ | \
+ $(CLANG_FORMAT_DIFF) -p1 -style=LLVM -i
clean:
rm -rf llvm2ice *.o build/
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698