forked from canonical/lxd
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
58 lines (47 loc) · 1.6 KB
/
Makefile
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
57
58
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 | sed -r -e 's/.*"([0-9\.]*)"/\1/')
ARCHIVE=lxd-$(VERSION).tar
.PHONY: default
default:
go install -v ./...
# 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/migration/migrate.proto
.PHONY: check
check: default
go test ./...
cd test && ./main.sh
.PHONY: dist
dist:
rm -Rf lxd-$(VERSION) $(ARCHIVE) $(ARCHIVE).gz
mkdir -p lxd-$(VERSION)/dist
GOPATH=$(shell pwd)/lxd-$(VERSION)/dist go get -d -v ./...
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
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; \
done
update-pot:
xgettext -d $(DOMAIN) -s client.go lxc/*.go -o po/$(DOMAIN).pot -L vala -i --keyword=Gettext
build-mo: $(MOFILES)