diff --git a/.clang-format b/.clang-format new file mode 100644 index 000000000..b06654d05 --- /dev/null +++ b/.clang-format @@ -0,0 +1,33 @@ +# Style for goxel. +# Still a work in progress. + +BasedOnStyle: LLVM + +AllowShortFunctionsOnASingleLine: Empty +AllowShortIfStatementsOnASingleLine: WithoutElse + +ColumnLimit: 80 +PenaltyExcessCharacter: 1000 + +# Never use tabs for indentation. +UseTab: Never +TabWidth: 4 +IndentWidth: 4 + +ContinuationIndentWidth: 8 +BracedInitializerIndentWidth: 4 + +BreakBeforeBraces: Linux + +BinPackParameters: false +AllowAllArgumentsOnNextLine: true + +SortIncludes: true + +PenaltyReturnTypeOnItsOwnLine: 10000 +PenaltyBreakAssignment: 100 +PenaltyIndentedWhitespace: 2 + +ForEachMacros: + - DL_FOREACH + - DL_FOREACH_SAFE diff --git a/Makefile b/Makefile index 74919b55f..795f73d01 100644 --- a/Makefile +++ b/Makefile @@ -7,7 +7,7 @@ endif .ONESHELL: -all: +all: .FORCE scons $(JOBS) release: @@ -19,12 +19,17 @@ profile: run: ./goxel -clean: +clean: .FORCE scons -c analyze: scan-build scons mode=analyze +# For the moment only apply the format to uncommited changes. +format: .FORCE + git clang-format -f + + # Generate an AppImage. Used by github CI. appimage: scons mode=release @@ -63,3 +68,7 @@ uninstall: rm -f $(DESTDIR)$(PREFIX)/share/applications/goxel.desktop rm -f $$(printf '%s%s' $(DESTDIR)$(PREFIX)/share/metainfo/ \ io.github.guillaumechereau.Goxel.metainfo.xml) + +.PHONY: all + +.FORCE: