diff options
| author | Kimplul <kimi.h.kuparinen@gmail.com> | 2022-01-06 18:14:30 +0200 |
|---|---|---|
| committer | Kimplul <kimi.h.kuparinen@gmail.com> | 2022-01-06 18:15:03 +0200 |
| commit | f0eba93472e0afecc57180fc0d638eeef8e6f3c6 (patch) | |
| tree | 13fe81d4dda80e6917f924bb94f47651eccd5a92 | |
| parent | 513a8d20beeacb3a7fc2c3c140d014f7fb25cd6f (diff) | |
| download | kmi-f0eba93472e0afecc57180fc0d638eeef8e6f3c6.tar.gz kmi-f0eba93472e0afecc57180fc0d638eeef8e6f3c6.zip | |
Added lint rule to Makefile
+ Runs a syntax check on all files of the selected arch
| -rw-r--r-- | Makefile | 6 | ||||
| -rwxr-xr-x | scripts/gen-deps | 5 | ||||
| -rwxr-xr-x | scripts/gen-padding | 9 |
3 files changed, 10 insertions, 10 deletions
@@ -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 $@ diff --git a/scripts/gen-deps b/scripts/gen-deps index ee64022..bdc1626 100755 --- a/scripts/gen-deps +++ b/scripts/gen-deps @@ -1,6 +1,7 @@ #!/bin/sh gencommon () { + lint="build/${s%.*}${1}.l" dep="build/${s%.*}${1}.d" obj="build/${s%.*}${1}" @@ -9,7 +10,6 @@ gencommon () { echo "${dep}:" >> deps.mk echo "include ${dep}" >> deps.mk echo "${obj}: ${s}" >> deps.mk - } genlink () { @@ -21,6 +21,9 @@ genlink () { genrule () { gencommon "${1}" echo " \$(COMPILE) -c \$< -o \$@" >> deps.mk + + echo "${lint}: ${s}" >> deps.mk + echo " \$(LINT) -c \$<" >> deps.mk } case "${1}" in diff --git a/scripts/gen-padding b/scripts/gen-padding deleted file mode 100755 index 22c12f9..0000000 --- a/scripts/gen-padding +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/sh - -align="$1" -filename="$2" - -filesize=$(stat -c "%s" "${filename}") -padsize=$(echo "${filesize}" | awk "{print ${align} - (\$1 % ${align})}") - -dd if=/dev/zero ibs=1 count="${padsize}" >> "${filename}" |
