From ee60f2d827341d84ad249e166aaff1fc023205b0 Mon Sep 17 00:00:00 2001 From: Thomas Lamprecht Date: Tue, 23 Jan 2018 09:33:11 +0100 Subject: [PATCH] buildsys: refactor building and language initialization rsync everything in a temporary build directory and let buildpackage handle the rest. Has the advantage that both packages can be assembled in one buildpackage run, whereas previous it was called twice. Further, we can omit the do `make install` manually before calling dpkg-buildpackage and use .SECONDARY so that make keeps the files. It's not used anywhere else in our build systems and not really needed. If a new language gets added just run: make init-XY.po This won't happen that often, so an auto create has not a real use, especially as the .po file must then be edited anyway. Also we now can reuse the new 'messages.pot' target in the 'update' target and a strict separation between initialising a new language and updating a existing one seems reasonable. Signed-off-by: Thomas Lamprecht --- Makefile | 33 +++++++++++++++------------------ 1 file changed, 15 insertions(+), 18 deletions(-) diff --git a/Makefile b/Makefile index 44e7705..fc2c625 100644 --- a/Makefile +++ b/Makefile @@ -14,24 +14,22 @@ PVELOCALEDIR=${DESTDIR}/usr/share/pve-i18n PMG_LANG_FILES=$(patsubst %, pmg-lang-%.js, $(LINGUAS)) PVE_LANG_FILES=$(patsubst %, pve-lang-%.js, $(LINGUAS)) -all: | submodule +all: .PHONY: deb deb: $(DEBS) $(DEBS): | submodule rm -rf dest - mkdir dest - rsync -a debian dest - make DESTDIR=dest install + rsync -a * dest cd dest; dpkg-buildpackage -b -us -uc - lintian $@ + lintian $(DEBS) .PHONY: submodule submodule: test -f "pmg-gui/Makefile" || git submodule update --init .PHONY: install -install: ${PMG_LANG_FILES} ${PVE_LANG_FILES} +install: ${PMG_LANG_FILES} ${PVE_LANG_FILES} install -d ${PMGLOCALEDIR} install -m 0644 ${PMG_LANG_FILES} ${PMGLOCALEDIR} install -d ${PVELOCALEDIR} @@ -50,23 +48,22 @@ define potupdate ./jsgettext.pl -p "$(1) $(shell cd $(2);git rev-parse HEAD)" -o $(1).pot $(2) endef -.PHONY: update -update: +.PHONY: update update_pot +update_pot: submodule git submodule foreach 'git pull --ff-only origin master' $(call potupdate,proxmox-widget-toolkit,proxmox-widget-toolkit/) $(call potupdate,pve-manager,pve-manager/www/manager6/) $(call potupdate,proxmox-mailgateway,pmg-gui/js/) - msgcat proxmox-widget-toolkit.pot proxmox-mailgateway.pot pve-manager.pot > messages.pot.tmp - mv messages.pot.tmp messages.pot + +update: | update_pot messages.pot 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; - rm messages.pot -# try to generate po files when someone add a new language -.SECONDARY: # do not delete generated intermediate file -%.po: proxmox-widget-toolkit.pot proxmox-mailgateway.pot pve-manager.pot - msgcat $+ > $*.pot - msginit -i $*.pot -l $* -o $*.po - rm $*.pot +init-%.po: messages.pot + msginit -i $^ -l $^ -o $*.po --no-translator + +.INTERMEDIATE: messages.pot +messages.pot: proxmox-widget-toolkit.pot proxmox-mailgateway.pot pve-manager.pot + msgcat $^ > $@ .PHONY: distclean distclean: clean @@ -74,7 +71,7 @@ distclean: clean .PHONY: clean clean: find . -name '*~' -exec rm {} ';' - rm -rf dest *.po.tmp *.js.tmp *.deb *.buildinfo *.changes pve-lang-*.js pmg-lang-*.js + rm -rf dest *.po.tmp *.js.tmp *.deb *.buildinfo *.changes *.js messages.pot .PHONY: upload-pve upload-pve: ${PVE_I18N_DEB} -- 2.39.2