diff -r 83fd6cf37084 -r 3c10fdd8ccce Makefile --- a/Makefile Mon Jan 28 17:22:15 2008 +0100 +++ b/Makefile Mon Jan 28 17:39:51 2008 +0100 @@ -82,24 +82,35 @@ PODIR = po I18Npot = $(PODIR)/$(PLUGIN).pot -I18Nmsgs = $(addprefix $(LOCALEDIR)/,$(addsuffix /LC_MESSAGES/vdr-$(PLUGIN).mo,$(notdir $(foreach file, $(wildcard $(PODIR)/*.po), $(basename $(file)))))) +I18Npots := $(notdir $(foreach file, $(wildcard $(PODIR)/*.po), $(basename $(file)))) +ifeq ($(strip $(APIVERSION)),1.5.7) + I18Nmo = $(PLUGIN).mo +else + I18Nmo = vdr-$(PLUGIN).mo +endif LOCALEDIR = $(VDRDIR)/locale +I18Nmsgs := $(addprefix $(LOCALEDIR)/,$(addsuffix /LC_MESSAGES/$(I18Nmo),$(I18Npots))) + +HASLOCALE = $(shell grep -l 'I18N_DEFAULT_LOCALE' $(VDRDIR)/include/vdr/i18n.h) +ifeq ($(strip $(HASLOCALE)),) + OBJS += i18n.o +endif ### Targets: TARGETS = libvdr-$(PLUGIN).so -ifneq ($(shell grep -l 'Phrases' $(VDRDIR)/i18n.c),$(VDRDIR)/i18n.c) -TARGETS += i18n +ifneq ($(strip $(HASLOCALE)),) + TARGETS += i18n endif all: $(TARGETS) -.PHONY: i18n +.PHONY: i18n clean dist # Dependencies: MAKEDEP = $(CXX) -MM -MG DEPFILE = .dependencies -DEPFILES = $(subst version.c,,$(OBJS:%.o=%.c) $(OBJS2:%.o=%.c)) +DEPFILES = $(subst i18n.c,,$(subst version.c,,$(OBJS:%.o=%.c))) $(DEPFILE): Makefile $(DEPFILES) $(wildcard *.h) @$(MAKEDEP) $(DEFINES) $(INCLUDES) $(DEPFILES) > $@ @@ -114,7 +125,7 @@ $(CXX) $(CXXFLAGS) -shared $(OBJS) -o $@ @cp $@ $(LIBDIR)/$@.$(APIVERSION) -$(I18Npot): $(shell grep -rl '\(tr\|trNOOP\)(\".*\")' *.c $(SYSDIR)) +$(I18Npot): $(shell grep -rl '\(tr\|trNOOP\)(\".*\")' *.c ) xgettext -C -cTRANSLATORS --no-wrap --no-location -k -ktr -ktrNOOP --msgid-bugs-address='' -o $@ $^ %.po: $(I18Npot) @@ -124,12 +135,15 @@ %.mo: %.po msgfmt -c -o $@ $< -$(I18Nmsgs): $(LOCALEDIR)/%/LC_MESSAGES/vdr-$(PLUGIN).mo: $(PODIR)/%.mo +$(I18Nmsgs): $(LOCALEDIR)/%/LC_MESSAGES/$(I18Nmo): $(PODIR)/%.mo @mkdir -p $(dir $@) cp $< $@ i18n: $(I18Nmsgs) +i18n.c: $(PODIR)/*.po i18n-template.c po2i18n.pl + perl ./po2i18n.pl i18n.c + version.c: FORCE @echo >$@.new "/* this file will be overwritten without warning */"; \ echo >>$@.new 'const char *PluginVersion =' '"'$(VERSION)'";'; \ @@ -147,7 +161,7 @@ clean: @-rm -f $(OBJS) $(DEPFILE) *.so *.tar.gz core* *~ - @-rm -f version.c + @-rm -f version.c i18n.c @-rm -f $(PODIR)/*.mo FORCE: