diff options
Diffstat (limited to 'common.mk')
-rw-r--r-- | common.mk | 40 |
1 files changed, 23 insertions, 17 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) @@ -61,6 +55,9 @@ install_files += $(addprefix $(DESTDIR)$(bindir)/,$(progs)) \ $(addprefix $(DESTDIR)$(mandir)/man8/,$(filter %.8,$(mans))) clean_files += $(patsubst %.in,%,$(copy_files)) $(copy_files) $(mans) $(wildcard *.pot) +pots += $(filter-out $(no-pots) ,$(progs)) +pot_files += $(addsuffix .pot,$(pots)) + # Set the default target ####################################################### all: PHONY build @@ -84,11 +81,18 @@ build: PHONY $(build_files) ronn --html $(RONNFLAGS) < '$<' > '$@' %: %.in @echo "GEN $@" - @$(edit) <"$<" >"$@" || { rm -f -- '$@'; false; } - @chmod 755 "$@" || { rm -f -- '$@'; false; } + @$(edit) <"$<" >"$@" + @chmod 755 "$@" + +# Build ######################################################################## + +pot: everything.pot + +everything.pot: $(pot_files) + cat $^ | $(pofmt) > '$@' %.pot: % - { $(xgettext-main); $(xgettext-prose); } | $(pofmt) > '$@' + { $(xgettext-sh-std); $(xgettext-sh-prose); } | $(pofmt) > '$@' # Install ###################################################################### @@ -142,3 +146,5 @@ clean-hook: PHONY FORCE: PHONY PHONY: .PHONY: FORCE PHONY + +.DELETE_ON_ERROR: |