diff options
author | Luke Shumaker <LukeShu@sbcglobal.net> | 2013-09-23 19:58:09 -0400 |
---|---|---|
committer | Luke Shumaker <LukeShu@sbcglobal.net> | 2013-09-23 19:58:09 -0400 |
commit | 03119e29b4bb744478e6e01922da4d50cf4cbcbc (patch) | |
tree | f047d3998c323e7cb113682c8905f5cf6148c442 | |
parent | 16e01bca9a23eef40191e8ca5abefdb1ab4c741a (diff) |
Makefile: fix xgettext rules
-rw-r--r-- | common.mk | 24 | ||||
-rw-r--r-- | src/chroot-tools/Makefile | 3 | ||||
-rw-r--r-- | src/lib/Makefile | 11 |
3 files changed, 16 insertions, 22 deletions
@@ -14,22 +14,16 @@ edit = sed -e 's|m4_include(lib/\(.*\))|. $$(librelib \1)|' # Normalize a .po(t) file pofmt = msguniq -Fi +xgettext-keywords-sh += --keyword={_,print} +xgettext-keywords-sh += --keyword={msg,msg2,warning,error,stat_busy,die} +xgettext-keywords-sh += --keyword={lock,slock}:3 + +xgettext-sh = xgettext --omit-header --from-code=UTF-8 -L shell -o - +xgettext-sh-std = $(xgettext-sh) $(xgettext-keywords-sh) $^ + 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 +xgettext-sh-prose = $(xgettext-sh) -k --keyword={prose,bullet,flag:2} $^ | $(pot-remove-wrap) | $(html-whitespace-collapse) | sed '/^\#, sh-format/d' # Usage: as a variable # relative path to `/` from $(bindir) @@ -88,7 +82,7 @@ build: PHONY $(build_files) @chmod 755 "$@" || { rm -f -- '$@'; false; } %.pot: % - { $(xgettext-main); $(xgettext-prose); } | $(pofmt) > '$@' + { $(xgettext-sh-std); $(xgettext-sh-prose); } | $(pofmt) > '$@' # Install ###################################################################### diff --git a/src/chroot-tools/Makefile b/src/chroot-tools/Makefile index 0540636..db1cdf5 100644 --- a/src/chroot-tools/Makefile +++ b/src/chroot-tools/Makefile @@ -40,5 +40,4 @@ archroot: %: %.in Makefile @$(edit) <"$<" >"$@" || { rm -f -- '$@'; false; } @chmod 755 "$@" || { rm -f -- '$@'; false; } -distcc-tool.pot: distcc-tool - xgettext --omit-header -i --from-code=UTF-8 -L shell --keyword={error,errusage} -o $@ $< +distcc-tool.pot: xgettext-keywords-sh+=--keyword=errusage diff --git a/src/lib/Makefile b/src/lib/Makefile index 45fd330..fd6d31d 100644 --- a/src/lib/Makefile +++ b/src/lib/Makefile @@ -23,8 +23,9 @@ pot: libreblacklist.pot common.sh.pot librelib.pot libreblacklist.pot: libreblacklist { \ - sed -n '/^# Usage:/,/()/{ /^#/ { =; p; } }' $< | sed -r -e 's/^# (.*)/msgid "\1"/' -e 's/^[0-9]*$$/#. embedded usage text\n#: $<:&/'; \ - sed -rn '/print /{ =; s/\s*print "([^"]*)".*/msgid "\1"/p; }' $< | sed 's/^[0-9]*$$/#. print\n#: $<:&/' ; \ - } | sed 's/^msgid .*/&\nmsgstr ""\n/' > $@ -common.sh.pot: common.sh - xgettext --omit-header -i --from-code=UTF-8 -L shell -o $@ $< + sed -n '/^# Usage:/,/()/{ /^#/ { =; p; } }' $< | \ + sed -r -e 's/^# (.*)/msgid "\1"\nmsgstr ""\n/' \ + -e 's/^[0-9]*$$/#. embedded usage text\n#: $<:&/'; \ + $(xgettext-sh-prose); \ + $(xgettext-sh-std); \ + } | $(pofmt) > $@ |