1.1 --- a/Makefile Mon Jan 28 17:22:15 2008 +0100
1.2 +++ b/Makefile Mon Jan 28 17:39:51 2008 +0100
1.3 @@ -82,24 +82,35 @@
1.4
1.5 PODIR = po
1.6 I18Npot = $(PODIR)/$(PLUGIN).pot
1.7 -I18Nmsgs = $(addprefix $(LOCALEDIR)/,$(addsuffix /LC_MESSAGES/vdr-$(PLUGIN).mo,$(notdir $(foreach file, $(wildcard $(PODIR)/*.po), $(basename $(file))))))
1.8 +I18Npots := $(notdir $(foreach file, $(wildcard $(PODIR)/*.po), $(basename $(file))))
1.9 +ifeq ($(strip $(APIVERSION)),1.5.7)
1.10 + I18Nmo = $(PLUGIN).mo
1.11 +else
1.12 + I18Nmo = vdr-$(PLUGIN).mo
1.13 +endif
1.14 LOCALEDIR = $(VDRDIR)/locale
1.15 +I18Nmsgs := $(addprefix $(LOCALEDIR)/,$(addsuffix /LC_MESSAGES/$(I18Nmo),$(I18Npots)))
1.16 +
1.17 +HASLOCALE = $(shell grep -l 'I18N_DEFAULT_LOCALE' $(VDRDIR)/include/vdr/i18n.h)
1.18 +ifeq ($(strip $(HASLOCALE)),)
1.19 + OBJS += i18n.o
1.20 +endif
1.21
1.22 ### Targets:
1.23
1.24 TARGETS = libvdr-$(PLUGIN).so
1.25 -ifneq ($(shell grep -l 'Phrases' $(VDRDIR)/i18n.c),$(VDRDIR)/i18n.c)
1.26 -TARGETS += i18n
1.27 +ifneq ($(strip $(HASLOCALE)),)
1.28 + TARGETS += i18n
1.29 endif
1.30
1.31 all: $(TARGETS)
1.32 -.PHONY: i18n
1.33 +.PHONY: i18n clean dist
1.34
1.35 # Dependencies:
1.36
1.37 MAKEDEP = $(CXX) -MM -MG
1.38 DEPFILE = .dependencies
1.39 -DEPFILES = $(subst version.c,,$(OBJS:%.o=%.c) $(OBJS2:%.o=%.c))
1.40 +DEPFILES = $(subst i18n.c,,$(subst version.c,,$(OBJS:%.o=%.c)))
1.41 $(DEPFILE): Makefile $(DEPFILES) $(wildcard *.h)
1.42 @$(MAKEDEP) $(DEFINES) $(INCLUDES) $(DEPFILES) > $@
1.43
1.44 @@ -114,7 +125,7 @@
1.45 $(CXX) $(CXXFLAGS) -shared $(OBJS) -o $@
1.46 @cp $@ $(LIBDIR)/$@.$(APIVERSION)
1.47
1.48 -$(I18Npot): $(shell grep -rl '\(tr\|trNOOP\)(\".*\")' *.c $(SYSDIR))
1.49 +$(I18Npot): $(shell grep -rl '\(tr\|trNOOP\)(\".*\")' *.c )
1.50 xgettext -C -cTRANSLATORS --no-wrap --no-location -k -ktr -ktrNOOP --msgid-bugs-address='<s.huelswitt@gmx.de>' -o $@ $^
1.51
1.52 %.po: $(I18Npot)
1.53 @@ -124,12 +135,15 @@
1.54 %.mo: %.po
1.55 msgfmt -c -o $@ $<
1.56
1.57 -$(I18Nmsgs): $(LOCALEDIR)/%/LC_MESSAGES/vdr-$(PLUGIN).mo: $(PODIR)/%.mo
1.58 +$(I18Nmsgs): $(LOCALEDIR)/%/LC_MESSAGES/$(I18Nmo): $(PODIR)/%.mo
1.59 @mkdir -p $(dir $@)
1.60 cp $< $@
1.61
1.62 i18n: $(I18Nmsgs)
1.63
1.64 +i18n.c: $(PODIR)/*.po i18n-template.c po2i18n.pl
1.65 + perl ./po2i18n.pl <i18n-template.c >i18n.c
1.66 +
1.67 version.c: FORCE
1.68 @echo >$@.new "/* this file will be overwritten without warning */"; \
1.69 echo >>$@.new 'const char *PluginVersion =' '"'$(VERSION)'";'; \
1.70 @@ -147,7 +161,7 @@
1.71
1.72 clean:
1.73 @-rm -f $(OBJS) $(DEPFILE) *.so *.tar.gz core* *~
1.74 - @-rm -f version.c
1.75 + @-rm -f version.c i18n.c
1.76 @-rm -f $(PODIR)/*.mo
1.77
1.78 FORCE: