diff options
Diffstat (limited to 'common.mk')
-rw-r--r-- | common.mk | 24 |
1 files changed, 24 insertions, 0 deletions
@@ -17,6 +17,27 @@ indent = emacs --batch $1 \ --eval '(indent-region (point-min) (point-max) nil)' \ -f save-buffer &>/dev/null +# Usage <INPUT $(pofmt) >OUTPUT +# Normalize a .po(t) file +pofmt = msguniq -Fi + +pot-remove-wrap = tr '\n' '\r' | sed 's/"\r\s*"//g' | tr '\r' '\n' +html-whitespace-collapse = sed -r -e 's/(\\n|\\t|\t)/ /g' -e 's/ +/ /g' +define xgettext-prose = + xgettext --omit-header --from-code=UTF-8 -L shell \ + -k \ + --keyword={prose,bullet,flag:2} \ + -o - $^ | $(pot-remove-wrap) | $(html-whitespace-collapse) | sed '/^#, sh-format/d' +endef +define xgettext-main = + xgettext --omit-header --from-code=UTF-8 -L shell \ + -k \ + --keyword={_,print} \ + --keyword={msg,msg2,warning,error,stat_busy} \ + --keyword={lock,slock}:3 \ + -o - $^ +endef + # Usage: as a variable # relative path to `/` from $(bindir) # used for symlinking libexec files @@ -69,6 +90,9 @@ build: PHONY $(build_files) %.html: %.ronn ronn --html $(RONNFLAGS) < '$<' > '$@' +%.pot: % + { $(xgettext-main); $(xgettext-prose); } | $(pofmt) > '$@' + # Install ###################################################################### install: PHONY $(install_files) |