80 |
80 |
81 ### Internationalization (I18N): |
81 ### Internationalization (I18N): |
82 |
82 |
83 PODIR = po |
83 PODIR = po |
84 I18Npot = $(PODIR)/$(PLUGIN).pot |
84 I18Npot = $(PODIR)/$(PLUGIN).pot |
85 I18Nmsgs = $(addprefix $(LOCALEDIR)/,$(addsuffix /LC_MESSAGES/vdr-$(PLUGIN).mo,$(notdir $(foreach file, $(wildcard $(PODIR)/*.po), $(basename $(file)))))) |
85 I18Npots := $(notdir $(foreach file, $(wildcard $(PODIR)/*.po), $(basename $(file)))) |
|
86 ifeq ($(strip $(APIVERSION)),1.5.7) |
|
87 I18Nmo = $(PLUGIN).mo |
|
88 else |
|
89 I18Nmo = vdr-$(PLUGIN).mo |
|
90 endif |
86 LOCALEDIR = $(VDRDIR)/locale |
91 LOCALEDIR = $(VDRDIR)/locale |
|
92 I18Nmsgs := $(addprefix $(LOCALEDIR)/,$(addsuffix /LC_MESSAGES/$(I18Nmo),$(I18Npots))) |
|
93 |
|
94 HASLOCALE = $(shell grep -l 'I18N_DEFAULT_LOCALE' $(VDRDIR)/include/vdr/i18n.h) |
|
95 ifeq ($(strip $(HASLOCALE)),) |
|
96 OBJS += i18n.o |
|
97 endif |
87 |
98 |
88 ### Targets: |
99 ### Targets: |
89 |
100 |
90 TARGETS = libvdr-$(PLUGIN).so |
101 TARGETS = libvdr-$(PLUGIN).so |
91 ifneq ($(shell grep -l 'Phrases' $(VDRDIR)/i18n.c),$(VDRDIR)/i18n.c) |
102 ifneq ($(strip $(HASLOCALE)),) |
92 TARGETS += i18n |
103 TARGETS += i18n |
93 endif |
104 endif |
94 |
105 |
95 all: $(TARGETS) |
106 all: $(TARGETS) |
96 .PHONY: i18n |
107 .PHONY: i18n clean dist |
97 |
108 |
98 # Dependencies: |
109 # Dependencies: |
99 |
110 |
100 MAKEDEP = $(CXX) -MM -MG |
111 MAKEDEP = $(CXX) -MM -MG |
101 DEPFILE = .dependencies |
112 DEPFILE = .dependencies |
102 DEPFILES = $(subst version.c,,$(OBJS:%.o=%.c) $(OBJS2:%.o=%.c)) |
113 DEPFILES = $(subst i18n.c,,$(subst version.c,,$(OBJS:%.o=%.c))) |
103 $(DEPFILE): Makefile $(DEPFILES) $(wildcard *.h) |
114 $(DEPFILE): Makefile $(DEPFILES) $(wildcard *.h) |
104 @$(MAKEDEP) $(DEFINES) $(INCLUDES) $(DEPFILES) > $@ |
115 @$(MAKEDEP) $(DEFINES) $(INCLUDES) $(DEPFILES) > $@ |
105 |
116 |
106 -include $(DEPFILE) |
117 -include $(DEPFILE) |
107 |
118 |
112 |
123 |
113 libvdr-$(PLUGIN).so: $(OBJS) |
124 libvdr-$(PLUGIN).so: $(OBJS) |
114 $(CXX) $(CXXFLAGS) -shared $(OBJS) -o $@ |
125 $(CXX) $(CXXFLAGS) -shared $(OBJS) -o $@ |
115 @cp $@ $(LIBDIR)/$@.$(APIVERSION) |
126 @cp $@ $(LIBDIR)/$@.$(APIVERSION) |
116 |
127 |
117 $(I18Npot): $(shell grep -rl '\(tr\|trNOOP\)(\".*\")' *.c $(SYSDIR)) |
128 $(I18Npot): $(shell grep -rl '\(tr\|trNOOP\)(\".*\")' *.c ) |
118 xgettext -C -cTRANSLATORS --no-wrap --no-location -k -ktr -ktrNOOP --msgid-bugs-address='<s.huelswitt@gmx.de>' -o $@ $^ |
129 xgettext -C -cTRANSLATORS --no-wrap --no-location -k -ktr -ktrNOOP --msgid-bugs-address='<s.huelswitt@gmx.de>' -o $@ $^ |
119 |
130 |
120 %.po: $(I18Npot) |
131 %.po: $(I18Npot) |
121 msgmerge -U --no-wrap --no-location --backup=none -q $@ $< |
132 msgmerge -U --no-wrap --no-location --backup=none -q $@ $< |
122 @touch $@ |
133 @touch $@ |
123 |
134 |
124 %.mo: %.po |
135 %.mo: %.po |
125 msgfmt -c -o $@ $< |
136 msgfmt -c -o $@ $< |
126 |
137 |
127 $(I18Nmsgs): $(LOCALEDIR)/%/LC_MESSAGES/vdr-$(PLUGIN).mo: $(PODIR)/%.mo |
138 $(I18Nmsgs): $(LOCALEDIR)/%/LC_MESSAGES/$(I18Nmo): $(PODIR)/%.mo |
128 @mkdir -p $(dir $@) |
139 @mkdir -p $(dir $@) |
129 cp $< $@ |
140 cp $< $@ |
130 |
141 |
131 i18n: $(I18Nmsgs) |
142 i18n: $(I18Nmsgs) |
|
143 |
|
144 i18n.c: $(PODIR)/*.po i18n-template.c po2i18n.pl |
|
145 perl ./po2i18n.pl <i18n-template.c >i18n.c |
132 |
146 |
133 version.c: FORCE |
147 version.c: FORCE |
134 @echo >$@.new "/* this file will be overwritten without warning */"; \ |
148 @echo >$@.new "/* this file will be overwritten without warning */"; \ |
135 echo >>$@.new 'const char *PluginVersion =' '"'$(VERSION)'";'; \ |
149 echo >>$@.new 'const char *PluginVersion =' '"'$(VERSION)'";'; \ |
136 diff $@.new $@ >$@.diff 2>&1; \ |
150 diff $@.new $@ >$@.diff 2>&1; \ |