[PATCH] Basic gettext support when building
Henrik Brautaset Aronsen
subsurface at henrik.synth.no
Fri Oct 12 01:05:41 PDT 2012
Den 11.10.12 15:48, skrev Henrik Brautaset Aronsen:
> Den 11.10.12 15:12, skrev Dirk Hohndel:
>> I notice that calling make now ALWAYS relinks the executable, even if
>> there were no changes (just call make twice in a row - the second time
>> it should say "`subsurface' is up to date")
>>
>> Can you fix that?
>
> I'm trying, but I just can't figure out why the gettext target is
> being built even though no .po files have changed. Any ideas?
Fixed it! Patch attached.
H
-------------- next part --------------
From 409e928b972e4c4f26822bd6324208ee4082ea3a Mon Sep 17 00:00:00 2001
From: Henrik Brautaset Aronsen <subsurface at henrik.synth.no>
Date: Fri, 12 Oct 2012 10:02:41 +0200
Subject: [PATCH] Better gettext build
My previous take at adding gettext to the Makefile wasn't very good,
since it always relinked the subsurface executable.
Signed-off-by: Henrik Brautaset Aronsen <subsurface at henrik.synth.no>
---
Makefile | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/Makefile b/Makefile
index 6ecef79..e747c5a 100644
--- a/Makefile
+++ b/Makefile
@@ -118,11 +118,14 @@ endif
LIBS = $(LIBXML2) $(LIBXSLT) $(LIBGTK) $(LIBGCONF2) $(LIBDIVECOMPUTER) $(EXTRALIBS) $(LIBZIP) -lpthread -lm
+MSGLANGS=$(notdir $(wildcard po/*po))
+MSGOBJS=$(addprefix locale/,$(MSGLANGS:.po=.UTF-8/LC_MESSAGES/subsurface.mo))
+
OBJS = main.o dive.o time.o profile.o info.o equipment.o divelist.o \
parse-xml.o save-xml.o libdivecomputer.o print.o uemis.o uemis-downloader.o \
gtk-gui.o statistics.o file.o cochran.o $(OSSUPPORT).o $(RESFILE)
-$(NAME): $(OBJS) gettext
+$(NAME): $(OBJS) $(MSGOBJS)
$(CC) $(LDFLAGS) -o $(NAME) $(OBJS) $(LIBS)
install: $(NAME)
@@ -211,12 +214,9 @@ uemis-downloader.o: uemis-downloader.c dive.h uemis.h
$(OSSUPPORT).o: $(OSSUPPORT).c display-gtk.h
$(CC) $(CFLAGS) $(OSSUPPORT_CFLAGS) -c $(OSSUPPORT).c
-gettext: po/*.po
- @for MSG in $(wildcard po/*.po); do \
- LOC=`basename $$MSG .po`; \
- mkdir -p locale/$$LOC.UTF-8/LC_MESSAGES; \
- msgfmt -c -o locale/$$LOC.UTF-8/LC_MESSAGES/subsurface.mo $$MSG; \
- done
+locale/%.UTF-8/LC_MESSAGES/subsurface.mo: po/%.po
+ mkdir -p $(dir $@)
+ msgfmt -c -o $@ po/$*.po
doc:
$(MAKE) -C Documentation doc
--
1.7.11.5
More information about the subsurface
mailing list