summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile30
1 files changed, 27 insertions, 3 deletions
diff --git a/Makefile b/Makefile
index 57583ae..fd80695 100644
--- a/Makefile
+++ b/Makefile
@@ -1,12 +1,36 @@
CFLAGS += -fno-split-stack
CFLAGS += -Wall -Wextra -Werror
CFLAGS += -g -O0
+CPPFLAGS += -I.
LDFLAGS += -static
-srv9p: srv9p.o coroutine.o net9p.o
+linux.git = $(HOME)/src/github.com/torvalds/linux
-net9p_defs.h net9p_defs.c: net9p_defs.gen net9p_defs.txt
- ./$<
+3rd-party/linux-errno.txt:
+ { \
+ cd $(linux.git) && \
+ echo "# Generated from linux.git $$(git describe). DO NOT EDIT!" && \
+ git ls-files include/uapi/ | grep errno | xargs grep -E '#\s*define\s+E[A-Z0-9]+\s+[0-9]+' | awk '{print $$3, $$2}' | sort --numeric-sort && \
+ :; } >$@
+
+9p/linux-errno.h: %: %.gen 3rd-party/linux-errno.txt
+ $^ >$@
+9p/%.c 9p/%.h: 9p/generate 9p/%.txt
+ $^
+
+srv9p: srv9p.o coroutine.o net9p.o 9p/9P2000.o
+
+sources_py = 9p/generate
+sources_py += 9p/linux-errno.h.gen
+
+lint:
+ mypy --strict --scripts-are-modules $(sources_py)
+ black --check $(sources_py)
+ isort --check $(sources_py)
+format:
+ black $(sources_py)
+ isort $(sources_py)
+.PHONY: lint format
.NOTINTERMEDIATE:
.DELETE_ON_ERROR: