diff options
| author | Kimplul <kimi.h.kuparinen@gmail.com> | 2023-04-30 17:19:18 +0300 |
|---|---|---|
| committer | Kimplul <kimi.h.kuparinen@gmail.com> | 2023-04-30 17:19:18 +0300 |
| commit | c229680ada76ee98f424980cc6a41dc86b2632d0 (patch) | |
| tree | 65769396f51fdbd1e1dcb0c205a8564c8e4c4989 | |
| parent | 191eaea25cf569ad9c5fb12b8755ae6400750e58 (diff) | |
| download | gran-c229680ada76ee98f424980cc6a41dc86b2632d0.tar.gz gran-c229680ada76ee98f424980cc6a41dc86b2632d0.zip | |
add linting
| -rw-r--r-- | Makefile | 6 | ||||
| -rwxr-xr-x | scripts/gen-deps | 5 |
2 files changed, 11 insertions, 0 deletions
@@ -3,6 +3,7 @@ DO != echo -n > deps.mk DEBUGFLAGS != [ $(RELEASE) ] && echo "-flto=auto -O2 -g -DNODEBUG" || echo "-O0 -g -DDEBUG" CFLAGS = -Wall -Wextra -fopenmp DEPFLAGS = -MT $@ -MMD -MP -MF $@.d +LINTFLAGS = -fsyntax-only INCLUDEFLAGS = -Iinclude COMPILEFLAGS = LINKFLAGS = @@ -22,12 +23,17 @@ include src/source.mk COMPILE = $(CROSS_COMPILE)$(CC) $(DEBUGFLAGS)\ $(CFLAGS) $(DEPFLAGS) $(COMPILEFLAGS) $(INCLUDEFLAGS) +LINT = $(COMPILE) $(LINTFLAGS) + OBJS != ./scripts/gen-deps --sources "$(SOURCES)" MAIN_OBJ != ./scripts/gen-deps --sources "$(MAIN_SRC)" include tests/source.mk include deps.mk +.PHONY: lint +lint: $(OBJS:.o=.o.l) + .PHONY: format format: @cd src; find . -iname '*.[ch]' |\ diff --git a/scripts/gen-deps b/scripts/gen-deps index befd25d..0feed7e 100755 --- a/scripts/gen-deps +++ b/scripts/gen-deps @@ -1,17 +1,22 @@ #!/bin/sh gencommon () { + lint="build/${s%.*}${1}.l" dep="build/${s%.*}${1}.d" obj="build/${s%.*}${1}" echo "${dep}:" >> deps.mk echo "include ${dep}" >> deps.mk + echo "${obj}: ${s}" >> deps.mk } genobjs () { gencommon ".o" echo "${obj}: ${s}" >> deps.mk echo " \$(COMPILE) -c $< -o \$@" >> deps.mk + + echo "${lint}: ${s}" >> deps.mk + echo " \$(LINT) -c ${s} -o /dev/null" >> deps.mk } case "${1}" in |
