From d54ddec236bf9bdb8c032cd5fbdb0aa46ffebe86 Mon Sep 17 00:00:00 2001 From: "Luke T. Shumaker" Date: Fri, 27 Sep 2024 19:00:18 -0600 Subject: use GNU Make for `generate` --- Makefile | 59 +++++++++++++++++++++++++++++++++++++++++------------------ 1 file changed, 41 insertions(+), 18 deletions(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index c364472..6ae28e5 100644 --- a/Makefile +++ b/Makefile @@ -1,26 +1,52 @@ -CFLAGS += -fno-split-stack -CFLAGS += -Wall -Wextra -Werror -CFLAGS += -g -O0 -CPPFLAGS += -I. -LDFLAGS += -static - linux.git = $(HOME)/src/github.com/torvalds/linux +all: build +.PHONY: all + +.NOTINTERMEDIATE: +.DELETE_ON_ERROR: + +################################################################################ + +generate/files = + +generate/files += 3rd-party/linux-errno.txt 3rd-party/linux-errno.txt: %: %.gen - $< $(linux.git) + ./$< $(linux.git) + +generate/files += lib9p/include/lib9p/linux-errno.h +lib9p/include/lib9p/linux-errno.h: %: %.gen 3rd-party/linux-errno.txt + ./$^ >$@ -9p/linux-errno.h: %: %.gen 3rd-party/linux-errno.txt - $^ >$@ -9p/defs-%.c 9p/defs-%.h: 9p/defs.gen 9p/%.txt - $^ +generate/files += lib9p/types.c lib9p/include/lib9p/_types.h +lib9p/types.c lib9p/include/lib9p/_types.h &: lib9p/types.gen lib9p/9P2000.txt lib9p/9P2000.u.txt lib9p/9P2000.e.txt + ./$^ -lib9p = 9p/defs.o 9p/defs-9P2000.o 9p/srv.o -srv9p: srv9p.o coroutine.o netio_posix.o $(lib9p) +generate/files += libusb/include/libusb/tusb_helpers.h 3rd-party/MS-LCID.pdf 3rd-party/MS-LCID.txt +libusb/include/libusb/tusb_helpers.h 3rd-party/MS-LCID.pdf 3rd-party/MS-LCID.txt &: libusb/include/libusb/tusb_helpers.h.gen + ./$^ -sources_py = 9p/defs.gen -sources_py += 9p/linux-errno.h.gen +################################################################################ +build: build/Makefile $(generate/files) +.PHONY: build + +build/Makefile: + mkdir -p build && cd build && cmake .. + +generate: $(generate/files) +.PHONY: generate + +generate-clean: + rm -f -- $(generate/files) +.PHONY: generate-clean + +sources_sh = 3rd-party/linux-errno.txt.gen +sources_sh += libusb/include/libusb/tusb_helpers.h.gen +sources_py = lib9p/types.gen +sources_py += lib9p/include/lib9p/linux-errno.h.gen lint: + shellcheck $(sources_sh) mypy --strict --scripts-are-modules $(sources_py) black --check $(sources_py) isort --check $(sources_py) @@ -28,6 +54,3 @@ format: black $(sources_py) isort $(sources_py) .PHONY: lint format - -.NOTINTERMEDIATE: -.DELETE_ON_ERROR: -- cgit v1.2.3-2-g168b