diff options
author | Kimplul <kimi.h.kuparinen@gmail.com> | 2025-05-18 17:15:57 +0300 |
---|---|---|
committer | Kimplul <kimi.h.kuparinen@gmail.com> | 2025-05-18 17:15:57 +0300 |
commit | 0e6bc60ceb3d2676fae166308668680a2f675d17 (patch) | |
tree | 0f7ebe21dafb8f7546e36b91645e4e5281fff856 /scripts/makefile | |
download | berg-0e6bc60ceb3d2676fae166308668680a2f675d17.tar.gz berg-0e6bc60ceb3d2676fae166308668680a2f675d17.zip |
initial rough skeleton
+ Naive/fast allocation hashmap
+ Stores/loads are currently all checked, the idea about static analysis
to skip checks is still TODO
Diffstat (limited to 'scripts/makefile')
-rw-r--r-- | scripts/makefile | 69 |
1 files changed, 69 insertions, 0 deletions
diff --git a/scripts/makefile b/scripts/makefile new file mode 100644 index 0000000..4543fcf --- /dev/null +++ b/scripts/makefile @@ -0,0 +1,69 @@ +# this could be done better +RELEASE ?= 0 +OPTFLAGS != [ "$(RELEASE)" != "0" ] \ + && echo "-O2 -flto=auto" \ + || echo "-O0" + +DEBUG ?= 1 +DEBUGFLAGS != [ "$(DEBUG)" != "0" ] \ + && echo "-DDEBUG=1" \ + || echo "-DNDEBUG=1" + +ASSERT ?= 1 +ASSERTFLAGS != [ "$(ASSERT)" != "0" ] \ + && echo "-DASSERT=1" \ + || echo + +DEPFLAGS = -MT $@ -MMD -MP -MF $@.d +LINTFLAGS := -fsyntax-only +PREPROCESS := -E + +LLVM ?= 0 +BUILD := build + +all: berg + +# default values, overwrite if/when needed +CROSS_COMPILE := + +OBJCOPY != [ "$(LLVM)" != "0" ] \ + && echo llvm-objcopy \ + || echo $(CROSS_COMPILE)objcopy + +COMPILER != [ -n "$(CROSS_COMPILE)" ] \ + && { \ + [ "$(LLVM)" != "0" ] \ + && echo clang --target="$(CROSS_COMPILE)" \ + || echo $(CROSS_COMPILE)gcc \ + ; \ + } \ + || echo $(CC) + + +# -rdynamic is apparently platform-dependent, not sure if I want to rely on it +# but good enough for now +OBFLAGS := -g -rdynamic +WARNFLAGS := -Wall -Wextra + +COMPILE_FLAGS := $(CFLAGS) $(WARNFLAGS) $(OPTFLAGS) $(OBFLAGS) $(ASSERTFLAGS) \ + $(DEBUGFLAGS) + +INCLUDE_FLAGS := -I include -I deps/conts/include -I deps/ejit/include + +COMPILE = $(COMPILER) \ + $(COMPILE_FLAGS) $(DEPFLAGS) $(INCLUDE_FLAGS) + +LINT = $(COMPILER) \ + $(COMPILE_FLAGS) $(LINTFLAGS) $(INCLUDE_FLAGS) + +COMPILE_BERG = $(COMPILE) $(BERG_FLAGS) + +-include deps.mk + +berg: $(BERG_OBJS) deps/ejit/libejit.a + $(COMPILE_BERG) $(BERG_OBJS) deps/ejit/libejit.a -o $@ -lm + + +# might lint some common things twice +.PHONY: +lint: $(FWD_LINTS) |