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