Skip to content

Commit

Permalink
makefiles
Browse files Browse the repository at this point in the history
  • Loading branch information
goblinhack committed Jan 25, 2024
1 parent 7d3de1d commit 4682ecc
Show file tree
Hide file tree
Showing 8 changed files with 501 additions and 1 deletion.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -50,4 +50,3 @@ src/ramdisk_data_8.S
src/ramdisk_data_9.S
src/ramdisk_data.cpp
build/Makefile.template
Makefile
1 change: 1 addition & 0 deletions Makefile
167 changes: 167 additions & 0 deletions src/core/.clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,167 @@
---
Language: Cpp
# BasedOnStyle: LLVM
AccessModifierOffset: -2
AlignAfterOpenBracket: Align
AlignConsecutiveMacros: true
AlignConsecutiveAssignments: true
AlignConsecutiveBitFields: true
AlignConsecutiveDeclarations: true
AlignEscapedNewlines: Right
AlignOperands: AlignAfterOperator
AlignTrailingComments: true
AllowAllArgumentsOnNextLine: true
AllowAllConstructorInitializersOnNextLine: true
AllowAllParametersOfDeclarationOnNextLine: true
AllowShortEnumsOnASingleLine: true
AllowShortBlocksOnASingleLine: true
AllowShortCaseLabelsOnASingleLine: true
AllowShortFunctionsOnASingleLine: All
AllowShortLambdasOnASingleLine: All
AllowShortIfStatementsOnASingleLine: Never
AllowShortLoopsOnASingleLine: false
AlwaysBreakAfterDefinitionReturnType: None
AlwaysBreakAfterReturnType: None
AlwaysBreakBeforeMultilineStrings: true
AlwaysBreakTemplateDeclarations: MultiLine
AttributeMacros:
- __capability
BinPackArguments: true
BinPackParameters: true
BraceWrapping:
AfterCaseLabel: true
AfterClass: true
AfterControlStatement: true
AfterEnum: true
AfterFunction: true
AfterNamespace: true
AfterObjCDeclaration: true
AfterStruct: true
AfterUnion: true
AfterExternBlock: true
BeforeCatch: true
BeforeElse: true
BeforeLambdaBody: true
BeforeWhile: true
IndentBraces: true
SplitEmptyFunction: true
SplitEmptyRecord: true
SplitEmptyNamespace: true
BreakBeforeBinaryOperators: All
BreakBeforeConceptDeclarations: true
BreakBeforeBraces: Linux
BreakBeforeInheritanceComma: false
BreakInheritanceList: BeforeColon
BreakBeforeTernaryOperators: true
BreakConstructorInitializersBeforeComma: false
BreakConstructorInitializers: BeforeColon
BreakAfterJavaFieldAnnotations: false
BreakStringLiterals: true
ColumnLimit: 118
CommentPragmas: '^ IWYU pragma:'
CompactNamespaces: false
ConstructorInitializerAllOnOneLineOrOnePerLine: false
ConstructorInitializerIndentWidth: 4
ContinuationIndentWidth: 4
Cpp11BracedListStyle: true
DeriveLineEnding: true
DerivePointerAlignment: false
DisableFormat: false
EmptyLineBeforeAccessModifier: LogicalBlock
ExperimentalAutoDetectBinPacking: false
FixNamespaceComments: true
ForEachMacros:
- foreach
- Q_FOREACH
- BOOST_FOREACH
StatementAttributeLikeMacros:
- Q_EMIT
IncludeBlocks: Preserve
IncludeCategories:
- Regex: '^"(llvm|llvm-c|clang|clang-c)/'
Priority: 2
SortPriority: 0
CaseSensitive: false
- Regex: '^(<|"(gtest|gmock|isl|json)/)'
Priority: 3
SortPriority: 0
CaseSensitive: false
- Regex: '.*'
Priority: 1
SortPriority: 0
CaseSensitive: false
IncludeIsMainRegex: '(Test)?$'
IncludeIsMainSourceRegex: ''
IndentCaseLabels: true
IndentCaseBlocks: true
IndentGotoLabels: true
IndentPPDirectives: None
IndentExternBlock: AfterExternBlock
IndentRequires: false
IndentWidth: 2
IndentWrappedFunctionNames: true
InsertTrailingCommas: None
JavaScriptQuotes: Leave
JavaScriptWrapImports: true
KeepEmptyLinesAtTheStartOfBlocks: true
MacroBlockBegin: ''
MacroBlockEnd: ''
MaxEmptyLinesToKeep: 1
NamespaceIndentation: None
ObjCBinPackProtocolList: Auto
ObjCBlockIndentWidth: 2
ObjCBreakBeforeNestedBlockParam: true
ObjCSpaceAfterProperty: false
ObjCSpaceBeforeProtocolList: true
PenaltyBreakAssignment: 2
PenaltyBreakBeforeFirstCallParameter: 19
PenaltyBreakComment: 120
PenaltyBreakFirstLessLess: 120
PenaltyBreakString: 1000
PenaltyBreakTemplateDeclaration: 10
PenaltyExcessCharacter: 1000000
PenaltyReturnTypeOnItsOwnLine: 60
PenaltyIndentedWhitespace: 0
PointerAlignment: Right
ReflowComments: true
SortIncludes: true
SortJavaStaticImport: Before
BreakBeforeBinaryOperators: All
SortUsingDeclarations: true
SpaceAfterCStyleCast: true
SpaceAfterLogicalNot: true
SpaceAfterTemplateKeyword: true
SpaceBeforeAssignmentOperators: true
SpaceBeforeCaseColon: true
SpaceBeforeCpp11BracedList: true
SpaceBeforeCtorInitializerColon: true
SpaceBeforeInheritanceColon: true
SpaceBeforeParens: ControlStatements
SpaceAroundPointerQualifiers: Default
SpaceBeforeRangeBasedForLoopColon: true
SpaceInEmptyBlock: false
SpaceInEmptyParentheses: false
SpacesBeforeTrailingComments: 1
SpacesInAngles: true
SpacesInConditionalStatement: false
SpacesInContainerLiterals: true
SpacesInCStyleCastParentheses: false
SpacesInParentheses: false
SpacesInSquareBrackets: true
SpaceBeforeSquareBrackets: false
BitFieldColonSpacing: Both
Standard: Latest
StatementMacros:
- Q_UNUSED
- QT_REQUIRE_VERSION
TabWidth: 2
UseCRLF: false
UseTab: Never
WhitespaceSensitiveMacros:
- STRINGIZE
- PP_STRINGIZE
- BOOST_PP_STRINGIZE
- NS_SWIFT_NAME
- CF_SWIFT_NAME
...

40 changes: 40 additions & 0 deletions src/core/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
include ../../build/Makefile.template
COMPILER_FLAGS+=-O0

BUILD_DIR=../../.o
SRC_DIR=.

#
# To force clean and avoid "up to date" warning.
#
.PHONY: all clean clobber

SOURCES := $(wildcard *.cpp) $(wildcard *.S)
OBJECTS :=\
$(addprefix $(BUILD_DIR)/,$(addsuffix .o,$(basename $(SOURCES))))

DEP_FILES := $(OBJECTS:.o=.d)
DEP_FLAGS = -MMD -MP

$(BUILD_DIR): ; mkdir -p $(BUILD_DIR)
$(OBJECTS): | $(BUILD_DIR)

$(BUILD_DIR)/%.o: %.cpp
$(CC) $(CFLAGS) $(DEP_FLAGS) -I ../../src -c -o $@ $<

$(BUILD_DIR)/%.o: %.S
$(CC) $(DEP_FLAGS) -c -o $@ $<

all: $(OBJECTS)

clean:
rm -rf $(BUILD_DIR)

clobber: clean
rm -f ramdisk_data.cpp $(wildcard ramdisk_data*.S)

# delete corresponding object file if dependency file needs regeneration
$(BUILD_DIR)/%.d: ; @rm -f "$(@:.d=.o)"

# include all dependency files
-include $(DEP_FILES)
40 changes: 40 additions & 0 deletions src/gfx/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
include ../../build/Makefile.template
COMPILER_FLAGS+=-O0

BUILD_DIR=../../.o
SRC_DIR=.

#
# To force clean and avoid "up to date" warning.
#
.PHONY: all clean clobber

SOURCES := $(wildcard *.cpp) $(wildcard *.S)
OBJECTS :=\
$(addprefix $(BUILD_DIR)/,$(addsuffix .o,$(basename $(SOURCES))))

DEP_FILES := $(OBJECTS:.o=.d)
DEP_FLAGS = -MMD -MP

$(BUILD_DIR): ; mkdir -p $(BUILD_DIR)
$(OBJECTS): | $(BUILD_DIR)

$(BUILD_DIR)/%.o: %.cpp
$(CC) $(CFLAGS) $(DEP_FLAGS) -I ../../src -c -o $@ $<

$(BUILD_DIR)/%.o: %.S
$(CC) $(DEP_FLAGS) -c -o $@ $<

all: $(OBJECTS)

clean:
rm -rf $(BUILD_DIR)

clobber: clean
rm -f ramdisk_data.cpp $(wildcard ramdisk_data*.S)

# delete corresponding object file if dependency file needs regeneration
$(BUILD_DIR)/%.d: ; @rm -f "$(@:.d=.o)"

# include all dependency files
-include $(DEP_FILES)
46 changes: 46 additions & 0 deletions src/things/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
include ../../build/Makefile.template
COMPILER_FLAGS+=-O0

BUILD_DIR=../../.o

#
# To force clean and avoid "up to date" warning.
#
.PHONY: all clean clobber

SOURCES := $(wildcard */*.cpp) $(wildcard *.S)
OBJECTS :=\
$(addprefix $(BUILD_DIR)/,$(addsuffix .o,$(basename $(SOURCES))))

DEP_FILES := $(OBJECTS:.o=.d)
DEP_FLAGS = -MMD -MP

$(BUILD_DIR): ; mkdir -p $(BUILD_DIR)
$(BUILD_DIR)/world: ; cp .clang-format world/ ; mkdir -p $(BUILD_DIR)/world
$(BUILD_DIR)/dungeon: ; cp .clang-format dungeon/ ; mkdir -p $(BUILD_DIR)/dungeon
$(BUILD_DIR)/player: ; cp .clang-format player/ ; mkdir -p $(BUILD_DIR)/player

$(OBJECTS): | $(BUILD_DIR) \
$(BUILD_DIR)/world \
$(BUILD_DIR)/dungeon \
$(BUILD_DIR)/player

$(BUILD_DIR)/%.o: %.cpp
$(CC) $(CFLAGS) $(DEP_FLAGS) -I ../../src -c -o $@ $<

$(BUILD_DIR)/%.o: %.S
$(CC) $(DEP_FLAGS) -c -o $@ $<

all: $(OBJECTS)

clean:
rm -rf $(OBJECTS)

clobber: clean
rm -f ramdisk_data.cpp $(wildcard ramdisk_data*.S)

# delete corresponding object file if dependency file needs regeneration
$(BUILD_DIR)/%.d: ; @rm -f "$(@:.d=.o)"

# include all dependency files
-include $(DEP_FILES)
Loading

0 comments on commit 4682ecc

Please sign in to comment.