diff options
author | bloodstalker <thabogre@gmail.com> | 2018-08-29 07:40:41 +0000 |
---|---|---|
committer | bloodstalker <thabogre@gmail.com> | 2018-08-29 07:40:41 +0000 |
commit | 2dce41448fc1f139fd433c9f95c4e21d82ac445b (patch) | |
tree | a48ab2b375474dd20be578a8bcf5459a94e10e75 | |
parent | update (diff) | |
download | luatablegen-2dce41448fc1f139fd433c9f95c4e21d82ac445b.tar.gz luatablegen-2dce41448fc1f139fd433c9f95c4e21d82ac445b.zip |
update
-rw-r--r-- | .gitmodules | 3 | ||||
m--------- | lua5 | 0 | ||||
-rw-r--r-- | out/main.c | 10 | ||||
-rw-r--r-- | out/makefile | 154 |
4 files changed, 167 insertions, 0 deletions
diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..228a875 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "lua5"] + path = lua5 + url = https://github.com/lua/lua diff --git a/lua5 b/lua5 new file mode 160000 +Subproject f59e6a93c0ad38a27a420e51abf8f13d962446b diff --git a/out/main.c b/out/main.c new file mode 100644 index 0000000..ea3c487 --- /dev/null +++ b/out/main.c @@ -0,0 +1,10 @@ +#include "./wasm_tables.h" +#include <stdio.h> +#include <inttypes.h> +#include "/home/bloodstalker/devi/hell2/bruiser/lua-5.3.4/src/lauxlib.h" +#include "/home/bloodstalker/devi/hell2/bruiser/lua-5.3.4/src/lua.h" +#include "/home/bloodstalker/devi/hell2/bruiser/lua-5.3.4/src/lualib.h" + +#pragma weak main +int main (int argc, char** argv) { +} diff --git a/out/makefile b/out/makefile new file mode 100644 index 0000000..f3a0757 --- /dev/null +++ b/out/makefile @@ -0,0 +1,154 @@ +TARGET=main +SHELL=bash +SHELL?=bash +CC=clang +CC?=clang +CC_FLAGS=-fpic +CC_EXTRA?= +CTAGS_I_PATH?=./ +LD_FLAGS= +LIB_LUA=../lua5/liblua.a +EXTRA_LD_FLAGS?=-L ../lua5 +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_CC= -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 %.c, %.o, $(wildcard *.c)) +ASM_LIST:=$(patsubst %.c, %.dis, $(wildcard *.c)) + +ifeq ($(BUILD_MODE), ADDSAN) +ifeq ($(CC), gcc) +$(error This build mode is only useable with clang.) +endif +CC_EXTRA+=$(ADD_SANITIZERS_CC) +EXTRA_LD_FLAGS+=$(ADD_SANITIZERS_LD) +endif + +ifeq ($(BUILD_MODE), MEMSAN) +ifeq ($(CC), gcc) +$(error This build mode is only useable with clang.) +endif +CC_EXTRA+=$(MEM_SANITIZERS_CC) +EXTRA_LD_FLAGS+=$(MEM_SANITIZERS_LD) +endif + +ifeq ($(BUILD_MODE), UBSAN) +ifeq ($(CC), gcc) +$(error This build mode is only useable with clang.) +endif +CC_EXTRA+=$(UB_SANITIZERS_CC) +EXTRA_LD_FLAGS+=$(UB_SANITIZERS_LD) +endif + +SRCS:=$(wildcard *.c) +CC_FLAGS+=$(CC_EXTRA) +LD_FLAGS+=$(EXTRA_LD_FLAGS) + +.DEFAULT:all + +.PHONY:all clean help ASM SO TAGS + +all:$(TARGET) + +everything:$(TARGET) A ASM SO $(TARGET)-static $(TARGET)-dbg TAGS $(TARGET)-cov + +depend:.depend + +.depend:$(SRCS) + rm -rf .depend + $(CC) -MM $(CC_FLAGS) $^ > ./.depend + echo $(patsubst %.o:, %.odbg:, $(shell $(CC) -MM $(CC_FLAGS) $^)) | sed -r 's/[A-Za-z0-9\-\_]+\.odbg/\n&/g' >> ./.depend + echo $(patsubst %.o:, %.ocov:, $(shell $(CC) -MM $(CC_FLAGS) $^)) | sed -r 's/[A-Za-z0-9\-\_]+\.ocov/\n&/g' >> ./.depend + +-include ./.depend + +.c.o: + $(CC) $(CC_FLAGS) -c $< -o $@ + +%.odbg:%.c + $(CC) $(CC_FLAGS) -g -c $< -o $@ + +%.ocov:%.c + $(CC) $(CC_FLAGS) $(COV_CC) -c $< -o $@ + +$(LIB_LUA): + $(MAKE) -C ../lua5 a + +$(TARGET): $(TARGET).o $(LIB_LUA) + $(CC) $^ $(LD_FLAGS) -o $@ + +$(TARGET)-static: $(TARGET).o $(LIB_LUA) + $(CC) $^ $(LD_FLAGS) -static -o $@ + +$(TARGET)-dbg: $(TARGET).odbg $(LIB_LUA) + $(CC) $^ $(LD_FLAGS) -g -o $@ + +$(TARGET)-cov: $(TARGET).ocov $(LIB_LUA) + $(CC) $^ $(LD_FLAGS) $(COV_LD) -o $@ + +cov: + @llvm-profdata merge -sparse ./default.profraw -o ./default.profdata + @llvm-cov show $(TARGET)-cov -instr-profile=default.profdata + +covrep: + @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 + +TAGS:tags + +tags:$(SRCS) + $(shell $(CC) -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 $< > $@ + +$(TARGET).so: $(TARGET).o $(LIB_LUA) + $(CC) $^ $(LD_FLAGS) -shared -o $@ + +$(TARGET).a: $(TARGET).o $(LIB_LUA) + ar rcs $(TARGET).a $(TARGET).o + +runcov: $(TARGET)-cov + $(TARGET)-cov + +valgrind: $(TARGET) + - valgrind --leak-check=yes $(TARGET) + +clean: + rm -f *.o *.dis *.odbg *.ocov *~ $(TARGET) $(TARGET).so $(TARGET)-static $(TARGET)-dbg $(TARGET).a $(TARGET)-cov + +deepclean: clean + if [[ -d tags ]];then rm tags;fi + rm .depend + $(MAKE) -C ../lua5 clean + +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" |