summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordzwdz2021-09-11 16:47:27 +0200
committerdzwdz2021-09-11 16:47:27 +0200
commit7f77fabf2e5acf94cd8573a18d6aed468bdf887e (patch)
tree4ea604832487b9ed08257c90d9b4682e8b7811aa
parent80b2c1c2ab36b4ddb030e135bcacf1f30db362d2 (diff)
add support for `sparse`
-rw-r--r--Makefile8
1 files changed, 7 insertions, 1 deletions
diff --git a/Makefile b/Makefile
index 58a3550..5dd7ed0 100644
--- a/Makefile
+++ b/Makefile
@@ -2,6 +2,7 @@ PATH := $(shell pwd)/toolchain/bin/:$(PATH)
AS = i686-elf-as
CC = i686-elf-gcc
+CHECK = sparse
CFLAGS = -std=gnu99 -ffreestanding -O2 -Wall -Wextra -Wold-style-definition
CFLAGS += -mgeneral-regs-only
CFLAGS += -Isrc/
@@ -13,6 +14,8 @@ define from_sources
$(patsubst src/%.c,out/obj/%.c.o,$(shell find $(1) -type f -name '*.c'))
endef
+.PHONY: all
+all: out/boot.iso check
out/boot.iso: out/fs/boot/kernel.bin out/fs/boot/grub/grub.cfg out/fs/boot/init
@grub-mkrescue -o $@ out/fs/ > /dev/null 2>&1
@@ -40,7 +43,7 @@ out/obj/%.c.o: src/%.c
@$(CC) $(CFLAGS) -c $^ -o $@
-.PHONY: boot debug lint clean
+.PHONY: boot debug lint check clean
boot: out/boot.iso
qemu-system-i386 -cdrom $< $(QFLAGS) -no-shutdown
@@ -52,5 +55,8 @@ debug: out/boot.iso
lint:
@tools/linter/main.rb
+check: $(shell find src/kernel/ -type f -name *.c)
+ @echo $^ | xargs -n 1 sparse $(CFLAGS) -Wno-non-pointer-null -Wno-decl
+
clean:
rm -rv out/