diff options
author | Marvin Borner | 2021-07-05 13:37:42 +0200 |
---|---|---|
committer | Marvin Borner | 2021-07-05 13:37:42 +0200 |
commit | a6858f40888338608fede867d279831e98ec0766 (patch) | |
tree | 8abc54c50680fe897349ba5d11f9e5bcf22ee13e | |
parent | 832a5046b42f53f7ab329942a862e1b4c0a6f6db (diff) |
Better dev environment
-rw-r--r-- | .gitignore | 3 | ||||
-rw-r--r-- | makefile | 4 | ||||
-rwxr-xr-x | run | 15 |
3 files changed, 20 insertions, 2 deletions
@@ -1,6 +1,9 @@ cross/ build/ +compile_commands.json +tags + *.o *.bin *.img @@ -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)) @@ -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 |