Makefile
branchtrunk
changeset 2 4c1f7b705009
parent 0 474a1293c3c0
child 5 b33ec9d72c19
equal deleted inserted replaced
1:a6fedb9b8528 2:4c1f7b705009
     1 #
     1 #
     2 # MP3/MPlayer plugin to VDR
     2 # MP3/MPlayer plugin to VDR
     3 #
     3 #
     4 # (C) 2001-2006 Stefan Huelswitt <s.huelswitt@gmx.de>
     4 # (C) 2001-2007 Stefan Huelswitt <s.huelswitt@gmx.de>
     5 #
     5 #
     6 # This code is free software; you can redistribute it and/or
     6 # This code is free software; you can redistribute it and/or
     7 # modify it under the terms of the GNU General Public License
     7 # modify it under the terms of the GNU General Public License
     8 # as published by the Free Software Foundation; either version 2
     8 # as published by the Free Software Foundation; either version 2
     9 # of the License, or (at your option) any later version.
     9 # of the License, or (at your option) any later version.
    95 
    95 
    96 ### The object files (add further files here):
    96 ### The object files (add further files here):
    97 
    97 
    98 ifndef WITHOUT_MP3
    98 ifndef WITHOUT_MP3
    99   ALL += libvdr-$(PLUGIN).so
    99   ALL += libvdr-$(PLUGIN).so
       
   100   ifneq ($(shell grep -l 'Phrases' $(VDRDIR)/i18n.c),$(VDRDIR)/i18n.c)
       
   101     ALL += i18n-$(PLUGIN)
       
   102   endif
   100 endif
   103 endif
   101 ifndef WITHOUT_MPLAYER
   104 ifndef WITHOUT_MPLAYER
   102   ALL += libvdr-$(PLUGIN2).so
   105   ALL += libvdr-$(PLUGIN2).so
       
   106   ifneq ($(shell grep -l 'Phrases' $(VDRDIR)/i18n.c),$(VDRDIR)/i18n.c)
       
   107     ALL += i18n-$(PLUGIN2)
       
   108   endif
   103 endif
   109 endif
   104 
   110 
   105 COM_OBJS = i18n.o data.o menu.o
   111 COM_OBJS = i18n.o data.o menu.o
   106 
   112 
   107 OBJS     = $(PLUGIN).o $(COM_OBJS)\
   113 OBJS     = $(PLUGIN).o $(COM_OBJS)\
   132 ifeq ($(shell test -f $(VDRDIR)/fontsym.h ; echo $$?),0)
   138 ifeq ($(shell test -f $(VDRDIR)/fontsym.h ; echo $$?),0)
   133   DEFINES += -DHAVE_BEAUTYPATCH
   139   DEFINES += -DHAVE_BEAUTYPATCH
   134 endif  
   140 endif  
   135 
   141 
   136 ifdef DBG
   142 ifdef DBG
   137 CXXFLAGS += -g
   143   CXXFLAGS += -g
   138 endif
   144 endif
   139 
   145 
   140 ### Implicit rules:
   146 ### Internationalization (I18N):
   141 
   147 
   142 %.o: %.c
   148 PODIR     = po
   143 	$(CXX) $(CXXFLAGS) -c $(DEFINES) $(INCLUDES) $<
   149 I18Npot   = $(PODIR)/mp3-mplayer.pot
       
   150 I18Npots  = $(notdir $(foreach file, $(wildcard $(PODIR)/*.po), $(basename $(file))))
       
   151 I18Nmsgs  = $(addprefix $(LOCALEDIR)/,$(addsuffix /LC_MESSAGES/vdr-$(PLUGIN).mo,$(I18Npots)))
       
   152 I18Nmsgs2 = $(addprefix $(LOCALEDIR)/,$(addsuffix /LC_MESSAGES/vdr-$(PLUGIN2).mo,$(I18Npots)))
       
   153 LOCALEDIR = $(VDRDIR)/locale
   144 
   154 
   145 # Dependencies:
   155 # Dependencies:
   146 
   156 
   147 MAKEDEP = g++ -MM -MG
   157 MAKEDEP = g++ -MM -MG
   148 DEPFILE = .dependencies
   158 DEPFILE = .dependencies
   152 -include $(DEPFILE)
   162 -include $(DEPFILE)
   153 
   163 
   154 ### Targets:
   164 ### Targets:
   155 
   165 
   156 all: $(ALL)
   166 all: $(ALL)
       
   167 .PHONY: i18n-$(PLUGIN) i18n-$(PLUGIN2)
       
   168 
       
   169 %.o: %.c
       
   170 	$(CXX) $(CXXFLAGS) -c $(DEFINES) $(INCLUDES) $<
   157 
   171 
   158 libvdr-$(PLUGIN).so: $(OBJS)
   172 libvdr-$(PLUGIN).so: $(OBJS)
   159 	$(CXX) $(CXXFLAGS) -shared $(OBJS) $(LIBS) -o $@
   173 	$(CXX) $(CXXFLAGS) -shared $(OBJS) $(LIBS) -o $@
   160 	@cp $@ $(LIBDIR)/$@.$(APIVERSION)
   174 	@cp $@ $(LIBDIR)/$@.$(APIVERSION)
   161 
   175 
   162 libvdr-$(PLUGIN2).so: $(OBJS2)
   176 libvdr-$(PLUGIN2).so: $(OBJS2)
   163 	$(CXX) $(CXXFLAGS) -shared $(OBJS2) $(LIBS2) -o $@
   177 	$(CXX) $(CXXFLAGS) -shared $(OBJS2) $(LIBS2) -o $@
   164 	@cp $@ $(LIBDIR)/$@.$(APIVERSION)
   178 	@cp $@ $(LIBDIR)/$@.$(APIVERSION)
   165 
   179 
   166 i18ntest: i18ntest.c i18n.c i18n.h
   180 $(I18Npot): $(shell grep -rl '\(tr\|trNOOP\)(\".*\")' *.c $(SYSDIR))
   167 	$(CXX) $(CXXFLAGS) $(INCLUDES) $< -o $@
   181 	xgettext -C -cTRANSLATORS --no-wrap -F -k -ktr -ktrNOOP --msgid-bugs-address='<s.huelswitt@gmx.de>' -o $@ $^
       
   182 
       
   183 %.po: $(I18Npot)
       
   184 	msgmerge -U --no-wrap -F --backup=none -q $@ $<
       
   185 	@touch $@
       
   186 
       
   187 %.mo: %.po
       
   188 	msgfmt -c -o $@ $<
       
   189 
       
   190 $(I18Nmsgs): $(LOCALEDIR)/%/LC_MESSAGES/vdr-$(PLUGIN).mo: $(PODIR)/%.mo
       
   191 	@mkdir -p $(dir $@)
       
   192 	cp $< $@
       
   193 
       
   194 i18n-$(PLUGIN): $(I18Nmsgs)
       
   195 
       
   196 $(I18Nmsgs2): $(LOCALEDIR)/%/LC_MESSAGES/vdr-$(PLUGIN2).mo: $(PODIR)/%.mo
       
   197 	@mkdir -p $(dir $@)
       
   198 	cp $< $@
       
   199 
       
   200 i18n-$(PLUGIN2): $(I18Nmsgs2)
   168 
   201 
   169 dist: clean
   202 dist: clean
   170 	@-rm -rf $(TMPDIR)/$(ARCHIVE)
   203 	@-rm -rf $(TMPDIR)/$(ARCHIVE)
   171 	@mkdir $(TMPDIR)/$(ARCHIVE)
   204 	@mkdir $(TMPDIR)/$(ARCHIVE)
   172 	@cp -a * $(TMPDIR)/$(ARCHIVE)
   205 	@cp -a * $(TMPDIR)/$(ARCHIVE)
   173 	@tar czf $(PACKAGE).tar.gz -C $(TMPDIR) $(ARCHIVE)
   206 	@tar czf $(PACKAGE).tar.gz -C $(TMPDIR) $(ARCHIVE)
   174 	@-rm -rf $(TMPDIR)/$(ARCHIVE)
   207 	@-rm -rf $(TMPDIR)/$(ARCHIVE)
   175 	@echo Distribution package created as $(PACKAGE).tar.gz
   208 	@echo Distribution package created as $(PACKAGE).tar.gz
   176 
   209 
   177 clean:
   210 clean:
   178 	@-rm -f $(OBJS) $(OBJS2) $(DEPFILE) i18ntest libvdr-*.so $(PACKAGE).tar.gz core* *~
   211 	@-rm -f $(OBJS) $(OBJS2) $(DEPFILE) libvdr-*.so $(PACKAGE).tar.gz core* *~
       
   212 	@-rm -f $(PODIR)/*.mo $(PODIR)/*.pot