From c1f4f75fec88804bb67a5b0bd061dfc6bc0931aa Mon Sep 17 00:00:00 2001 From: SimonFJ20 Date: Fri, 20 Mar 2026 12:34:55 +0100 Subject: [PATCH] add backend --- backend/.clang-format | 15 +++++++++++++++ backend/.gitignore | 1 + backend/Makefile | 36 ++++++++++++++++++++++++++++++++++++ backend/compile_flags.txt | 7 +++++++ backend/src/main.c | 7 +++++++ 5 files changed, 66 insertions(+) create mode 100644 backend/.clang-format create mode 100644 backend/.gitignore create mode 100644 backend/Makefile create mode 100644 backend/compile_flags.txt create mode 100644 backend/src/main.c diff --git a/backend/.clang-format b/backend/.clang-format new file mode 100644 index 0000000..859ab4c --- /dev/null +++ b/backend/.clang-format @@ -0,0 +1,15 @@ +BasedOnStyle: WebKit +IndentWidth: 4 +ColumnLimit: 80 + +IndentCaseLabels: true +InsertNewlineAtEOF: true +AllowShortFunctionsOnASingleLine: None + +BinPackArguments: false +BinPackLongBracedList: false +BinPackParameters: OnePerLine + +AllowAllArgumentsOnNextLine: true +AllowAllParametersOfDeclarationOnNextLine: true + diff --git a/backend/.gitignore b/backend/.gitignore new file mode 100644 index 0000000..567609b --- /dev/null +++ b/backend/.gitignore @@ -0,0 +1 @@ +build/ diff --git a/backend/Makefile b/backend/Makefile new file mode 100644 index 0000000..d2c166d --- /dev/null +++ b/backend/Makefile @@ -0,0 +1,36 @@ + +MAKEFLAGS += -j16 + +CC=gcc +LD=gcc + +CFLAGS=-std=c23 -pedantic-errors -Wall -Wextra -Wconversion +LDFLAGS= + +CFLAGS+=-g + +# CFLAGS+=-ggdb +CFLAGS+=-fsanitize=address + +build_dir = build +obj_dir = $(build_dir)/obj + +sources = \ + src/main.c + +target=$(build_dir)/backend + +all: $(target) + +$(target): $(sources:%.c=$(obj_dir)/%.o) + $(LD) -o $@ $(CFLAGS) $(LDFLAGS) $^ + +$(obj_dir)/%.o: %.c + @mkdir -p $(dir $@) + $(CC) $< -c -o $@ -MMD -MP $(CFLAGS) + +clean: + rm -rf $(build_dir) + +-include $(sources:%.c=$(obj_dir)/%.d) + diff --git a/backend/compile_flags.txt b/backend/compile_flags.txt new file mode 100644 index 0000000..ca856b8 --- /dev/null +++ b/backend/compile_flags.txt @@ -0,0 +1,7 @@ +-xc +-std=c23 +-pedantic-errors +-Wall +-Wextra +-Wconversion + diff --git a/backend/src/main.c b/backend/src/main.c new file mode 100644 index 0000000..9d0a63c --- /dev/null +++ b/backend/src/main.c @@ -0,0 +1,7 @@ +#include + +int main(void) +{ + printf("hello\n"); +} +