diff options
author | bloodstalker <thabogre@gmail.com> | 2018-11-15 11:18:38 +0000 |
---|---|---|
committer | bloodstalker <thabogre@gmail.com> | 2018-11-15 11:18:38 +0000 |
commit | 70090f6a5dad406f38270a2dfa1f302b8627e73b (patch) | |
tree | 63481cb783e53766da44dada00a7510ca0ec0602 | |
parent | update (diff) | |
download | cgrep-70090f6a5dad406f38270a2dfa1f302b8627e73b.tar.gz cgrep-70090f6a5dad406f38270a2dfa1f302b8627e73b.zip |
update
-rw-r--r-- | test/compile_commands.json | 7 | ||||
-rw-r--r-- | test/main.ast | 80 | ||||
-rw-r--r-- | test/main.cpp | 31 | ||||
-rw-r--r-- | test/makefile | 175 |
4 files changed, 293 insertions, 0 deletions
diff --git a/test/compile_commands.json b/test/compile_commands.json new file mode 100644 index 0000000..a12a8fc --- /dev/null +++ b/test/compile_commands.json @@ -0,0 +1,7 @@ +[ + { + "command": "c++ -c -std=c++11 -fpic -o main.o main.cpp", + "directory": "/home/bloodstalker/devi/abbatoir/hole114", + "file": "/home/bloodstalker/devi/abbatoir/hole114/main.cpp" + } +]
\ No newline at end of file diff --git a/test/main.ast b/test/main.ast new file mode 100644 index 0000000..02edebb --- /dev/null +++ b/test/main.ast @@ -0,0 +1,80 @@ +[0;1;32mTranslationUnitDecl[0m[0;33m 0x6bd18f8[0m <[0;33m<invalid sloc>[0m> [0;33m<invalid sloc>[0m +[0;34m|-[0m[0;1;32mTypedefDecl[0m[0;33m 0x6bd21d0[0m <[0;33m<invalid sloc>[0m> [0;33m<invalid sloc>[0m implicit[0;1;36m __int128_t[0m [0;32m'__int128'[0m +[0;34m| `-[0m[0;32mBuiltinType[0m[0;33m 0x6bd1e90[0m [0;32m'__int128'[0m +[0;34m|-[0m[0;1;32mTypedefDecl[0m[0;33m 0x6bd2238[0m <[0;33m<invalid sloc>[0m> [0;33m<invalid sloc>[0m implicit[0;1;36m __uint128_t[0m [0;32m'unsigned __int128'[0m +[0;34m| `-[0m[0;32mBuiltinType[0m[0;33m 0x6bd1eb0[0m [0;32m'unsigned __int128'[0m +[0;34m|-[0m[0;1;32mTypedefDecl[0m[0;33m 0x6bd2568[0m <[0;33m<invalid sloc>[0m> [0;33m<invalid sloc>[0m implicit[0;1;36m __NSConstantString[0m [0;32m'__NSConstantString_tag'[0m +[0;34m| `-[0m[0;32mRecordType[0m[0;33m 0x6bd2310[0m [0;32m'__NSConstantString_tag'[0m +[0;34m| `-[0m[0;1;32mCXXRecord[0m[0;33m 0x6bd2288[0m[0;1;36m '__NSConstantString_tag'[0m +[0;34m|-[0m[0;1;32mTypedefDecl[0m[0;33m 0x6c0c340[0m <[0;33m<invalid sloc>[0m> [0;33m<invalid sloc>[0m implicit[0;1;36m __builtin_ms_va_list[0m [0;32m'char *'[0m +[0;34m| `-[0m[0;32mPointerType[0m[0;33m 0x6bd25c0[0m [0;32m'char *'[0m +[0;34m| `-[0m[0;32mBuiltinType[0m[0;33m 0x6bd1990[0m [0;32m'char'[0m +[0;34m|-[0m[0;1;32mTypedefDecl[0m[0;33m 0x6c0c668[0m <[0;33m<invalid sloc>[0m> [0;33m<invalid sloc>[0m implicit[0;1;36m __builtin_va_list[0m [0;32m'__va_list_tag [1]'[0m +[0;34m| `-[0m[0;32mConstantArrayType[0m[0;33m 0x6c0c610[0m [0;32m'__va_list_tag [1]'[0m 1 +[0;34m| `-[0m[0;32mRecordType[0m[0;33m 0x6c0c420[0m [0;32m'__va_list_tag'[0m +[0;34m| `-[0m[0;1;32mCXXRecord[0m[0;33m 0x6c0c390[0m[0;1;36m '__va_list_tag'[0m +[0;34m|-[0m[0;1;32mCXXRecordDecl[0m[0;33m 0x6c0c6b8[0m <[0;33mmain.cpp:2:1[0m, [0;33mline:12:1[0m> [0;33mline:2:7[0m referenced class[0;1;36m myClass[0m definition +[0;34m| |-[0m[0;1;32mDefinitionData[0m standard_layout has_user_declared_ctor can_const_default_init +[0;34m| | |-[0m[0;1;32mDefaultConstructor[0m exists non_trivial user_provided +[0;34m| | |-[0m[0;1;32mCopyConstructor[0m simple trivial has_const_param implicit_has_const_param +[0;34m| | |-[0m[0;1;32mMoveConstructor[0m +[0;34m| | |-[0m[0;1;32mCopyAssignment[0m trivial has_const_param needs_implicit implicit_has_const_param +[0;34m| | |-[0m[0;1;32mMoveAssignment[0m +[0;34m| | `-[0m[0;1;32mDestructor[0m non_trivial user_declared +[0;34m| |-[0m[0;1;32mCXXRecordDecl[0m[0;33m 0x6c0c7c8[0m <[0;33mcol:1[0m, [0;33mcol:7[0m> [0;33mcol:7[0m implicit referenced class[0;1;36m myClass[0m +[0;34m| |-[0m[0;1;32mAccessSpecDecl[0m[0;33m 0x6c0c850[0m <[0;33mline:3:3[0m, [0;33mcol:9[0m> [0;33mcol:3[0m public +[0;34m| |-[0m[0;1;32mCXXConstructorDecl[0m[0;33m 0x6c0c920[0m <[0;33mline:4:5[0m, [0;33mcol:13[0m> [0;33mcol:5[0m used[0;1;36m myClass[0m [0;32m'void ()'[0m +[0;34m| |-[0m[0;1;32mCXXDestructorDecl[0m[0;33m 0x6c0ca10[0m <[0;33mline:5:5[0m, [0;33mcol:14[0m> [0;33mcol:5[0m used[0;1;36m ~myClass[0m [0;32m'void () noexcept'[0m +[0;34m| |-[0m[0;1;32mCXXMethodDecl[0m[0;33m 0x6c0cb48[0m <[0;33mline:7:5[0m, [0;33mcol:27[0m> [0;33mcol:10[0m used[0;1;36m myMehtod1[0m [0;32m'void ()'[0m +[0;34m| | `-[0m[0;1;35mCompoundStmt[0m[0;33m 0x6c0ce28[0m <[0;33mcol:26[0m, [0;33mcol:27[0m> +[0;34m| |-[0m[0;1;32mCXXMethodDecl[0m[0;33m 0x6c0cc70[0m <[0;33mline:8:5[0m, [0;33mcol:27[0m> [0;33mcol:10[0m used[0;1;36m myMehtod2[0m [0;32m'void ()'[0m +[0;34m| | `-[0m[0;1;35mCompoundStmt[0m[0;33m 0x6c0ce38[0m <[0;33mcol:26[0m, [0;33mcol:27[0m> +[0;34m| |-[0m[0;1;32mAccessSpecDecl[0m[0;33m 0x6c0cd08[0m <[0;33mline:9:3[0m, [0;33mcol:10[0m> [0;33mcol:3[0m private +[0;34m| |-[0m[0;1;32mFieldDecl[0m[0;33m 0x6c0cd48[0m <[0;33mline:10:5[0m, [0;33mcol:9[0m> [0;33mcol:9[0m[0;1;36m a[0m [0;32m'int'[0m +[0;34m| |-[0m[0;1;32mFieldDecl[0m[0;33m 0x6c0cda8[0m <[0;33mline:11:5[0m, [0;33mcol:11[0m> [0;33mcol:11[0m[0;1;36m b[0m [0;32m'float'[0m +[0;34m| `-[0m[0;1;32mCXXConstructorDecl[0m[0;33m 0x6c3b9a8[0m <[0;33mline:2:7[0m> [0;33mcol:7[0m implicit constexpr[0;1;36m myClass[0m [0;32m'void (const myClass &)'[0m inline default trivial noexcept-unevaluated 0x6c3b9a8 +[0;34m| `-[0m[0;1;32mParmVarDecl[0m[0;33m 0x6c3bad0[0m <[0;33mcol:7[0m> [0;33mcol:7[0m [0;32m'const myClass &'[0m +[0;34m|-[0m[0;1;32mCXXRecordDecl[0m[0;33m 0x6c0ce48[0m <[0;33mline:14:1[0m, [0;33mline:17:1[0m> [0;33mline:14:8[0m struct[0;1;36m myStruct[0m definition +[0;34m| |-[0m[0;1;32mDefinitionData[0m empty standard_layout has_user_declared_ctor can_const_default_init +[0;34m| | |-[0m[0;1;32mDefaultConstructor[0m exists non_trivial user_provided defaulted_is_constexpr +[0;34m| | |-[0m[0;1;32mCopyConstructor[0m simple trivial has_const_param needs_implicit implicit_has_const_param +[0;34m| | |-[0m[0;1;32mMoveConstructor[0m +[0;34m| | |-[0m[0;1;32mCopyAssignment[0m trivial has_const_param needs_implicit implicit_has_const_param +[0;34m| | |-[0m[0;1;32mMoveAssignment[0m +[0;34m| | `-[0m[0;1;32mDestructor[0m non_trivial user_declared +[0;34m| |-[0m[0;1;32mCXXRecordDecl[0m[0;33m 0x6c0cf58[0m <[0;33mcol:1[0m, [0;33mcol:8[0m> [0;33mcol:8[0m implicit referenced struct[0;1;36m myStruct[0m +[0;34m| |-[0m[0;1;32mCXXConstructorDecl[0m[0;33m 0x6c0d048[0m <[0;33mline:15:3[0m, [0;33mcol:12[0m> [0;33mcol:3[0m[0;1;36m myStruct[0m [0;32m'void ()'[0m +[0;34m| `-[0m[0;1;32mCXXDestructorDecl[0m[0;33m 0x6c0d138[0m <[0;33mline:16:3[0m, [0;33mcol:13[0m> [0;33mcol:3[0m[0;1;36m ~myStruct[0m [0;32m'void ()'[0m noexcept-unevaluated 0x6c0d138 +[0;34m|-[0m[0;1;32mFunctionDecl[0m[0;33m 0x6c0d2a8[0m <[0;33mline:19:1[0m, [0;33mcol:21[0m> [0;33mcol:6[0m[0;1;36m myFunc1[0m [0;32m'void ()'[0m +[0;34m| `-[0m[0;1;35mCompoundStmt[0m[0;33m 0x6c3b590[0m <[0;33mcol:20[0m, [0;33mcol:21[0m> +[0;34m|-[0m[0;1;32mFunctionDecl[0m[0;33m 0x6c3b630[0m <[0;33mline:20:1[0m, [0;33mcol:21[0m> [0;33mcol:6[0m[0;1;36m myFunc2[0m [0;32m'void ()'[0m +[0;34m| `-[0m[0;1;35mCompoundStmt[0m[0;33m 0x6c3b6c8[0m <[0;33mcol:20[0m, [0;33mcol:21[0m> +[0;34m`-[0m[0;1;32mFunctionDecl[0m[0;33m 0x6c3b868[0m <[0;33mline:22:1[0m, [0;33mline:31:1[0m> [0;33mline:22:5[0m[0;1;36m main[0m [0;32m'int (int, char **)'[0m +[0;34m |-[0m[0;1;32mParmVarDecl[0m[0;33m 0x6c3b6f0[0m <[0;33mcol:11[0m, [0;33mcol:15[0m> [0;33mcol:15[0m[0;1;36m argc[0m [0;32m'int'[0m +[0;34m |-[0m[0;1;32mParmVarDecl[0m[0;33m 0x6c3b790[0m <[0;33mcol:21[0m, [0;33mcol:28[0m> [0;33mcol:28[0m[0;1;36m argv[0m [0;32m'char **'[0m +[0;34m `-[0m[0;1;35mCompoundStmt[0m[0;33m 0x6c3c038[0m <[0;33mcol:34[0m, [0;33mline:31:1[0m> +[0;34m |-[0m[0;1;35mDeclStmt[0m[0;33m 0x6c3bba0[0m <[0;33mline:23:3[0m, [0;33mcol:13[0m> +[0;34m | `-[0m[0;1;32mVarDecl[0m[0;33m 0x6c3b920[0m <[0;33mcol:3[0m, [0;33mcol:11[0m> [0;33mcol:11[0m used[0;1;36m mc[0m [0;32m'myClass'[0m callinit +[0;34m | `-[0m[0;1;35mCXXConstructExpr[0m[0;33m 0x6c3bb38[0m <[0;33mcol:11[0m> [0;32m'myClass'[0m[0;36m[0m[0;36m[0m [0;32m'void ()'[0m +[0;34m |-[0m[0;1;35mCXXMemberCallExpr[0m[0;33m 0x6c3bc18[0m <[0;33mline:24:3[0m, [0;33mcol:16[0m> [0;32m'void'[0m[0;36m[0m[0;36m[0m +[0;34m | `-[0m[0;1;35mMemberExpr[0m[0;33m 0x6c3bbe0[0m <[0;33mcol:3[0m, [0;33mcol:6[0m> [0;32m'<bound member function type>'[0m[0;36m[0m[0;36m[0m .myMehtod1[0;33m 0x6c0cb48[0m +[0;34m | `-[0m[0;1;35mDeclRefExpr[0m[0;33m 0x6c3bbb8[0m <[0;33mcol:3[0m> [0;32m'myClass'[0m[0;36m lvalue[0m[0;36m[0m [0;1;32mVar[0m[0;33m 0x6c3b920[0m[0;1;36m 'mc'[0m [0;32m'myClass'[0m +[0;34m |-[0m[0;1;35mCXXMemberCallExpr[0m[0;33m 0x6c3bca0[0m <[0;33mline:25:3[0m, [0;33mcol:16[0m> [0;32m'void'[0m[0;36m[0m[0;36m[0m +[0;34m | `-[0m[0;1;35mMemberExpr[0m[0;33m 0x6c3bc68[0m <[0;33mcol:3[0m, [0;33mcol:6[0m> [0;32m'<bound member function type>'[0m[0;36m[0m[0;36m[0m .myMehtod2[0;33m 0x6c0cc70[0m +[0;34m | `-[0m[0;1;35mDeclRefExpr[0m[0;33m 0x6c3bc40[0m <[0;33mcol:3[0m> [0;32m'myClass'[0m[0;36m lvalue[0m[0;36m[0m [0;1;32mVar[0m[0;33m 0x6c3b920[0m[0;1;36m 'mc'[0m [0;32m'myClass'[0m +[0;34m |-[0m[0;1;35mDeclStmt[0m[0;33m 0x6c3bd40[0m <[0;33mline:26:3[0m, [0;33mcol:8[0m> +[0;34m | `-[0m[0;1;32mVarDecl[0m[0;33m 0x6c3bce0[0m <[0;33mcol:3[0m, [0;33mcol:7[0m> [0;33mcol:7[0m used[0;1;36m a[0m [0;32m'int'[0m +[0;34m |-[0m[0;1;35mDeclStmt[0m[0;33m 0x6c3bdd0[0m <[0;33mline:27:3[0m, [0;33mcol:10[0m> +[0;34m | `-[0m[0;1;32mVarDecl[0m[0;33m 0x6c3bd70[0m <[0;33mcol:3[0m, [0;33mcol:9[0m> [0;33mcol:9[0m[0;1;36m b[0m [0;32m'float'[0m +[0;34m |-[0m[0;1;35mDeclStmt[0m[0;33m 0x6c3bef0[0m <[0;33mline:28:3[0m, [0;33mcol:10[0m> +[0;34m | |-[0m[0;1;32mVarDecl[0m[0;33m 0x6c3be00[0m <[0;33mcol:3[0m, [0;33mcol:7[0m> [0;33mcol:7[0m used[0;1;36m c[0m [0;32m'int'[0m +[0;34m | `-[0m[0;1;32mVarDecl[0m[0;33m 0x6c3be78[0m <[0;33mcol:3[0m, [0;33mcol:9[0m> [0;33mcol:9[0m used[0;1;36m d[0m [0;32m'int'[0m +[0;34m |-[0m[0;1;35mBinaryOperator[0m[0;33m 0x6c3bfd8[0m <[0;33mline:29:3[0m, [0;33mcol:9[0m> [0;32m'int'[0m[0;36m lvalue[0m[0;36m[0m '=' +[0;34m | |-[0m[0;1;35mDeclRefExpr[0m[0;33m 0x6c3bf08[0m <[0;33mcol:3[0m> [0;32m'int'[0m[0;36m lvalue[0m[0;36m[0m [0;1;32mVar[0m[0;33m 0x6c3bce0[0m[0;1;36m 'a'[0m [0;32m'int'[0m +[0;34m | `-[0m[0;1;35mBinaryOperator[0m[0;33m 0x6c3bfb0[0m <[0;33mcol:7[0m, [0;33mcol:9[0m> [0;32m'int'[0m[0;36m[0m[0;36m[0m '+' +[0;34m | |-[0m[0;1;35mImplicitCastExpr[0m[0;33m 0x6c3bf80[0m <[0;33mcol:7[0m> [0;32m'int'[0m[0;36m[0m[0;36m[0m <[0;31mLValueToRValue[0m> +[0;34m | | `-[0m[0;1;35mDeclRefExpr[0m[0;33m 0x6c3bf30[0m <[0;33mcol:7[0m> [0;32m'int'[0m[0;36m lvalue[0m[0;36m[0m [0;1;32mVar[0m[0;33m 0x6c3be00[0m[0;1;36m 'c'[0m [0;32m'int'[0m +[0;34m | `-[0m[0;1;35mImplicitCastExpr[0m[0;33m 0x6c3bf98[0m <[0;33mcol:9[0m> [0;32m'int'[0m[0;36m[0m[0;36m[0m <[0;31mLValueToRValue[0m> +[0;34m | `-[0m[0;1;35mDeclRefExpr[0m[0;33m 0x6c3bf58[0m <[0;33mcol:9[0m> [0;32m'int'[0m[0;36m lvalue[0m[0;36m[0m [0;1;32mVar[0m[0;33m 0x6c3be78[0m[0;1;36m 'd'[0m [0;32m'int'[0m +[0;34m `-[0m[0;1;35mReturnStmt[0m[0;33m 0x6c3c020[0m <[0;33mline:30:3[0m, [0;33mcol:10[0m> +[0;34m `-[0m[0;1;35mIntegerLiteral[0m[0;33m 0x6c3c000[0m <[0;33mcol:10[0m> [0;32m'int'[0m[0;36m[0m[0;36m[0m[0;1;36m 0[0m diff --git a/test/main.cpp b/test/main.cpp new file mode 100644 index 0000000..815a48d --- /dev/null +++ b/test/main.cpp @@ -0,0 +1,31 @@ + +class myClass { + public: + myClass(); + ~myClass(); + + void myMehtod1(void) {} + void myMehtod2(void) {} + private: + int a; + float b; +}; + +struct myStruct { + myStruct(); + ~myStruct(); +}; + +void myFunc1(void) {} +void myFunc2(void) {} + +int main (int argc, char** argv) { + myClass mc; + mc.myMehtod1(); + mc.myMehtod2(); + int a; + float b; + int c,d; + a = c+d; + return 0; +} diff --git a/test/makefile b/test/makefile new file mode 100644 index 0000000..127064d --- /dev/null +++ b/test/makefile @@ -0,0 +1,175 @@ +TARGET?=main +SHELL=bash +SHELL?=bash +CXX=clang++ +CXX?=clang++ +CXX_FLAGS=-std=c++11 -fpic +CXX_EXTRA?= +CTAGS_I_PATH?=./ +LD_FLAGS= +EXTRA_LD_FLAGS?= +ADD_SANITIZERS_CC= -g -fsanitize=address -fno-omit-frame-pointer +ADD_SANITIZERS_LD= -g -fsanitize=address +MEM_SANITIZERS_CC= -g -fsanitize=memory -fno-omit-frame-pointer +MEM_SANITIZERS_LD= -g -fsanitize=memory +UB_SANITIZERS_CC= -g -fsanitize=undefined -fno-omit-frame-pointer +UB_SANITIZERS_LD= -g -fsanitize=undefined +COV_CXX= -fprofile-instr-generate -fcoverage-mapping +COV_LD= -fprofile-instr-generate +# BUILD_MODES are=RELEASE(default), DEBUG,ADDSAN,MEMSAN,UBSAN +BUILD_MODE?=RELEASE +OBJ_LIST:=$(patsubst %.cpp, %.o, $(wildcard *.cpp)) +ASM_LIST:=$(patsubst %.cpp, %.dis, $(wildcard *.cpp)) +WASM_LIST:=$(patsubst %.cpp, %.wasm, $(wildcard *.cpp)) +JS_LIST:=$(patsubst %.cpp, %.js, $(wildcard *.cpp)) + +ifeq ($(BUILD_MODE), ADDSAN) +ifeq ($(CXX), g++) +$(error This build mode is only useable with clang++.) +endif +CXX_EXTRA+=$(ADD_SANITIZERS_CC) +EXTRA_LD_FLAGS+=$(ADD_SANITIZERS_LD) +endif + +ifeq ($(BUILD_MODE), MEMSAN) +ifeq ($(CXX), g++) +$(error This build mode is only useable with clang++.) +endif +CXX_EXTRA+=$(MEM_SANITIZERS_CC) +EXTRA_LD_FLAGS+=$(MEM_SANITIZERS_LD) +endif + +ifeq ($(BUILD_MODE), UBSAN) +ifeq ($(CXX), g++) +$(error This build mode is only useable with clang++.) +endif +CXX_EXTRA+=$(UB_SANITIZERS_CC) +EXTRA_LD_FLAGS+=$(UB_SANITIZERS_LD) +endif + +SRCS:=$(wildcard *.cpp) +HDRS:=$(wildcard *.h) +CXX_FLAGS+=$(CXX_EXTRA) +LD_FLAGS+=$(EXTRA_LD_FLAGS) + +.DEFAULT:all + +.PHONY:all clean help ASM SO TAGS WASM JS + +all:$(TARGET) + +everything:$(TARGET) A ASM SO $(TARGET)-static $(TARGET)-dbg TAGS $(TARGET)-cov WASM JS + +depend:.depend + +.depend:$(SRCS) + rm -rf .depend + $(CXX) -MM $(CXX_FLAGS) $^ > ./.depend + echo $(patsubst %.o:, %.odbg:, $(shell $(CXX) -MM $(CXX_FLAGS) $^)) | sed -r 's/[A-Za-z0-9\-\_]+\.odbg/\n&/g' >> ./.depend + echo $(patsubst %.o:, %.ocov:, $(shell $(CXX) -MM $(CXX_FLAGS) $^)) | sed -r 's/[A-Za-z0-9\-\_]+\.ocov/\n&/g' >> ./.depend + +-include ./.depend + +.cpp.o: + $(CXX) $(CXX_FLAGS) -c $< -o $@ + +%.odbg:%.cpp + $(CXX) $(CXX_FLAGS) -g -c $< -o $@ + +%.ocov:%.cpp + $(CXX) $(CXX_FLAGS) $(COV_CXX) -c $< -o $@ + +$(TARGET): $(TARGET).o + $(CXX) $(LD_FLAGS) $^ -o $@ + +$(TARGET)-static: $(TARGET).o + $(CXX) $(LD_FLAGS) $^ -static -o $@ + +$(TARGET)-dbg: $(TARGET).odbg + $(CXX) $(LD_FLAGS) $^ -g -o $@ + +$(TARGET)-cov: $(TARGET).ocov + $(CXX) $(LD_FLAGS) $^ $(COV_LD) -o $@ + +cov: runcov + @llvm-profdata merge -sparse ./default.profraw -o ./default.profdata + @llvm-cov show $(TARGET)-cov -instr-profile=default.profdata + +covrep: runcov + @llvm-profdata merge -sparse ./default.profraw -o ./default.profdata + @llvm-cov report $(TARGET)-cov -instr-profile=default.profdata + +ASM:$(ASM_LIST) + +SO:$(TARGET).so + +A:$(TARGET).a + +WASM:$(WASM_LIST) + +JS:$(JS_LIST) + +TAGS:tags + +#https://github.com/rizsotto/Bear +BEAR: clean + bear make + +tags:$(SRCS) + $(shell $(CXX) -c -I $(CTAGS_I_PATH) -M $(SRCS)|\ + sed -e 's/[\\ ]/\n/g'|sed -e '/^$$/d' -e '/\.o:[ \t]*$$/d'|\ + ctags -L - --c++-kinds=+p --fields=+iaS --extra=+q) + +%.dis: %.o + objdump -r -d -M intel -S $< > $@ + +%.wasm: %.cpp + $(CXX) --compile $< --target=wasm32-unknown-unknown-wasm --output $@ + +%.js: %.cpp + em++ $< -o $@ + +$(TARGET).so: $(TARGET).o + $(CXX) $(LD_FLAGS) $^ -shared -o $@ + +$(TARGET).a: $(TARGET).o + ar rcs $(TARGET).a $(TARGET).o + +runcov: $(TARGET)-cov + $(TARGET)-cov + +test: $(TARGET) + $(TARGET) + +valgrind: $(TARGET) + - valgrind --track-origins=yes --leak-check=full --show-leak-kinds=all $(TARGET) + +format: + - clang-format -i $(SRCS) $(HDRS) + +clean: + rm -f *.o *.dis *.odbg *.ocov *.js *~ $(TARGET) $(TARGET).so $(TARGET)-static $(TARGET)-dbg $(TARGET).a $(TARGET)-cov + +deepclean: clean + - rm tags + - rm .depend + - rm ./default.profraw ./default.profdata + - rm vgcore.* + - rm compile_commands.json + +help: + @echo "--all is the default target, runs $(TARGET) target" + @echo "--everything will build everything" + @echo "--SO will generate the so" + @echo "--ASM will generate assembly files" + @echo "--TAGS will generate tags file" + @echo "--$(TARGET) builds the dynamically-linked executable" + @echo "--$(TARGET)-dbg will generate the debug build. BUILD_MODE should be set to DEBUG to work" + @echo "--$(TARGET)-static will statically link the executable to the libraries" + @echo "--$(TARGET)-cov is the coverage build" + @echo "--cov will print the coverage report" + @echo "--covrep will print the line coverage report" + @echo "--A will build the static library" + @echo "--TAGS will build the tags file" + @echo "--clean" + @echo "--deepclean will clean almost everything" |