From 99ba7e29afaccb5b47ada8c2d8e0b0f98de91936 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Wed, 3 Jan 2018 12:34:53 -0500 Subject: Makefile: don't let paths in .pot files depend on where `make` was called --- Makefile | 2 +- build-aux/Makefile.each.tail/20-libretools.mk | 2 +- po/Makefile | 8 +++++++- src/lib/Makefile | 4 ++-- 4 files changed, 11 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index 5d7ece2..9992d49 100644 --- a/Makefile +++ b/Makefile @@ -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 $( $(@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#: $<:&|' && \ - $( $@ $(outdir)/common.sh.pot : LIBREXGETTEXT_FLAGS += --simple=_l:2 $(outdir)/conf.sh.pot : LIBREXGETTEXT_FLAGS += --simple=_l:2 -- cgit v1.2.2