-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add description makefile and some suff
- Loading branch information
Showing
6 changed files
with
163 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
--- | ||
BasedOnStyle: Google | ||
BreakBeforeBraces: Custom | ||
BraceWrapping: | ||
BeforeCatch: true | ||
BeforeElse: true | ||
SplitEmptyFunction: false | ||
SplitEmptyRecord: false | ||
SplitEmptyNamespace: false | ||
IndentWidth: 4 | ||
AccessModifierOffset: -4 | ||
IndentCaseLabels: false | ||
NamespaceIndentation: Inner | ||
ColumnLimit: 0 | ||
AlignConsecutiveMacros: Consecutive | ||
DerivePointerAlignment: false | ||
SpacesBeforeTrailingComments: 1 | ||
AllowShortBlocksOnASingleLine: Always | ||
AllowShortCaseLabelsOnASingleLine: true | ||
AllowShortIfStatementsOnASingleLine: AllIfsAndElse | ||
... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -30,3 +30,11 @@ | |
*.exe | ||
*.out | ||
*.app | ||
|
||
# Output files | ||
/debug | ||
/obj | ||
|
||
*.txt | ||
*.gp | ||
*.png |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
{ | ||
"version": "0.2.0", | ||
"configurations": [ | ||
{ | ||
"name": "make&debug", | ||
"type": "cppdbg", | ||
"request": "launch", | ||
"program": "${workspaceFolder}/debug/main", | ||
"args": [], | ||
"stopAtEntry": false, | ||
"cwd": "${workspaceFolder}", | ||
"environment": [], | ||
"externalConsole": false, | ||
"MIMode": "gdb", | ||
"miDebuggerPath": "gdb", | ||
"setupCommands": [ | ||
{ | ||
"description": "Enable pretty-printing for gdb", | ||
"text": "-enable-pretty-printing", | ||
"ignoreFailures": true | ||
}, | ||
{ | ||
"description": "Skip std namespace", | ||
"text": "skip -rfunction ^std::" | ||
} | ||
], | ||
"preLaunchTask": "make_debug" | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
{ | ||
"version": "2.0.0", | ||
"tasks": [ | ||
{ | ||
"label": "make_debug", | ||
"type": "shell", | ||
"command": "make debug", | ||
"args": [], | ||
"problemMatcher": "$gcc", | ||
"group": "build" | ||
}, | ||
{ | ||
"type": "cppbuild", | ||
"label": "C/C++: g++ build active file", | ||
"command": "/usr/bin/g++", | ||
"args": [ | ||
"-fdiagnostics-color=always", | ||
"-g", | ||
"${file}", | ||
"-o", | ||
"${fileDirname}/${fileBasenameNoExtension}" | ||
], | ||
"options": { | ||
"cwd": "${fileDirname}" | ||
}, | ||
"problemMatcher": [ | ||
"$gcc" | ||
], | ||
"group": { | ||
"kind": "build", | ||
"isDefault": true | ||
}, | ||
"detail": "Task generated by Debugger." | ||
} | ||
] | ||
} |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
# tool macros | ||
CXX ?= g++ | ||
CXXFLAGS := | ||
DBGFLAGS := -g | ||
COBJFLAGS := $(CXXFLAGS) -c | ||
|
||
# path macros | ||
BIN_PATH := bin | ||
OBJ_PATH := obj | ||
SRC_PATH := src | ||
DBG_PATH := debug | ||
|
||
# compile macros | ||
TARGET_NAME := main | ||
ifeq ($(OS),Windows_NT) | ||
TARGET_NAME := $(addsuffix .exe,$(TARGET_NAME)) | ||
endif | ||
TARGET := $(BIN_PATH)/$(TARGET_NAME) | ||
TARGET_DEBUG := $(DBG_PATH)/$(TARGET_NAME) | ||
|
||
# src files & obj files | ||
SRC := $(foreach x, $(SRC_PATH), $(wildcard $(addprefix $(x)/*,.c*))) | ||
OBJ := $(addprefix $(OBJ_PATH)/, $(addsuffix .o, $(notdir $(basename $(SRC))))) | ||
OBJ_DEBUG := $(addprefix $(DBG_PATH)/, $(addsuffix .o, $(notdir $(basename $(SRC))))) | ||
|
||
# clean files list | ||
DISTCLEAN_LIST := $(OBJ) \ | ||
$(OBJ_DEBUG) | ||
CLEAN_LIST := $(TARGET) \ | ||
$(TARGET_DEBUG) \ | ||
$(DISTCLEAN_LIST) | ||
|
||
# default rule | ||
default: makedir all | ||
|
||
# non-phony targets | ||
$(TARGET): $(OBJ) | ||
$(CXX) -o $@ $(OBJ) $(CXXFLAGS) | ||
|
||
$(OBJ_PATH)/%.o: $(SRC_PATH)/%.c* | ||
$(CXX) $(COBJFLAGS) -o $@ $< | ||
|
||
$(DBG_PATH)/%.o: $(SRC_PATH)/%.c* | ||
$(CXX) $(COBJFLAGS) $(DBGFLAGS) -o $@ $< | ||
|
||
$(TARGET_DEBUG): $(OBJ_DEBUG) | ||
$(CXX) $(CXXFLAGS) $(DBGFLAGS) $(OBJ_DEBUG) -o $@ | ||
|
||
# phony rules | ||
.PHONY: makedir | ||
makedir: | ||
@mkdir -p $(BIN_PATH) $(OBJ_PATH) $(DBG_PATH) | ||
|
||
.PHONY: all | ||
all: $(TARGET) | ||
|
||
.PHONY: debug | ||
debug: $(TARGET_DEBUG) | ||
|
||
.PHONY: clean | ||
clean: | ||
@echo CLEAN $(CLEAN_LIST) | ||
@rm -f $(CLEAN_LIST) | ||
|
||
.PHONY: distclean | ||
distclean: | ||
@echo CLEAN $(DISTCLEAN_LIST) | ||
@rm -f $(DISTCLEAN_LIST) |