Skip to content

Commit

Permalink
cpupowerutils: do not update po files on each and every compile
Browse files Browse the repository at this point in the history
Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
  • Loading branch information
Dominik Brodowski committed Jul 29, 2011
1 parent 7443af9 commit f5ac064
Showing 1 changed file with 16 additions and 7 deletions.
23 changes: 16 additions & 7 deletions tools/power/cpupower/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,8 @@ HOSTCC = gcc
# set up PWD so that older versions of make will work with our build.
PWD = $(shell pwd)

GMO_FILES = ${shell for HLANG in ${LANGUAGES}; do echo po/$$HLANG.gmo; done;}

export CROSS CC AR STRIP RANLIB CFLAGS LDFLAGS LIB_OBJS

# check if compiler option is supported
Expand Down Expand Up @@ -134,7 +136,7 @@ CFLAGS += -pipe

ifeq ($(strip $(NLS)),true)
INSTALL_NLS += install-gmo
COMPILE_NLS += update-gmo
COMPILE_NLS += create-gmo
endif

ifeq ($(strip $(CPUFRQ_BENCH)),true)
Expand Down Expand Up @@ -195,22 +197,29 @@ cpupower: $(UTIL_OBJS) libcpufreq.so.$(LIB_MAJ)
$(QUIET) $(STRIPCMD) $@

po/$(PACKAGE).pot: $(UTIL_SRC)
@xgettext --default-domain=$(PACKAGE) --add-comments \
$(ECHO) " GETTEXT " $@
$(QUIET) xgettext --default-domain=$(PACKAGE) --add-comments \
--keyword=_ --keyword=N_ $(UTIL_SRC) && \
test -f $(PACKAGE).po && \
mv -f $(PACKAGE).po po/$(PACKAGE).pot

update-gmo: po/$(PACKAGE).pot
@for HLANG in $(LANGUAGES); do \
echo -n "Translating $$HLANG "; \
po/%.gmo: po/%.po
$(ECHO) " MSGFMT " $@
$(QUIET) msgfmt -o $@ po/$*.po

create-gmo: ${GMO_FILES}

update-po: po/$(PACKAGE).pot
$(ECHO) " MSGMRG " $@
$(QUIET) @for HLANG in $(LANGUAGES); do \
echo -n "Updating $$HLANG "; \
if msgmerge po/$$HLANG.po po/$(PACKAGE).pot -o \
po/$$HLANG.new.po; then \
mv -f po/$$HLANG.new.po po/$$HLANG.po; \
else \
echo "msgmerge for $$HLANG failed!"; \
rm -f po/$$HLANG.new.po; \
fi; \
msgfmt --statistics -o po/$$HLANG.gmo po/$$HLANG.po; \
done;

compile-bench: libcpufreq.so.$(LIB_MAJ)
Expand Down Expand Up @@ -268,5 +277,5 @@ uninstall:
rm -f $(DESTDIR)${localedir}/$$HLANG/LC_MESSAGES/cpupowerutils.mo; \
done;

.PHONY: all utils libcpufreq update-po update-gmo install-lib install-tools install-man install-gmo install uninstall \
.PHONY: all utils libcpufreq update-po create-gmo install-lib install-tools install-man install-gmo install uninstall \
clean

0 comments on commit f5ac064

Please sign in to comment.