diff options
author | Luke Shumaker <lukeshu@lukeshu.com> | 2018-01-03 12:34:53 -0500 |
---|---|---|
committer | Luke Shumaker <lukeshu@lukeshu.com> | 2018-01-03 13:34:08 -0500 |
commit | 99ba7e29afaccb5b47ada8c2d8e0b0f98de91936 (patch) | |
tree | 98c0ed639758e95601e9e696e14fa7d8ab9fa9dc | |
parent | b8c5c50d5eddd2346e579184305ecfb61d5660a8 (diff) |
Makefile: don't let paths in .pot files depend on where `make` was called
-rw-r--r-- | Makefile | 2 | ||||
-rw-r--r-- | build-aux/Makefile.each.tail/20-libretools.mk | 2 | ||||
-rw-r--r-- | po/Makefile | 8 | ||||
-rw-r--r-- | src/lib/Makefile | 4 |
4 files changed, 11 insertions, 5 deletions
@@ -40,7 +40,7 @@ $(outdir)/shellcheck: cd $(@D)/test && ./testenv $(TESTENVFLAGS) 'cd "$$TMPDIR/destdir" && find \( $(shellcheck.prune) \) -prune -o -not -type d -exec shellcheck $(shellcheck.flags) {} +' $(eval $(foreach pkg,$(pkgs),\ - $(srcdir)/po/$(pkg).pot: $(addsuffix /dir.pot,$(pkg.$(pkg)))$(at.nl))) + $(call at.path,$(srcdir)/po/$(pkg).pot): $(call at.addprefix,$(topsrcdir),$(addsuffix /dir.pot,$(pkg.$(pkg))))$(at.nl))) libretools.out.mans = libretools.out.bins = diff --git a/build-aux/Makefile.each.tail/20-libretools.mk b/build-aux/Makefile.each.tail/20-libretools.mk index 8902a26..bc96d97 100644 --- a/build-aux/Makefile.each.tail/20-libretools.mk +++ b/build-aux/Makefile.each.tail/20-libretools.mk @@ -53,7 +53,7 @@ $(outdir)/%: $(srcdir)/%.ronn $(outdir)/%.html: $(srcdir)/%.ronn ronn --html $(RONNFLAGS) < '$<' > '$@' $(srcdir)/%.pot: $(srcdir)/% $(topsrcdir)/src/lib/librexgettext - $(topsrcdir)/src/lib/librexgettext $(LIBREXGETTEXT_FLAGS) '$<' > '$@' + cd $(<D) && $(abspath $(topsrcdir)/src/lib/librexgettext) $(LIBREXGETTEXT_FLAGS) $(<F) > $(@F) $(srcdir)/dir.pot: $(addprefix $(outdir)/,$(addsuffix .pot,$(libretools.pots))) cat $^ | $(libretools.pofmt) > '$@' diff --git a/po/Makefile b/po/Makefile index 96d8490..b27844c 100644 --- a/po/Makefile +++ b/po/Makefile @@ -15,7 +15,13 @@ files.src.int += header.po.head # Rely on ../Makefile to fill in a list of our .pot dependencies $(srcdir)/%.pot: $(srcdir)/header.po.head - cat $^ | msguniq -Fi > '$@' + @echo 'MSGCAT $^ > $@'; + @{ \ + cd $(topsrcdir) && \ + for file in $(call at.relto,$(topsrcdir),$^); do \ + sed "/^#:/s, , $${file%/*}/,g" <"$$file"; \ + done; \ + } | msguniq -Fi > '$@' at.subdirs += .. include $(topsrcdir)/build-aux/Makefile.tail.mk diff --git a/src/lib/Makefile b/src/lib/Makefile index 900623d..515f856 100644 --- a/src/lib/Makefile +++ b/src/lib/Makefile @@ -15,8 +15,8 @@ $(outdir)/blacklist.sh.pot: $(srcdir)/blacklist.sh $(srcdir)/librexgettext @{ \ sed -n '/^# Usage:/,/()/{ /^#/ { =; p; } }' $< | \ sed -r -e 's/^# (.*)/msgid "\1"\nmsgstr ""\n/' \ - -e 's|^[0-9]*$$|#. embedded usage text\n#: $<:&|' && \ - $(<D)/librexgettext --simple=_l:2 $< && \ + -e 's|^[0-9]*$$|#. embedded usage text\n#: $(<F):&|' && \ + cd $(<D) && ./librexgettext --simple=_l:2 $(<F) && \ :; } | $(libretools.pofmt) > $@ $(outdir)/common.sh.pot : LIBREXGETTEXT_FLAGS += --simple=_l:2 $(outdir)/conf.sh.pot : LIBREXGETTEXT_FLAGS += --simple=_l:2 |