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