diff --git a/.clangd b/.clangd new file mode 100644 index 0000000..852ae83 --- /dev/null +++ b/.clangd @@ -0,0 +1,6 @@ +CompileFlags: + Add: + - -Isrc + - -Ivendor/duckdb/include + - -Ivendor/mariadb/include + - -std=c11 diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..c56466b --- /dev/null +++ b/Makefile @@ -0,0 +1,57 @@ +APPNAME = Coordinator +SRCDIR = src +BUILDDIR = build +VENDORDIR = vendor + +target ?= linux +profile ?= debug +valgrind ?= false + +ifeq ($(target), windows) + CC = x86_64-w64-mingw32-gcc + EXT = .exe + + OPT_FLAGS = -O2 -DNDEBUG + POST_BUILD_CMD = @echo "Build complete." +else + CC = gcc + EXT = + + POST_BUILD_CMD = @echo "Build complete." + + # Profile Logic + ifeq ($(profile), release) + OPT_FLAGS = -O3 -DNDEBUG -march=native + else + OPT_FLAGS = -O0 -g -DDEBUG -Wall -Wextra + endif +endif + +# Combine Flags +CFLAGS = -Wall $(OPT_FLAGS) + +SRC = $(shell find $(SRCDIR) -name "*.c") +OBJ = $(SRC:$(SRCDIR)/%.c=$(BUILDDIR)/%.o) + +all: $(BUILDDIR)/$(APPNAME)$(EXT) + +$(BUILDDIR)/$(APPNAME)$(EXT): $(OBJ) + @echo "Linking $@ (Target: $(target), Profile: $(profile))" + @mkdir -p $(dir $@) + $(CC) $(OBJ) -o $@ $(LIBS) + $(POST_BUILD_CMD) + +$(BUILDDIR)/%.o: $(SRCDIR)/%.c + @echo "Compiling $<" + @mkdir -p $(dir $@) + $(CC) $(CFLAGS) -c $< -o $@ + +RUN_CMD = ./$(BUILDDIR)/$(APPNAME)$(EXT) + +clean: + rm -rf $(BUILDDIR) + +run: all + $(RUN_CMD) ./data/Circuit.duckdb + +.PHONY: all clean run diff --git a/compile_commands.json b/compile_commands.json new file mode 100644 index 0000000..a8f4cf3 --- /dev/null +++ b/compile_commands.json @@ -0,0 +1,44 @@ +[ + { + "arguments": [ + "/usr/bin/gcc", + "-Wall", + "-O0", + "-g", + "-DDEBUG", + "-Wall", + "-Wextra", + "-Isrc", + "-I/usr/include/mysql/", + "-Ivendor/duckdb/linux/include", + "-c", + "-o", + "build/lapinfo.o", + "src/lapinfo.c" + ], + "directory": "/home/tom/Dev/HardCompound", + "file": "/home/tom/Dev/HardCompound/src/lapinfo.c", + "output": "/home/tom/Dev/HardCompound/build/lapinfo.o" + }, + { + "arguments": [ + "/usr/bin/gcc", + "-Wall", + "-O0", + "-g", + "-DDEBUG", + "-Wall", + "-Wextra", + "-Isrc", + "-I/usr/include/mysql/", + "-Ivendor/duckdb/linux/include", + "-c", + "-o", + "build/main.o", + "src/main.c" + ], + "directory": "/home/tom/Dev/HardCompound", + "file": "/home/tom/Dev/HardCompound/src/main.c", + "output": "/home/tom/Dev/HardCompound/build/main.o" + } +]