Debian Codegraph @

Makefile

raw
1 VERSION=$(shell grep "var Version" shared/version/version.go | cut -d'"' -f2)
2 ARCHIVE=distrobuilder-$(VERSION).tar
3 GO111MODULE=on
4 SPHINXENV=.sphinx/venv/bin/activate
5 GOPATH=$(shell go env GOPATH)
6 export GOFLAGS=-tags=containers_image_storage_stub,containers_image_docker_daemon_stub,containers_image_openpgp
7
8 .PHONY: default
9 default:
10 gofmt -s -w .
11 go install -v ./...
12 @echo "distrobuilder built successfully"
13
14 .PHONY: update-gomod
15 update-gomod:
16 go get -t -v -u ./...
17 go mod tidy --go=1.25.6
18 go get toolchain@none
19 @echo "Dependencies updated"
20
21 .PHONY: check
22 check: default
23 sudo GOENV=$(shell go env GOENV) GOFLAGS=$(GOFLAGS) go test -v ./...
24
25 .PHONY: dist
26 dist:
27 # Cleanup
28 rm -Rf $(ARCHIVE).gz
29
30 # Create build dir
31 $(eval TMP := $(shell mktemp -d))
32 git archive --prefix=distrobuilder-$(VERSION)/ HEAD | tar -x -C $(TMP)
33 mkdir -p $(TMP)/_dist/src/github.com/lxc
34 ln -s ../../../../distrobuilder-$(VERSION) $(TMP)/_dist/src/github.com/lxc/distrobuilder
35
36 # Download dependencies
37 cd $(TMP)/distrobuilder-$(VERSION) && go mod vendor
38
39 # Assemble tarball
40 tar --exclude-vcs -C $(TMP) -zcf $(ARCHIVE).gz distrobuilder-$(VERSION)/
41
42 # Cleanup
43 rm -Rf $(TMP)
44
45 .PHONY: doc-setup
46 doc-setup:
47 @echo "Setting up documentation build environment"
48 python3 -m venv .sphinx/venv
49 . $(SPHINXENV) ; pip install --upgrade -r .sphinx/requirements.txt
50 mkdir -p .sphinx/deps/ .sphinx/themes/
51 wget -N -P .sphinx/_static/download https://linuxcontainers.org/static/img/favicon.ico https://linuxcontainers.org/static/img/containers.png https://linuxcontainers.org/static/img/containers.small.png
52 rm -Rf doc/html
53
54 .PHONY: doc
55 doc: doc-setup doc-incremental
56
57 .PHONY: doc-incremental
58 doc-incremental:
59 @echo "Build the documentation"
60 . $(SPHINXENV) ; sphinx-build -c .sphinx/ -b dirhtml doc/ doc/html/ -w .sphinx/warnings.txt
61
62 .PHONY: doc-serve
63 doc-serve:
64 cd doc/html; python3 -m http.server 8001
65
66 .PHONY: doc-spellcheck
67 doc-spellcheck: doc
68 . $(SPHINXENV) ; python3 -m pyspelling -c .sphinx/.spellcheck.yaml
69
70 .PHONY: doc-linkcheck
71 doc-linkcheck: doc-setup
72 . $(SPHINXENV) ; sphinx-build -c .sphinx/ -b linkcheck doc/ doc/html/
73
74 .PHONY: doc-lint
75 doc-lint:
76 .sphinx/.markdownlint/doc-lint.sh
77
78 .PHONY: static-analysis
79 static-analysis:
80 ifeq ($(shell command -v golangci-lint),)
81 curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(GOPATH)/bin
82 endif
83 ifeq ($(shell command -v codespell),)
84 echo "Please install codespell"
85 exit 1
86 endif
87 $(GOPATH)/bin/golangci-lint run --timeout 5m
88 run-parts $(shell run-parts -V 2> /dev/null 1> /dev/null && echo -n "--exit-on-error --regex '.sh'") test/lint