From a6858f40888338608fede867d279831e98ec0766 Mon Sep 17 00:00:00 2001 From: Marvin Borner Date: Mon, 5 Jul 2021 13:37:42 +0200 Subject: Better dev environment --- .gitignore | 3 +++ makefile | 4 ++-- run | 15 +++++++++++++++ 3 files changed, 20 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index e81e302..a54b999 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,9 @@ cross/ build/ +compile_commands.json +tags + *.o *.bin *.img diff --git a/makefile b/makefile index 62acb87..ae77b9e 100644 --- a/makefile +++ b/makefile @@ -7,8 +7,8 @@ OC = $(PWD)/cross/opt/bin/i686-elf-objcopy ST = $(PWD)/cross/opt/bin/i686-elf-strip AS = nasm -BLD = $(PWD)/build/ -SRC = $(PWD)/src/ +BLD = $(PWD)/build +SRC = $(PWD)/src SRCS = $(wildcard $(SRC)/loader/*.c) OBJS = $(patsubst $(SRC)/%.c,$(BLD)/%.o,$(SRCS)) diff --git a/run b/run index b9a38f6..feaee4a 100755 --- a/run +++ b/run @@ -62,6 +62,18 @@ build_cross() { fi } +# Generate configs for better development experience +generate() { + ctags -R --exclude=.git --exclude=build --exclude=cross . + + # Compile commands for ALE in Vim + make --always-make --dry-run | + grep -wE 'gcc|g\+\+' | + grep -w '\-c' | + jq -nR '[inputs|{directory:".", command:., file: match(" [^ ]+$").string[1:]}]' \ + >compile_commands.json +} + build() { mkdir -p build/ @@ -91,6 +103,9 @@ emulate() { qemu-system-i386 -d guest_errors -cpu max -serial stdio -m 256M -vga std -drive file=build/disk.img,format=raw,index=1,media=disk } +# Always generate updated configurations +generate + if [ "${mode}" = "cross" ]; then build_cross elif [ "${mode}" = "build" ]; then -- cgit v1.2.3