]>
Commit | Line | Data |
---|---|---|
1 | include /usr/share/dpkg/pkg-info.mk | |
2 | ||
3 | LINGUAS=\ | |
4 | ar \ | |
5 | ca \ | |
6 | da \ | |
7 | de \ | |
8 | es \ | |
9 | eu \ | |
10 | fa \ | |
11 | fr \ | |
12 | gl \ | |
13 | he \ | |
14 | hr \ | |
15 | hu \ | |
16 | it \ | |
17 | ja \ | |
18 | ka \ | |
19 | kr \ | |
20 | nb \ | |
21 | nl \ | |
22 | nn \ | |
23 | pl \ | |
24 | pt_BR \ | |
25 | ru \ | |
26 | sl \ | |
27 | sv \ | |
28 | tr \ | |
29 | ukr \ | |
30 | zh_CN \ | |
31 | zh_TW \ | |
32 | ||
33 | BUILDDIR ?= $(DEB_SOURCE)-$(DEB_VERSION) | |
34 | ||
35 | DSC=$(DEB_SOURCE)_$(DEB_VERSION_UPSTREAM_REVISION).dsc | |
36 | PVE_I18N_DEB=pve-i18n_$(DEB_VERSION)_all.deb | |
37 | PMG_I18N_DEB=pmg-i18n_$(DEB_VERSION)_all.deb | |
38 | PBS_I18N_DEB=pbs-i18n_$(DEB_VERSION)_all.deb | |
39 | ||
40 | DEBS=$(PMG_I18N_DEB) $(PVE_I18N_DEB) $(PBS_I18N_DEB) | |
41 | ||
42 | PMGLOCALEDIR=$(DESTDIR)/usr/share/pmg-i18n | |
43 | PVELOCALEDIR=$(DESTDIR)/usr/share/pve-i18n | |
44 | PBSLOCALEDIR=$(DESTDIR)/usr/share/pbs-i18n | |
45 | ||
46 | PMG_LANG_FILES=$(patsubst %, pmg-lang-%.js, $(LINGUAS)) | |
47 | PVE_LANG_FILES=$(patsubst %, pve-lang-%.js, $(LINGUAS)) | |
48 | PBS_LANG_FILES=$(patsubst %, pbs-lang-%.js, $(LINGUAS)) | |
49 | ||
50 | all: | |
51 | ||
52 | $(BUILDDIR): submodule | |
53 | rm -rf $@ $@.tmp | |
54 | rsync -a * $@.tmp | |
55 | mv $@.tmp $@ | |
56 | ||
57 | .PHONY: deb | |
58 | deb: $(DEBS) | |
59 | $(DEBS): build-debs | |
60 | ||
61 | build-debs: $(BUILDDIR) | |
62 | cd $(BUILDDIR); dpkg-buildpackage -b -us -uc | |
63 | lintian $(DEBS) | |
64 | touch "$@" | |
65 | ||
66 | sbuild: $(DSC) | |
67 | sbuild $(DSC) | |
68 | ||
69 | .PHONY: dsc | |
70 | dsc: $(DSC) | |
71 | $(DSC): $(BUILDDIR) | |
72 | cd $(BUILDDIR); dpkg-buildpackage -S -us -uc -d | |
73 | lintian $(DSC) | |
74 | ||
75 | submodule: | |
76 | test -f pmg-gui/Makefile -a -f proxmox-backup/Makefile -a -f pve-manager/Makefile \ | |
77 | || git submodule update --init | |
78 | ||
79 | .PHONY: install | |
80 | install: $(PMG_LANG_FILES) $(PVE_LANG_FILES) $(PBS_LANG_FILES) | |
81 | install -d $(PMGLOCALEDIR) | |
82 | install -m 0644 $(PMG_LANG_FILES) $(PMGLOCALEDIR) | |
83 | install -d $(PVELOCALEDIR) | |
84 | install -m 0644 $(PVE_LANG_FILES) $(PVELOCALEDIR) | |
85 | install -d $(PBSLOCALEDIR) | |
86 | install -m 0644 $(PBS_LANG_FILES) $(PBSLOCALEDIR) | |
87 | ||
88 | pmg-lang-%.js: %.po | |
89 | ./po2js.pl -t pmg -v "$(DEB_VERSION)" -o pmg-lang-$*.js $? | |
90 | ||
91 | pve-lang-%.js: %.po | |
92 | ./po2js.pl -t pve -v "$(DEB_VERSION)" -o pve-lang-$*.js $? | |
93 | ||
94 | pbs-lang-%.js: %.po | |
95 | ./po2js.pl -t pbs -v "$(DEB_VERSION)" -o pbs-lang-$*.js $? | |
96 | ||
97 | # parameter 1 is the name | |
98 | # parameter 2 is the directory | |
99 | define potupdate | |
100 | ./jsgettext.pl -p "$(1) $(shell cd $(2);git rev-parse HEAD)" -o $(1).pot $(2) | |
101 | endef | |
102 | ||
103 | .PHONY: update update_pot do_update | |
104 | update_pot: submodule | |
105 | $(call potupdate,proxmox-widget-toolkit,proxmox-widget-toolkit/) | |
106 | $(call potupdate,pve-manager,pve-manager/www/manager6/) | |
107 | $(call potupdate,proxmox-mailgateway,pmg-gui/js/) | |
108 | $(call potupdate,proxmox-backup,proxmox-backup/www/) | |
109 | ||
110 | do_update: | |
111 | $(MAKE) update_pot | |
112 | $(MAKE) messages.pot | |
113 | 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; | |
114 | ||
115 | update: | |
116 | git submodule foreach 'git pull --ff-only origin master' | |
117 | $(MAKE) do_update | |
118 | ||
119 | stats: | |
120 | @for i in $(LINGUAS); do echo -n "$$i: "; msgfmt --statistics -o /dev/null $$i.po; done | |
121 | ||
122 | init-%.po: messages.pot | |
123 | msginit -i $^ -l $^ -o $*.po --no-translator | |
124 | ||
125 | .INTERMEDIATE: messages.pot | |
126 | messages.pot: proxmox-widget-toolkit.pot proxmox-mailgateway.pot pve-manager.pot proxmox-backup.pot | |
127 | msgcat $^ > $@ | |
128 | ||
129 | .PHONY: distclean | |
130 | distclean: clean | |
131 | ||
132 | .PHONY: clean | |
133 | clean: | |
134 | rm -rf $(DEB_SOURCE)-[0-9]*/ *.po.tmp *.js.tmp *.deb *.dsc *.tar.* *.build *.buildinfo *.changes *.js messages.pot | |
135 | ||
136 | .PHONY: upload-pve upload-pmg upload-pbs upload | |
137 | upload-%: UPLOAD_DIST ?= $(DEB_DISTRIBUTION) | |
138 | upload-pve: $(PVE_I18N_DEB) | |
139 | tar cf - $^|ssh -X repoman@repo.proxmox.com -- upload --product pve --dist $(UPLOAD_DIST) | |
140 | upload-pmg: $(PMG_I18N_DEB) | |
141 | tar cf - $^|ssh -X repoman@repo.proxmox.com -- upload --product pmg --dist $(UPLOAD_DIST) | |
142 | upload-pbs: $(PBS_I18N_DEB) | |
143 | tar cf - $^|ssh -X repoman@repo.proxmox.com -- upload --product pbs --dist $(UPLOAD_DIST) | |
144 | ||
145 | upload: upload-pve upload-pmg upload-pbs |