Skip to content

Commit 596ccef

Browse files
authored
Merge pull request #1 from KatLab-MiyazakiUniv/ticket-KL25-6
close #KL25-6 katlabプロジェクトのMakefile作成
2 parents db801e6 + 34c6ebb commit 596ccef

File tree

5 files changed

+115
-8
lines changed

5 files changed

+115
-8
lines changed

.clang-format

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
# ETロボコン用C++コーディング規約
2+
3+
Language: Cpp
4+
AccessModifierOffset: -1
5+
AlignAfterOpenBracket: Align
6+
AlignConsecutiveAssignments: false
7+
AlignConsecutiveDeclarations: false
8+
AlignEscapedNewlinesLeft: true
9+
AlignOperands: true
10+
AlignTrailingComments: true
11+
AllowAllParametersOfDeclarationOnNextLine: false
12+
AllowShortBlocksOnASingleLine: false
13+
AllowShortCaseLabelsOnASingleLine: false
14+
AllowShortFunctionsOnASingleLine: Inline
15+
AllowShortIfStatementsOnASingleLine: true
16+
AllowShortLoopsOnASingleLine: true
17+
AlwaysBreakAfterReturnType: None
18+
AlwaysBreakBeforeMultilineStrings: false
19+
AlwaysBreakTemplateDeclarations: true
20+
BinPackArguments: true
21+
BinPackParameters: true
22+
BraceWrapping:
23+
AfterClass: false
24+
AfterControlStatement: false
25+
AfterEnum: false
26+
AfterFunction: true
27+
AfterNamespace: false
28+
AfterObjCDeclaration: false
29+
AfterStruct: false
30+
AfterUnion: false
31+
BeforeCatch: false
32+
BeforeElse: false
33+
IndentBraces: false
34+
BreakBeforeBinaryOperators: All
35+
BreakBeforeBraces: Custom
36+
BreakBeforeTernaryOperators: true
37+
BreakConstructorInitializersBeforeComma: false
38+
BreakAfterJavaFieldAnnotations: false
39+
BreakStringLiterals: true
40+
ColumnLimit: 100
41+
CommentPragmas: '\*'
42+
ConstructorInitializerAllOnOneLineOrOnePerLine: true
43+
ConstructorInitializerIndentWidth: 2
44+
ContinuationIndentWidth: 4
45+
Cpp11BracedListStyle: false
46+
DerivePointerAlignment: false
47+
DisableFormat: false
48+
IndentCaseLabels: true
49+
IndentWidth: 2
50+
IndentWrappedFunctionNames: false
51+
KeepEmptyLinesAtTheStartOfBlocks: false
52+
MaxEmptyLinesToKeep: 1
53+
NamespaceIndentation: All
54+
PenaltyBreakComment: 300
55+
PenaltyBreakFirstLessLess: 120
56+
PenaltyBreakString: 1000
57+
PenaltyExcessCharacter: 1000000
58+
PenaltyReturnTypeOnItsOwnLine: 200
59+
PointerAlignment: Left
60+
ReflowComments: true
61+
SortIncludes: false
62+
SpaceAfterCStyleCast: false
63+
SpaceBeforeAssignmentOperators: true
64+
SpaceBeforeParens: Never
65+
SpaceInEmptyParentheses: false
66+
SpacesBeforeTrailingComments: 2
67+
SpacesInAngles: false
68+
SpacesInCStyleCastParentheses: false
69+
SpacesInParentheses: false
70+
SpacesInSquareBrackets: false
71+
Standard: Cpp11
72+
TabWidth: 4
73+
UseTab: Never

Makefile

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
MAKEFILE_PATH := $(dir $(abspath $(lastword $(MAKEFILE_LIST))))
2+
3+
# 使い方
4+
help:
5+
@echo ビルドする
6+
@echo " $$ make build"
7+
@echo 走行を開始する\(実機限定\)
8+
@echo " $$ make start"
9+
@echo 指定ファイルをフォーマットする
10+
@echo " $$ make format FILES=<ディレクトリ名>/<ファイル名>.cpp"
11+
@echo すべての変更ファイルをフォーマットする
12+
@echo " $$ make format"
13+
@echo フォーマットチェックをする
14+
@echo " $$ make format-check"
15+
16+
## 実行関連 ##
17+
build:
18+
cd $(MAKEFILE_PATH)../ && make img=etrobocon2025
19+
20+
# 実機の場合、走行を開始する
21+
start:
22+
cd $(MAKEFILE_PATH)../ && make start
23+
24+
## 開発関連 ##
25+
# ファイルにclang-formatを適用する
26+
format:
27+
# 指定ファイルがある場合、そのファイルにclang-formatを適用する
28+
ifdef FILES
29+
clang-format -i -style=file $(FILES)
30+
# ない場合、変更されたファイルのうち、cpp、hファイルにclang-formatを適用する
31+
else
32+
git diff origin/main --name-only | awk '/\.cpp$$|\.h$$/ {print $$1}' | xargs clang-format -i -style=file
33+
endif
34+
35+
format-check:
36+
find ./test ./modules -type f -name "*.cpp" -o -name "*.h" | xargs clang-format --dry-run --Werror *.h *.cpp

app.h

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
#ifdef __cplusplus
2-
extern "C"
3-
{
2+
extern "C" {
43
#endif
54

65
#include "spikeapi.h"
@@ -14,7 +13,7 @@ extern "C"
1413

1514
#ifndef TOPPERS_MACRO_ONLY
1615

17-
extern void main_task(intptr_t exinf);
16+
extern void main_task(intptr_t exinf);
1817

1918
#endif /* TOPPERS_MACRO_ONLY */
2019

modules/EtRobocon2025.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,5 @@
88

99
void EtRobocon2025::start()
1010
{
11-
std::cout << "Hello KATLAB" << std::endl;
11+
std::cout << "Hello KATLAB" << std::endl;
1212
}

modules/EtRobocon2025.h

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,9 @@
99

1010
#include <iostream>
1111

12-
class EtRobocon2025
13-
{
14-
public:
12+
class EtRobocon2025 {
13+
public:
1514
static void start();
1615
};
1716

18-
#endif
17+
#endif

0 commit comments

Comments
 (0)