summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorMarvin Borner2021-07-05 13:37:42 +0200
committerMarvin Borner2021-07-05 13:37:42 +0200
commita6858f40888338608fede867d279831e98ec0766 (patch)
tree8abc54c50680fe897349ba5d11f9e5bcf22ee13e
parent832a5046b42f53f7ab329942a862e1b4c0a6f6db (diff)
Better dev environment
-rw-r--r--.gitignore3
-rw-r--r--makefile4
-rwxr-xr-xrun15
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