makefile and clang stuff
This commit is contained in:
6
.clangd
Normal file
6
.clangd
Normal file
@@ -0,0 +1,6 @@
|
||||
CompileFlags:
|
||||
Add:
|
||||
- -Isrc
|
||||
- -Ivendor/duckdb/include
|
||||
- -Ivendor/mariadb/include
|
||||
- -std=c11
|
||||
57
Makefile
Normal file
57
Makefile
Normal file
@@ -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
|
||||
44
compile_commands.json
Normal file
44
compile_commands.json
Normal file
@@ -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"
|
||||
}
|
||||
]
|
||||
Reference in New Issue
Block a user