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