2023-08-09 14:08:39 +02:00
|
|
|
GO ?= go
|
2023-08-09 22:36:53 -04:00
|
|
|
DOMAIN=incus
|
2015-03-05 12:46:31 -05:00
|
|
|
POFILES=$(wildcard po/*.po)
|
|
|
|
|
MOFILES=$(patsubst %.po,%.mo,$(POFILES))
|
|
|
|
|
LINGUAS=$(basename $(POFILES))
|
|
|
|
|
POTFILE=po/$(DOMAIN).pot
|
2023-08-30 15:56:41 +02:00
|
|
|
VERSION=$(or ${CUSTOM_VERSION},$(shell grep "var Version" internal/version/flex.go | cut -d'"' -f2))
|
2023-08-01 07:26:41 +10:00
|
|
|
ARCHIVE=incus-$(VERSION).tar
|
2020-02-17 14:08:53 +02:00
|
|
|
HASH := \#
|
2023-08-10 23:13:02 +01:00
|
|
|
TAG_SQLITE3=$(shell printf "$(HASH)include <cowsql.h>\nvoid main(){cowsql_node_id n = 1;}" | $(CC) ${CGO_CFLAGS} -o /dev/null -xc - >/dev/null 2>&1 && echo "libsqlite3")
|
2023-08-09 14:08:39 +02:00
|
|
|
GOPATH ?= $(shell $(GO) env GOPATH)
|
2021-06-27 22:07:19 -04:00
|
|
|
CGO_LDFLAGS_ALLOW ?= (-Wl,-wrap,pthread_create)|(-Wl,-z,now)
|
2023-06-15 18:01:36 +02:00
|
|
|
SPHINXENV=doc/.sphinx/venv/bin/activate
|
2023-09-25 18:29:54 +02:00
|
|
|
SPHINXPIPPATH=doc/.sphinx/venv/bin/pip
|
2015-03-05 12:46:31 -05:00
|
|
|
|
2021-08-23 17:55:20 -04:00
|
|
|
ifneq "$(wildcard vendor)" ""
|
|
|
|
|
RAFT_PATH=$(CURDIR)/vendor/raft
|
2023-08-10 23:13:02 +01:00
|
|
|
COWSQL_PATH=$(CURDIR)/vendor/cowsql
|
2021-08-23 17:55:20 -04:00
|
|
|
else
|
|
|
|
|
RAFT_PATH=$(GOPATH)/deps/raft
|
2023-08-10 23:13:02 +01:00
|
|
|
COWSQL_PATH=$(GOPATH)/deps/cowsql
|
2021-08-23 17:55:20 -04:00
|
|
|
endif
|
2021-06-07 09:39:40 -04:00
|
|
|
|
2021-08-23 17:55:20 -04:00
|
|
|
# raft
|
|
|
|
|
.PHONY: default
|
|
|
|
|
default: build
|
2021-06-07 09:39:40 -04:00
|
|
|
|
|
|
|
|
.PHONY: build
|
|
|
|
|
build:
|
2021-08-24 17:20:54 -04:00
|
|
|
ifeq "$(TAG_SQLITE3)" ""
|
2023-08-10 23:13:02 +01:00
|
|
|
@echo "Missing cowsql, run \"make deps\" to setup."
|
2018-08-01 12:53:12 -04:00
|
|
|
exit 1
|
|
|
|
|
endif
|
|
|
|
|
|
2023-08-09 14:08:39 +02:00
|
|
|
CC="$(CC)" CGO_LDFLAGS_ALLOW="$(CGO_LDFLAGS_ALLOW)" $(GO) install -v -tags "$(TAG_SQLITE3)" $(DEBUG) ./...
|
|
|
|
|
CGO_ENABLED=0 $(GO) install -v -tags netgo ./cmd/incus-migrate
|
|
|
|
|
CGO_ENABLED=0 $(GO) install -v -tags agent,netgo ./cmd/incus-agent
|
2023-09-09 13:46:47 -04:00
|
|
|
cd cmd/lxd-to-incus && CC="$(CC)" CGO_LDFLAGS_ALLOW="$(CGO_LDFLAGS_ALLOW)" $(GO) install -v ./
|
2023-08-01 07:26:41 +10:00
|
|
|
@echo "Incus built successfully"
|
2014-11-07 03:58:32 -06:00
|
|
|
|
2015-08-03 10:56:47 -04:00
|
|
|
.PHONY: client
|
2015-08-03 10:25:35 -04:00
|
|
|
client:
|
2023-08-09 22:36:53 -04:00
|
|
|
$(GO) install -v -tags "$(TAG_SQLITE3)" $(DEBUG) ./cmd/incus
|
2023-08-01 07:26:41 +10:00
|
|
|
@echo "Incus client built successfully"
|
2015-08-03 10:25:35 -04:00
|
|
|
|
2023-08-01 07:26:41 +10:00
|
|
|
.PHONY: incus-agent
|
|
|
|
|
incus-agent:
|
2023-08-09 14:08:39 +02:00
|
|
|
CGO_ENABLED=0 $(GO) install -v -tags agent,netgo ./cmd/incus-agent
|
2023-08-01 07:26:41 +10:00
|
|
|
@echo "Incus agent built successfully"
|
2019-11-08 16:58:37 -05:00
|
|
|
|
2023-08-01 07:26:41 +10:00
|
|
|
.PHONY: incus-migrate
|
|
|
|
|
incus-migrate:
|
2023-08-09 14:08:39 +02:00
|
|
|
CGO_ENABLED=0 $(GO) install -v -tags netgo ./cmd/incus-migrate
|
2023-08-01 07:26:41 +10:00
|
|
|
@echo "Incus migration tool built successfully"
|
2018-10-04 12:58:05 -04:00
|
|
|
|
2018-08-01 13:31:30 -04:00
|
|
|
.PHONY: deps
|
|
|
|
|
deps:
|
2021-08-23 17:55:20 -04:00
|
|
|
@if [ ! -e "$(RAFT_PATH)" ]; then \
|
2023-08-16 00:11:19 -04:00
|
|
|
git clone --depth=1 "https://github.com/cowsql/raft" "$(RAFT_PATH)"; \
|
2021-08-23 17:55:20 -04:00
|
|
|
elif [ -e "$(RAFT_PATH)/.git" ]; then \
|
|
|
|
|
cd "$(RAFT_PATH)"; git pull; \
|
2019-06-24 10:31:19 +02:00
|
|
|
fi
|
|
|
|
|
|
2021-08-23 17:55:20 -04:00
|
|
|
cd "$(RAFT_PATH)" && \
|
2019-06-24 10:31:19 +02:00
|
|
|
autoreconf -i && \
|
|
|
|
|
./configure && \
|
|
|
|
|
make
|
|
|
|
|
|
2023-08-10 23:13:02 +01:00
|
|
|
# cowsql
|
|
|
|
|
@if [ ! -e "$(COWSQL_PATH)" ]; then \
|
|
|
|
|
git clone --depth=1 "https://github.com/cowsql/cowsql" "$(COWSQL_PATH)"; \
|
|
|
|
|
elif [ -e "$(COWSQL_PATH)/.git" ]; then \
|
|
|
|
|
cd "$(COWSQL_PATH)"; git pull; \
|
2018-08-01 13:31:30 -04:00
|
|
|
fi
|
|
|
|
|
|
2023-08-10 23:13:02 +01:00
|
|
|
cd "$(COWSQL_PATH)" && \
|
2018-08-01 13:31:30 -04:00
|
|
|
autoreconf -i && \
|
2021-08-23 17:55:20 -04:00
|
|
|
PKG_CONFIG_PATH="$(RAFT_PATH)" ./configure && \
|
|
|
|
|
make CFLAGS="-I$(RAFT_PATH)/include/" LDFLAGS="-L$(RAFT_PATH)/.libs/"
|
2018-08-01 13:31:30 -04:00
|
|
|
|
|
|
|
|
# environment
|
|
|
|
|
@echo ""
|
|
|
|
|
@echo "Please set the following in your environment (possibly ~/.bashrc)"
|
2023-08-10 23:13:02 +01:00
|
|
|
@echo "export CGO_CFLAGS=\"-I$(RAFT_PATH)/include/ -I$(COWSQL_PATH)/include/\""
|
|
|
|
|
@echo "export CGO_LDFLAGS=\"-L$(RAFT_PATH)/.libs -L$(COWSQL_PATH)/.libs/\""
|
|
|
|
|
@echo "export LD_LIBRARY_PATH=\"$(RAFT_PATH)/.libs/:$(COWSQL_PATH)/.libs/\""
|
2021-06-23 18:29:52 +02:00
|
|
|
@echo "export CGO_LDFLAGS_ALLOW=\"(-Wl,-wrap,pthread_create)|(-Wl,-z,now)\""
|
2020-01-19 00:13:13 +01:00
|
|
|
|
2023-08-30 01:19:08 -04:00
|
|
|
.PHONY: update-gomod
|
|
|
|
|
update-gomod:
|
2023-08-01 07:26:41 +10:00
|
|
|
ifneq "$(INCUS_OFFLINE)" ""
|
2023-08-30 01:19:08 -04:00
|
|
|
@echo "The update-gomod target cannot be run in offline mode."
|
2021-08-24 17:21:35 -04:00
|
|
|
exit 1
|
|
|
|
|
endif
|
2023-08-09 14:08:39 +02:00
|
|
|
$(GO) get -t -v -d -u ./...
|
2023-10-02 12:15:47 -04:00
|
|
|
go get github.com/mdlayher/socket@v0.4.1
|
2023-10-27 11:19:10 -04:00
|
|
|
go get github.com/openfga/go-sdk@v0.2.2
|
2023-10-02 12:15:47 -04:00
|
|
|
$(GO) mod tidy --go=1.20
|
2023-11-17 11:38:27 -05:00
|
|
|
$(GO) get toolchain@none
|
2023-10-02 12:15:47 -04:00
|
|
|
|
2023-09-06 18:30:54 -04:00
|
|
|
cd cmd/lxd-to-incus && $(GO) get -t -v -d -u ./...
|
2023-10-02 12:15:47 -04:00
|
|
|
cd cmd/lxd-to-incus && $(GO) mod tidy --go=1.20
|
2023-10-31 01:14:47 -04:00
|
|
|
|
|
|
|
|
cd test/mini-oidc && $(GO) get -t -v -d -u ./...
|
|
|
|
|
cd test/mini-oidc && $(GO) mod tidy --go=1.20
|
2015-12-20 22:15:21 -05:00
|
|
|
@echo "Dependencies updated"
|
|
|
|
|
|
2018-08-01 12:25:54 -04:00
|
|
|
.PHONY: update-protobuf
|
|
|
|
|
update-protobuf:
|
2023-09-29 22:25:33 -04:00
|
|
|
protoc --go_out=. ./internal/migration/migrate.proto
|
2018-08-01 12:25:54 -04:00
|
|
|
|
2018-08-01 12:24:56 -04:00
|
|
|
.PHONY: update-schema
|
2019-09-04 14:38:19 -04:00
|
|
|
update-schema:
|
2023-09-29 23:03:41 -04:00
|
|
|
cd internal/server/db/generate && $(GO) build -o $(GOPATH)/bin/incus-generate -tags "$(TAG_SQLITE3)" $(DEBUG) && cd -
|
2023-08-09 14:08:39 +02:00
|
|
|
$(GO) generate ./...
|
2023-09-29 23:03:41 -04:00
|
|
|
gofmt -s -w ./internal/server/db/
|
|
|
|
|
goimports -w ./internal/server/db/
|
2018-09-05 09:29:07 +02:00
|
|
|
@echo "Code generation completed"
|
2017-08-25 08:08:45 +00:00
|
|
|
|
2021-02-16 18:16:03 -05:00
|
|
|
.PHONY: update-api
|
|
|
|
|
update-api:
|
2023-08-01 07:26:41 +10:00
|
|
|
ifeq "$(INCUS_OFFLINE)" ""
|
2023-08-09 14:08:39 +02:00
|
|
|
(cd / ; $(GO) install -v -x github.com/go-swagger/go-swagger/cmd/swagger@latest)
|
2021-08-24 17:21:35 -04:00
|
|
|
endif
|
2023-09-29 23:03:41 -04:00
|
|
|
swagger generate spec -o doc/rest-api.yaml -w ./cmd/incusd -m
|
2021-02-16 18:16:03 -05:00
|
|
|
|
2023-07-23 17:27:33 +02:00
|
|
|
.PHONY: update-metadata
|
|
|
|
|
update-metadata: build
|
|
|
|
|
@echo "Generating golang documentation metadata"
|
|
|
|
|
cd internal/server/config/generate && CGO_ENABLED=0 go build -o $(GOPATH)/bin/incus-doc
|
|
|
|
|
$(GOPATH)/bin/incus-doc . --json ./internal/server/metadata/configuration.json --txt ./doc/config_options.txt
|
|
|
|
|
|
2022-09-21 18:03:34 +02:00
|
|
|
.PHONY: doc-setup
|
2023-08-21 14:23:28 +02:00
|
|
|
doc-setup: client
|
2021-11-23 20:03:52 -05:00
|
|
|
@echo "Setting up documentation build environment"
|
2023-06-15 18:01:36 +02:00
|
|
|
python3 -m venv doc/.sphinx/venv
|
2023-09-19 15:53:11 +02:00
|
|
|
. $(SPHINXENV) ; pip install --require-virtualenv --upgrade -r doc/.sphinx/requirements.txt --log doc/.sphinx/venv/pip_install.log
|
|
|
|
|
@test ! -f doc/.sphinx/venv/pip_list.txt || \
|
|
|
|
|
mv doc/.sphinx/venv/pip_list.txt doc/.sphinx/venv/pip_list.txt.bak
|
2023-09-25 18:29:54 +02:00
|
|
|
$(SPHINXPIPPATH) list --local --format=freeze > doc/.sphinx/venv/pip_list.txt
|
2023-08-21 14:23:28 +02:00
|
|
|
find doc/reference/manpages/ -name "*.md" -type f -delete
|
2021-11-23 20:03:52 -05:00
|
|
|
rm -Rf doc/html
|
2023-09-05 14:00:55 +02:00
|
|
|
rm -Rf doc/.sphinx/.doctrees
|
2022-09-21 18:03:34 +02:00
|
|
|
|
|
|
|
|
.PHONY: doc
|
2023-07-20 10:37:42 +02:00
|
|
|
doc: doc-setup doc-incremental
|
2021-11-23 20:03:52 -05:00
|
|
|
|
|
|
|
|
.PHONY: doc-incremental
|
|
|
|
|
doc-incremental:
|
|
|
|
|
@echo "Build the documentation"
|
2023-10-07 11:13:57 -04:00
|
|
|
. $(SPHINXENV) ; sphinx-build -c doc/ -b dirhtml doc/ doc/html/ -d doc/.sphinx/.doctrees -w doc/.sphinx/warnings.txt
|
2021-11-23 20:03:52 -05:00
|
|
|
|
2022-01-26 11:27:23 +01:00
|
|
|
.PHONY: doc-serve
|
|
|
|
|
doc-serve:
|
|
|
|
|
cd doc/html; python3 -m http.server 8001
|
|
|
|
|
|
2022-07-12 15:39:49 +02:00
|
|
|
.PHONY: doc-spellcheck
|
|
|
|
|
doc-spellcheck: doc
|
2023-09-19 15:53:11 +02:00
|
|
|
. $(SPHINXENV) ; python3 -m pyspelling -c doc/.sphinx/spellingcheck.yaml
|
2022-07-12 15:39:49 +02:00
|
|
|
|
2022-09-21 18:05:42 +02:00
|
|
|
.PHONY: doc-linkcheck
|
|
|
|
|
doc-linkcheck: doc-setup
|
2023-09-05 14:00:55 +02:00
|
|
|
. $(SPHINXENV) ; LOCAL_SPHINX_BUILD=True sphinx-build -c doc/ -b linkcheck doc/ doc/html/ -d doc/.sphinx/.doctrees
|
2022-09-21 18:05:42 +02:00
|
|
|
|
2022-08-24 15:06:52 +02:00
|
|
|
.PHONY: doc-lint
|
|
|
|
|
doc-lint:
|
2023-06-15 18:01:36 +02:00
|
|
|
doc/.sphinx/.markdownlint/doc-lint.sh
|
2022-08-24 15:06:52 +02:00
|
|
|
|
2023-09-19 15:53:11 +02:00
|
|
|
.PHONY: woke-install
|
|
|
|
|
woke-install:
|
|
|
|
|
@type woke >/dev/null 2>&1 || \
|
|
|
|
|
{ echo "Installing \"woke\" snap... \n"; sudo snap install woke; }
|
|
|
|
|
|
2023-08-25 17:07:34 +02:00
|
|
|
.PHONY: doc-woke
|
2023-09-19 15:53:11 +02:00
|
|
|
doc-woke: woke-install
|
2023-08-25 17:07:34 +02:00
|
|
|
woke *.md **/*.md -c https://github.com/canonical/Inclusive-naming/raw/main/config.yml
|
|
|
|
|
|
2017-03-24 01:46:59 +01:00
|
|
|
.PHONY: debug
|
|
|
|
|
debug:
|
2021-08-24 17:20:54 -04:00
|
|
|
ifeq "$(TAG_SQLITE3)" ""
|
2018-08-01 12:53:12 -04:00
|
|
|
@echo "Missing custom libsqlite3, run \"make deps\" to setup."
|
|
|
|
|
exit 1
|
|
|
|
|
endif
|
|
|
|
|
|
2023-08-09 14:08:39 +02:00
|
|
|
CC="$(CC)" CGO_LDFLAGS_ALLOW="$(CGO_LDFLAGS_ALLOW)" $(GO) install -v -tags "$(TAG_SQLITE3) logdebug" $(DEBUG) ./...
|
|
|
|
|
CGO_ENABLED=0 $(GO) install -v -tags "netgo,logdebug" ./cmd/incus-migrate
|
|
|
|
|
CGO_ENABLED=0 $(GO) install -v -tags "agent,netgo,logdebug" ./cmd/incus-agent
|
2023-08-01 07:26:41 +10:00
|
|
|
@echo "Incus built successfully"
|
2017-03-24 01:46:59 +01:00
|
|
|
|
2019-10-21 20:58:55 +02:00
|
|
|
.PHONY: nocache
|
|
|
|
|
nocache:
|
2021-08-24 17:20:54 -04:00
|
|
|
ifeq "$(TAG_SQLITE3)" ""
|
2019-10-21 20:58:55 +02:00
|
|
|
@echo "Missing custom libsqlite3, run \"make deps\" to setup."
|
|
|
|
|
exit 1
|
|
|
|
|
endif
|
|
|
|
|
|
2023-08-09 14:08:39 +02:00
|
|
|
CC="$(CC)" CGO_LDFLAGS_ALLOW="$(CGO_LDFLAGS_ALLOW)" $(GO) install -a -v -tags "$(TAG_SQLITE3)" $(DEBUG) ./...
|
|
|
|
|
CGO_ENABLED=0 $(GO) install -a -v -tags netgo ./cmd/incus-migrate
|
|
|
|
|
CGO_ENABLED=0 $(GO) install -a -v -tags agent,netgo ./cmd/incus-agent
|
2023-08-01 07:26:41 +10:00
|
|
|
@echo "Incus built successfully"
|
2019-10-21 20:58:55 +02:00
|
|
|
|
2020-08-06 15:58:20 +01:00
|
|
|
race:
|
2021-08-24 17:20:54 -04:00
|
|
|
ifeq "$(TAG_SQLITE3)" ""
|
2020-08-06 15:58:20 +01:00
|
|
|
@echo "Missing custom libsqlite3, run \"make deps\" to setup."
|
|
|
|
|
exit 1
|
|
|
|
|
endif
|
|
|
|
|
|
2023-08-09 14:08:39 +02:00
|
|
|
CC="$(CC)" CGO_LDFLAGS_ALLOW="$(CGO_LDFLAGS_ALLOW)" $(GO) install -race -v -tags "$(TAG_SQLITE3)" $(DEBUG) ./...
|
|
|
|
|
CGO_ENABLED=0 $(GO) install -v -tags netgo ./cmd/incus-migrate
|
|
|
|
|
CGO_ENABLED=0 $(GO) install -v -tags agent,netgo ./cmd/incus-agent
|
2023-08-01 07:26:41 +10:00
|
|
|
@echo "Incus built successfully"
|
2020-08-06 15:58:20 +01:00
|
|
|
|
2014-11-07 03:58:32 -06:00
|
|
|
.PHONY: check
|
|
|
|
|
check: default
|
2023-08-01 07:26:41 +10:00
|
|
|
ifeq "$(INCUS_OFFLINE)" ""
|
2023-08-09 14:08:39 +02:00
|
|
|
(cd / ; $(GO) install -v -x github.com/rogpeppe/godeps@latest)
|
|
|
|
|
(cd / ; $(GO) install -v -x github.com/tsenart/deadcode@latest)
|
|
|
|
|
(cd / ; $(GO) install -v -x golang.org/x/lint/golint@latest)
|
2021-08-24 17:21:35 -04:00
|
|
|
endif
|
2023-08-09 14:08:39 +02:00
|
|
|
CGO_LDFLAGS_ALLOW="$(CGO_LDFLAGS_ALLOW)" $(GO) test -v -tags "$(TAG_SQLITE3)" $(DEBUG) ./...
|
2014-11-07 06:07:22 -06:00
|
|
|
cd test && ./main.sh
|
2014-11-07 03:58:32 -06:00
|
|
|
|
2015-01-28 06:54:44 +01:00
|
|
|
.PHONY: dist
|
2022-02-08 11:07:38 +01:00
|
|
|
dist: doc
|
2016-12-16 16:21:49 -05:00
|
|
|
# Cleanup
|
2023-10-18 22:42:45 -04:00
|
|
|
rm -Rf $(ARCHIVE).xz
|
2017-05-30 10:47:11 +02:00
|
|
|
|
2016-12-16 16:21:49 -05:00
|
|
|
# Create build dir
|
2016-09-28 01:27:52 -04:00
|
|
|
$(eval TMP := $(shell mktemp -d))
|
2023-08-01 07:26:41 +10:00
|
|
|
git archive --prefix=incus-$(VERSION)/ HEAD | tar -x -C $(TMP)
|
|
|
|
|
git show-ref HEAD | cut -d' ' -f1 > $(TMP)/incus-$(VERSION)/.gitref
|
2017-05-30 10:47:11 +02:00
|
|
|
|
2016-12-16 16:21:49 -05:00
|
|
|
# Download dependencies
|
2023-08-09 14:08:39 +02:00
|
|
|
(cd $(TMP)/incus-$(VERSION) ; $(GO) mod vendor)
|
2023-10-18 22:42:16 -04:00
|
|
|
(cd $(TMP)/incus-$(VERSION)/cmd/lxd-to-incus ; $(GO) mod vendor)
|
2017-05-30 10:47:11 +02:00
|
|
|
|
2023-08-10 23:13:02 +01:00
|
|
|
# Download the cowsql libraries
|
|
|
|
|
git clone --depth=1 https://github.com/cowsql/cowsql $(TMP)/incus-$(VERSION)/vendor/cowsql
|
|
|
|
|
(cd $(TMP)/incus-$(VERSION)/vendor/cowsql ; git show-ref HEAD | cut -d' ' -f1 > .gitref)
|
2018-02-28 14:56:23 -05:00
|
|
|
|
2023-08-16 00:11:19 -04:00
|
|
|
git clone --depth=1 https://github.com/cowsql/raft $(TMP)/incus-$(VERSION)/vendor/raft
|
2023-08-01 07:26:41 +10:00
|
|
|
(cd $(TMP)/incus-$(VERSION)/vendor/raft ; git show-ref HEAD | cut -d' ' -f1 > .gitref)
|
2018-04-09 12:58:30 +02:00
|
|
|
|
2022-02-08 11:07:38 +01:00
|
|
|
# Copy doc output
|
2023-08-01 07:26:41 +10:00
|
|
|
cp -r doc/html $(TMP)/incus-$(VERSION)/doc/html/
|
2022-02-08 11:07:38 +01:00
|
|
|
|
2016-12-16 16:21:49 -05:00
|
|
|
# Assemble tarball
|
2023-10-18 22:42:45 -04:00
|
|
|
tar --exclude-vcs -C $(TMP) -Jcf $(ARCHIVE).xz incus-$(VERSION)/
|
2017-05-30 10:47:11 +02:00
|
|
|
|
2016-12-16 16:21:49 -05:00
|
|
|
# Cleanup
|
|
|
|
|
rm -Rf $(TMP)
|
2015-01-29 11:28:36 +01:00
|
|
|
|
2021-08-23 17:54:44 -04:00
|
|
|
.PHONY: i18n
|
2017-06-02 01:09:08 -04:00
|
|
|
i18n: update-pot update-po
|
2015-03-05 12:46:31 -05:00
|
|
|
|
|
|
|
|
po/%.mo: po/%.po
|
|
|
|
|
msgfmt --statistics -o $@ $<
|
|
|
|
|
|
|
|
|
|
po/%.po: po/$(DOMAIN).pot
|
|
|
|
|
msgmerge -U po/$*.po po/$(DOMAIN).pot
|
|
|
|
|
|
2021-08-23 17:54:44 -04:00
|
|
|
.PHONY: update-po
|
2015-03-05 12:46:31 -05:00
|
|
|
update-po:
|
2023-06-15 10:46:31 -04:00
|
|
|
set -eu; \
|
2017-02-17 16:02:12 -05:00
|
|
|
for lang in $(LINGUAS); do\
|
2023-06-15 10:49:33 -04:00
|
|
|
msgmerge --backup=none -U $$lang.po po/$(DOMAIN).pot; \
|
2015-03-05 12:46:31 -05:00
|
|
|
done
|
|
|
|
|
|
2021-08-23 17:54:44 -04:00
|
|
|
.PHONY: update-pot
|
2015-03-05 12:46:31 -05:00
|
|
|
update-pot:
|
2023-08-01 07:26:41 +10:00
|
|
|
ifeq "$(INCUS_OFFLINE)" ""
|
2023-08-09 14:08:39 +02:00
|
|
|
(cd / ; $(GO) install -v -x github.com/snapcore/snapd/i18n/xgettext-go@2.57.1)
|
2021-08-24 17:21:35 -04:00
|
|
|
endif
|
2023-09-26 10:41:30 -04:00
|
|
|
xgettext-go -o po/$(DOMAIN).pot --add-comments-tag=TRANSLATORS: --sort-output --package-name=$(DOMAIN) --msgid-bugs-address=lxc-devel@lists.linuxcontainers.org --keyword=i18n.G --keyword-plural=i18n.NG cmd/incus/*.go shared/cliconfig/*.go
|
2015-09-09 15:31:49 -04:00
|
|
|
|
2021-08-23 17:54:44 -04:00
|
|
|
.PHONY: build-mo
|
2015-03-05 12:46:31 -05:00
|
|
|
build-mo: $(MOFILES)
|
2015-05-26 13:38:52 -04:00
|
|
|
|
2021-08-23 17:54:44 -04:00
|
|
|
.PHONY: static-analysis
|
2015-05-26 13:38:52 -04:00
|
|
|
static-analysis:
|
2023-08-10 17:33:11 -04:00
|
|
|
ifeq ($(shell command -v golangci-lint),)
|
2023-08-09 14:08:39 +02:00
|
|
|
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $$($(GO) env GOPATH)/bin
|
2022-06-29 09:56:09 +01:00
|
|
|
endif
|
2023-08-10 17:33:11 -04:00
|
|
|
ifeq ($(shell command -v shellcheck),)
|
2022-06-29 09:56:09 +01:00
|
|
|
echo "Please install shellcheck"
|
|
|
|
|
exit 1
|
2023-09-11 21:44:57 -04:00
|
|
|
else
|
2022-09-08 22:20:09 +01:00
|
|
|
ifneq "$(shell shellcheck --version | grep version: | cut -d ' ' -f2)" "0.8.0"
|
2022-07-07 16:27:54 +01:00
|
|
|
@echo "WARN: shellcheck version is not 0.8.0"
|
|
|
|
|
endif
|
2023-09-11 21:44:57 -04:00
|
|
|
endif
|
2023-08-10 17:33:11 -04:00
|
|
|
ifeq ($(shell command -v flake8),)
|
2022-06-29 09:56:09 +01:00
|
|
|
echo "Please install flake8"
|
|
|
|
|
exit 1
|
|
|
|
|
endif
|
|
|
|
|
golangci-lint run --timeout 5m
|
|
|
|
|
flake8 test/deps/import-busybox
|
|
|
|
|
shellcheck --shell sh test/*.sh test/includes/*.sh test/suites/*.sh test/backends/*.sh test/lint/*.sh
|
2022-11-28 13:34:56 -05:00
|
|
|
shellcheck test/extras/*.sh
|
2023-02-08 13:52:17 -05:00
|
|
|
run-parts --exit-on-error --regex '.sh' test/lint
|
2015-08-21 09:47:20 -07:00
|
|
|
|
2023-10-19 13:48:12 -04:00
|
|
|
.PHONY: staticcheck
|
|
|
|
|
staticcheck:
|
|
|
|
|
ifeq ($(shell command -v staticcheck),)
|
|
|
|
|
(cd / ; go install -v -x honnef.co/go/tools/cmd/staticcheck@latest)
|
|
|
|
|
endif
|
|
|
|
|
# To get advance notice of deprecated function usage, consider running:
|
|
|
|
|
# sed -i 's/^go 1\.[0-9]\+$/go 1.18/' go.mod
|
|
|
|
|
# before 'make staticcheck'.
|
|
|
|
|
|
|
|
|
|
# Run staticcheck against all the dirs containing Go files.
|
|
|
|
|
staticcheck $$(git ls-files *.go | sed 's|^|./|; s|/[^/]\+\.go$$||' | sort -u)
|
|
|
|
|
|
2023-09-06 12:56:12 -04:00
|
|
|
tags: */*.go
|
2023-09-06 12:59:47 -04:00
|
|
|
find . -type f -name '*.go' | gotags -L - -f tags
|
2023-09-25 17:59:22 +01:00
|
|
|
|
|
|
|
|
# OpenFGA Syntax Transformer: https://github.com/openfga/syntax-transformer
|
|
|
|
|
.PHONY: update-openfga
|
|
|
|
|
update-openfga:
|
2023-10-27 10:55:17 -04:00
|
|
|
@printf 'package auth\n\n// Code generated by Makefile; DO NOT EDIT.\n\nvar authModel = `%s`\n' '$(shell npx --yes @openfga/syntax-transformer transform --from=dsl --inputFile=./internal/server/auth/driver_openfga_model.openfga | jq -c)' > ./internal/server/auth/driver_openfga_model.go
|