]> git.proxmox.com Git - proxmox-i18n.git/blame - Makefile
buildsys: refactor building and language initialization
[proxmox-i18n.git] / Makefile
CommitLineData
e829fe4c 1LINGUAS=de it fr ja es sv ru tr zh_CN da ca pl sl nb nn pt_BR eu fa gl hu
3f7b1143
DM
2
3VERSION=1.0
f6d19e5a 4PKGREL=2
3f7b1143
DM
5
6PVE_I18N_DEB=pve-i18n_${VERSION}-${PKGREL}_all.deb
7PMG_I18N_DEB=pmg-i18n_${VERSION}-${PKGREL}_all.deb
8
9DEBS=${PMG_I18N_DEB} ${PVE_I18N_DEB}
10
11PMGLOCALEDIR=${DESTDIR}/usr/share/pmg-i18n
12PVELOCALEDIR=${DESTDIR}/usr/share/pve-i18n
13
14PMG_LANG_FILES=$(patsubst %, pmg-lang-%.js, $(LINGUAS))
15PVE_LANG_FILES=$(patsubst %, pve-lang-%.js, $(LINGUAS))
16
ee60f2d8 17all:
3f7b1143
DM
18
19.PHONY: deb
20deb: $(DEBS)
42d82cd2 21$(DEBS): | submodule
3f7b1143 22 rm -rf dest
ee60f2d8 23 rsync -a * dest
3f7b1143 24 cd dest; dpkg-buildpackage -b -us -uc
ee60f2d8 25 lintian $(DEBS)
3f7b1143 26
42d82cd2
DM
27.PHONY: submodule
28submodule:
80273b30 29 test -f "pmg-gui/Makefile" || git submodule update --init
42d82cd2 30
3f7b1143 31.PHONY: install
ee60f2d8 32install: ${PMG_LANG_FILES} ${PVE_LANG_FILES}
3f7b1143
DM
33 install -d ${PMGLOCALEDIR}
34 install -m 0644 ${PMG_LANG_FILES} ${PMGLOCALEDIR}
35 install -d ${PVELOCALEDIR}
36 install -m 0644 ${PVE_LANG_FILES} ${PVELOCALEDIR}
37
38
c1ae7daa
DC
39pmg-lang-%.js: %.po
40 ./po2js.pl -t pmg -v "${VERSION}-${PKGREL}" -o pmg-lang-$*.js $?
3f7b1143 41
c1ae7daa
DC
42pve-lang-%.js: %.po
43 ./po2js.pl -t pve -v "${VERSION}-${PKGREL}" -o pve-lang-$*.js $?
44
45# parameter 1 is the name
46# parameter 2 is the directory
47define potupdate
48 ./jsgettext.pl -p "$(1) $(shell cd $(2);git rev-parse HEAD)" -o $(1).pot $(2)
49endef
3f7b1143 50
ee60f2d8
TL
51.PHONY: update update_pot
52update_pot: submodule
c1ae7daa
DC
53 git submodule foreach 'git pull --ff-only origin master'
54 $(call potupdate,proxmox-widget-toolkit,proxmox-widget-toolkit/)
55 $(call potupdate,pve-manager,pve-manager/www/manager6/)
56 $(call potupdate,proxmox-mailgateway,pmg-gui/js/)
ee60f2d8
TL
57
58update: | update_pot messages.pot
c1ae7daa 59 for i in $(LINGUAS); do echo -n "$$i: "; msgmerge -s -v $$i.po messages.pot >$$i.po.tmp && mv $$i.po.tmp $$i.po; done;
3f7b1143 60
ee60f2d8
TL
61init-%.po: messages.pot
62 msginit -i $^ -l $^ -o $*.po --no-translator
63
64.INTERMEDIATE: messages.pot
65messages.pot: proxmox-widget-toolkit.pot proxmox-mailgateway.pot pve-manager.pot
66 msgcat $^ > $@
cbc629ce
DM
67
68.PHONY: distclean
69distclean: clean
70
3f7b1143
DM
71.PHONY: clean
72clean:
73 find . -name '*~' -exec rm {} ';'
ee60f2d8 74 rm -rf dest *.po.tmp *.js.tmp *.deb *.buildinfo *.changes *.js messages.pot
cbc629ce
DM
75
76.PHONY: upload-pve
77upload-pve: ${PVE_I18N_DEB}
ded3002e 78 tar cf - ${PVE_I18N_DEB}|ssh -X repoman@repo.proxmox.com -- upload --product pve --dist stretch
cbc629ce
DM
79
80.PHONY: upload-pmg
81upload-pmg: ${PMG_I18N_DEB}
ded3002e 82 tar cf - ${PMG_I18N_DEB}|ssh -X repoman@repo.proxmox.com -- upload --product pmg --dist stretch