From ef458b4041b96e0ad46c13c62907d1ec1e848b13 Mon Sep 17 00:00:00 2001 From: Steve Date: Sun, 28 Feb 2016 15:29:21 +0000 Subject: [PATCH] Build updates for po i18n. --- .gitignore | 1 + common.mk | 8 ++++++-- makefile | 11 +++++++++++ 3 files changed, 18 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index 0953dc0..6db947c 100644 --- a/.gitignore +++ b/.gitignore @@ -3,6 +3,7 @@ *.ko *.obj *.elf +*.mo # Precompiled Headers *.gch diff --git a/common.mk b/common.mk index 02d4a4e..ce504d8 100644 --- a/common.mk +++ b/common.mk @@ -1,5 +1,6 @@ VERSION = 0.6 REVISION = $(shell date +"%y%m%d") +LOCALE_MO = $(patsubst %.po,%.mo,$(wildcard locale/*.po)) SEARCHPATH += src/ src/battle src/challenges src/draw src/game src/galaxy src/json src/system src/test vpath %.c $(SEARCHPATH) @@ -28,12 +29,15 @@ OBJS += util.o OBJS += waypoints.o widgets.o # top-level rule to create the program. -all: $(PROG) +all: $(PROG) $(LOCALE_MO) # compiling other source files. %.o: %.c %.h $(DEPS) $(CC) $(CFLAGS) $(CXXFLAGS) -c $< +%.mo: %.po + msgfmt -c -o $@ $< + # cleaning everything that can be automatically recreated with "make". clean: - $(RM) $(OBJS) $(PROG) + $(RM) $(OBJS) $(PROG) $(LOCALE_MO) diff --git a/makefile b/makefile index 465f22e..af627c9 100644 --- a/makefile +++ b/makefile @@ -30,9 +30,20 @@ install: cp -r music $(DATA_DIR) cp -r sound $(DATA_DIR) + @for f in $(LOCALE_MO); do \ + lang=`echo $$f | sed -e 's/^locale\///;s/\.mo$$//'`; \ + mkdir -p $(LOCALE_DIR)/$$lang/LC_MESSAGES; \ + cp -v $$f $(LOCALE_DIR)/$$lang/LC_MESSAGES/$(PROG).mo; \ + done + uninstall: $(RM) $(BIN_DIR)/$(PROG) $(RM) -rf $(DATA_DIR) + + @for f in $(LOCALE_MO); do \ + lang=`echo $$f | sed -e 's/^locale\///;s/\.mo$$//'`; \ + $(RM) -v $(LOCALE_DIR)/$$lang/LC_MESSAGES/$(PROG).mo; \ + done # prepare an archive for the program dist: