summaryrefslogtreecommitdiff
path: root/Makefile
blob: 6ae28e5073dedf58dd813c718c5a7e97edafd78b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
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)

generate/files += lib9p/include/lib9p/linux-errno.h
lib9p/include/lib9p/linux-errno.h: %: %.gen 3rd-party/linux-errno.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
	./$^

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
	./$^

################################################################################

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)
format:
	black $(sources_py)
	isort $(sources_py)
.PHONY: lint format