summaryrefslogtreecommitdiff
path: root/tools/power
diff options
context:
space:
mode:
authorSiddharth Menon <simeddon@gmail.com>2024-10-18 10:22:48 +0530
committerShuah Khan <skhan@linuxfoundation.org>2024-10-21 16:10:43 -0600
commit47d7650b9cb10381e5472840cf180a803f61fb0e (patch)
treeb242622999a19c5e1b6fd6b8b9c143b8efa85a5e /tools/power
parentb78abc21b263ed412f4ba2e02ef8b94571865fce (diff)
cpupower: add checks for xgettext and msgfmt
Check whether xgettext and msgfmt are available on the system before attempting to generate GNU gettext Language Translations. In case of missing dependency, generate error message directing user to install the necessary package. Tested-by: John B. Wyatt IV <jwyatt@redhat.com> Tested-by: John B. Wyatt IV <sageofredondo@gmail.com> Suggested-by: Shuah Khan <skhan@linuxfoundation.org> Signed-off-by: Siddharth Menon <simeddon@gmail.com> Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
Diffstat (limited to 'tools/power')
-rw-r--r--tools/power/cpupower/Makefile12
1 files changed, 12 insertions, 0 deletions
diff --git a/tools/power/cpupower/Makefile b/tools/power/cpupower/Makefile
index c74c762002e8..175004ce44b2 100644
--- a/tools/power/cpupower/Makefile
+++ b/tools/power/cpupower/Makefile
@@ -218,17 +218,28 @@ else
endif
$(QUIET) $(STRIPCMD) $@
+ifeq (, $(shell which xgettext))
+$(warning "Install xgettext to extract translatable strings.")
+else
$(OUTPUT)po/$(PACKAGE).pot: $(UTIL_SRC)
$(ECHO) " GETTEXT " $@
$(QUIET) xgettext --default-domain=$(PACKAGE) --add-comments \
--keyword=_ --keyword=N_ $(UTIL_SRC) -p $(@D) -o $(@F)
+endif
+ifeq (, $(shell which msgfmt))
+$(warning "Install msgfmt to generate binary message catalogs.")
+else
$(OUTPUT)po/%.gmo: po/%.po
$(ECHO) " MSGFMT " $@
$(QUIET) msgfmt -o $@ po/$*.po
+endif
create-gmo: ${GMO_FILES}
+ifeq (, $(shell which msgmerge))
+$(warning "Install msgmerge to merge translations.")
+else
update-po: $(OUTPUT)po/$(PACKAGE).pot
$(ECHO) " MSGMRG " $@
$(QUIET) @for HLANG in $(LANGUAGES); do \
@@ -241,6 +252,7 @@ update-po: $(OUTPUT)po/$(PACKAGE).pot
rm -f $(OUTPUT)po/$$HLANG.new.po; \
fi; \
done;
+endif
compile-bench: $(OUTPUT)libcpupower.so.$(LIB_MAJ)
@V=$(V) confdir=$(confdir) $(MAKE) -C bench O=$(OUTPUT)