aboutsummaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorKimplul <kimi.h.kuparinen@gmail.com>2022-01-06 18:14:30 +0200
committerKimplul <kimi.h.kuparinen@gmail.com>2022-01-06 18:15:03 +0200
commitf0eba93472e0afecc57180fc0d638eeef8e6f3c6 (patch)
tree13fe81d4dda80e6917f924bb94f47651eccd5a92 /Makefile
parent513a8d20beeacb3a7fc2c3c140d014f7fb25cd6f (diff)
downloadkmi-f0eba93472e0afecc57180fc0d638eeef8e6f3c6.tar.gz
kmi-f0eba93472e0afecc57180fc0d638eeef8e6f3c6.zip
Added lint rule to Makefile
+ Runs a syntax check on all files of the selected arch
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile6
1 files changed, 6 insertions, 0 deletions
diff --git a/Makefile b/Makefile
index adcb405..2bcef0f 100644
--- a/Makefile
+++ b/Makefile
@@ -3,6 +3,7 @@ DO != echo > deps.mk
# this could be done better
DEBUGFLAGS != [ $(RELEASE) ] && echo "-flto -O2" || echo "-O0 -ggdb3 -DDEBUG"
CFLAGS = -fno-pie -ffreestanding -nostdlib -std=c17 -Wall -Wextra
+LINTFLAGS = -fsyntax-only
DEPFLAGS = -MT $@ -MMD -MP -MF $@.d
all: apos.bin
@@ -33,6 +34,9 @@ INCLUDE_FLAGS := -I include -I arch/$(ARCH)/include\
COMPILE = $(CROSS_COMPILE)$(CC) $(DEBUGFLAGS)\
$(CFLAGS) $(ARCH_FLAGS) $(DEPFLAGS) $(INCLUDE_FLAGS)
+LINT = $(CROSS_COMPILE)$(CC) $(DEBUGFLAGS)\
+ $(CFLAGS) $(ARCH_FLAGS) $(LINTFLAGS) $(INCLUDE_FLAGS)
+
GENELF = $(CROSS_COMPILE)$(CC) $(DEBUGFLAGS)\
$(CFLAGS) $(ARCH_FLAGS) $(INCLUDE_FLAGS)
@@ -53,6 +57,8 @@ include deps.mk
$(INIT_LD): kernel.bin
+lint: $(INIT_OBJECTS:.o=.o.l) $(KERNEL_OBJECTS:.o=.o.l)
+
init.elf: $(INIT_OBJECTS) $(INIT_LD)
$(GENELF) -T $(INIT_LD) $(INIT_OBJECTS) -o $@