<commit_before>DOMAIN=lxd
POFILES=$(wildcard po/*.po)
MOFILES=$(patsubst %.po,%.mo,$(POFILES))
LINGUAS=$(basename $(POFILES))
POTFILE=po/$(DOMAIN).pot

# dist is primarily for use when packaging; for development we still manage
# dependencies via `go get` explicitly.
# TODO: use git describe for versioning
VERSION=$(shell grep "var Version" shared/flex.go | cut -d'"' -f2)
ARCHIVE=lxd-$(VERSION).tar

.PHONY: default
default:
	# Must a few times due to go get race
	-go get -t -v -d ./...
	-go get -t -v -d ./...
	-go get -t -v -d ./...
	go install -v $(DEBUG) ./...
	@echo "LXD built successfully"

.PHONY: client
client:
	# Must a few times due to go get race
	-go get -t -v -d ./...
	-go get -t -v -d ./...
	-go get -t -v -d ./...
	go install -v $(DEBUG) ./lxc
	@echo "LXD client built successfully"

.PHONY: update
update:
	# Must a few times due to go get race
	-go get -t -v -d -u ./...
	-go get -t -v -d -u ./...
	go get -t -v -d -u ./...
	@echo "Dependencies updated"

# This only needs to be done when migrate.proto is actually changed; since we
# commit the .pb.go in the tree and it's not expected to change very often,
# it's not a default build step.
.PHONY: protobuf
protobuf:
	protoc --go_out=. ./lxd/migrate.proto

.PHONY: check
check: default
	go get -v -x github.com/remyoudompheng/go-misc/deadcode
	go test -v ./...
	cd test && ./main.sh

gccgo:
	go build -compiler gccgo ./...
	@echo "LXD built successfully with gccgo"

.PHONY: dist
dist:
	rm -Rf lxd-$(VERSION) $(ARCHIVE) $(ARCHIVE).gz
	mkdir -p lxd-$(VERSION)/dist
	-GOPATH=$(shell pwd)/lxd-$(VERSION)/dist go get -t -v -d ./...
	-GOPATH=$(shell pwd)/lxd-$(VERSION)/dist go get -t -v -d ./...
	-GOPATH=$(shell pwd)/lxd-$(VERSION)/dist go get -t -v -d ./...
	GOPATH=$(shell pwd)/lxd-$(VERSION)/dist go get -t -v -d ./...
	rm -rf $(shell pwd)/lxd-$(VERSION)/dist/src/github.com/lxc/lxd
	ln -s ../../../.. ./lxd-$(VERSION)/dist/src/github.com/lxc/lxd
	git archive --prefix=lxd-$(VERSION)/ --output=$(ARCHIVE) HEAD
	tar -uf $(ARCHIVE) --exclude-vcs lxd-$(VERSION)/
	gzip -9 $(ARCHIVE)
	rm -Rf dist lxd-$(VERSION) $(ARCHIVE)

.PHONY: i18n update-po update-pot build-mo static-analysis
i18n: update-pot

po/%.mo: po/%.po
	msgfmt --statistics -o $@ $<

po/%.po: po/$(DOMAIN).pot
	msgmerge -U po/$*.po po/$(DOMAIN).pot

update-po:
	-for lang in $(LINGUAS); do\
	    msgmerge -U $$lang.po po/$(DOMAIN).pot; \
	    rm -f $$lang.po~; \
	done

update-pot:
	go get -v -x github.com/snapcore/snapd/i18n/xgettext-go/
	xgettext-go -o po/$(DOMAIN).pot --add-comments-tag=TRANSLATORS: --sort-output --package-name=$(DOMAIN) --msgid-bugs-address=<EMAIL> --keyword=i18n.G --keyword-plural=i18n.NG *.go shared/*.go lxc/*.go lxd/*.go


build-mo: $(MOFILES)

static-analysis:
	/bin/bash -x -c ". test/static_analysis.sh; static_analysis"

tags: *.go lxd/*.go shared/*.go lxc/*.go
	find . | grep \.go | grep -v git | grep -v .swp | grep -v vagrant | xargs gotags > tags
<commit_msg>Makefile: Don't recursively include test deps<commit_after>DOMAIN=lxd
POFILES=$(wildcard po/*.po)
MOFILES=$(patsubst %.po,%.mo,$(POFILES))
LINGUAS=$(basename $(POFILES))
POTFILE=po/$(DOMAIN).pot

# dist is primarily for use when packaging; for development we still manage
# dependencies via `go get` explicitly.
# TODO: use git describe for versioning
VERSION=$(shell grep "var Version" shared/flex.go | cut -d'"' -f2)
ARCHIVE=lxd-$(VERSION).tar

.PHONY: default
default:
	# Must a few times due to go get race
	-go get -t -v -d ./...
	-go get -t -v -d ./...
	-go get -t -v -d ./...
	go install -v $(DEBUG) ./...
	@echo "LXD built successfully"

.PHONY: client
client:
	# Must a few times due to go get race
	-go get -t -v -d ./...
	-go get -t -v -d ./...
	-go get -t -v -d ./...
	go install -v $(DEBUG) ./lxc
	@echo "LXD client built successfully"

.PHONY: update
update:
	# Must a few times due to go get race
	-go get -t -v -d -u ./...
	-go get -t -v -d -u ./...
	go get -t -v -d -u ./...
	@echo "Dependencies updated"

# This only needs to be done when migrate.proto is actually changed; since we
# commit the .pb.go in the tree and it's not expected to change very often,
# it's not a default build step.
.PHONY: protobuf
protobuf:
	protoc --go_out=. ./lxd/migrate.proto

.PHONY: check
check: default
	go get -v -x github.com/remyoudompheng/go-misc/deadcode
	go test -v ./...
	cd test && ./main.sh

gccgo:
	go build -compiler gccgo ./...
	@echo "LXD built successfully with gccgo"

.PHONY: dist
dist:
	$(eval TMP := $(shell mktemp -d))
	rm -Rf lxd-$(VERSION) $(ARCHIVE) $(ARCHIVE).gz
	mkdir -p lxd-$(VERSION)/
	-GOPATH=$(TMP) go get -t -v -d ./...
	-GOPATH=$(TMP) go get -t -v -d ./...
	-GOPATH=$(TMP) go get -t -v -d ./...
	GOPATH=$(TMP) go get -t -v -d ./...
	rm -rf $(TMP)/src/github.com/lxc/lxd
	ln -s ../../../.. $(TMP)/src/github.com/lxc/lxd
	mv $(TMP)/ lxd-$(VERSION)/dist
	git archive --prefix=lxd-$(VERSION)/ --output=$(ARCHIVE) HEAD
	tar -uf $(ARCHIVE) --exclude-vcs lxd-$(VERSION)/
	gzip -9 $(ARCHIVE)
	rm -Rf lxd-$(VERSION) $(ARCHIVE)

.PHONY: i18n update-po update-pot build-mo static-analysis
i18n: update-pot

po/%.mo: po/%.po
	msgfmt --statistics -o $@ $<

po/%.po: po/$(DOMAIN).pot
	msgmerge -U po/$*.po po/$(DOMAIN).pot

update-po:
	-for lang in $(LINGUAS); do\
	    msgmerge -U $$lang.po po/$(DOMAIN).pot; \
	    rm -f $$lang.po~; \
	done

update-pot:
	go get -v -x github.com/snapcore/snapd/i18n/xgettext-go/
	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 *.go shared/*.go lxc/*.go lxd/*.go


build-mo: $(MOFILES)

static-analysis:
	/bin/bash -x -c ". test/static_analysis.sh; static_analysis"

tags: *.go lxd/*.go shared/*.go lxc/*.go
	find . | grep \.go | grep -v git | grep -v .swp | grep -v vagrant | xargs gotags > tags

{'fraction_non_alphanumeric': 0.19660900839184792, 'fraction_numerical': 0.004110292858366158, 'mean_word_length': 2.6341008089607967, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 6, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 1, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1124969', 'n_tokens_mistral': 2421, 'n_tokens_neox': 2346, 'n_words': 715}