2 # Makefile for a Video Disk Recorder plugin
6 # The official name of this plugin.
7 # This name will be used in the '-P...' option of VDR to load the plugin.
8 # By default the main source file also carries this name.
12 ### The version number of this plugin (taken from the main source file):
14 VERSION = $(shell grep 'static const char \*VERSION *=' $(PLUGIN).c | awk '{ print $$6 }' | sed -e 's/[";]//g')
16 ### The directory environment:
18 # Use package data if installed...otherwise assume we're under the VDR source directory:
19 PKGCFG = $(if $(VDRDIR),$(shell pkg-config --variable=$(1) $(VDRDIR)/vdr.pc),$(shell PKG_CONFIG_PATH="$$PKG_CONFIG_PATH:../../.." pkg-config --variable=$(1) vdr))
20 LIBDIR = $(call PKGCFG,libdir)
21 LOCDIR = $(call PKGCFG,locdir)
22 PLGCFG = $(call PKGCFG,plgcfg)
26 ### The compiler options:
28 export CFLAGS = $(call PKGCFG,cflags)
29 export CXXFLAGS = $(call PKGCFG,cxxflags)
31 ### The version number of VDR's plugin API:
33 APIVERSION = $(call PKGCFG,apiversion)
35 ### Allow user defined options to overwrite defaults:
43 ### The name of the distribution archive:
45 ARCHIVE = $(PLUGIN)-$(VERSION)
46 PACKAGE = vdr-$(ARCHIVE)
48 ### The name of the shared object file:
50 SOFILE = libvdr-$(PLUGIN).so
52 ### Includes and Defines (add further entries here):
56 DEFINES += -DPLUGIN_NAME_I18N='"$(PLUGIN)"'
59 DEFINES += -D__STL_CONFIG_H -DVOMPSERVER
62 ### The object files (add further files here):
67 OBJS += dsock.o dsock6.o mvpserver.o udpreplier.o udp6replier.o bootpd.o tftpd.o i18n.o \
68 vompclient.o tcp.o ringbuffer.o mvprelay.o vompclientrrproc.o \
69 config.o log.o thread.o tftpclient.o \
70 media.o responsepacket.o \
71 mediafile.o mediaplayer.o servermediafile.o serialize.o medialauncher.o \
74 OBJS2 = recplayer.o mvpreceiver.o
80 all: allbase $(SOFILE) # i18n
81 standalone: standalonebase vompserver-standalone
88 $(Q)$(CXX) $(CXXFLAGS) -c $(DEFINES) $(INCLUDES) -o $@ $<
92 MAKEDEP = $(CXX) -MM -MG
93 DEPFILE = .dependencies
95 @$(MAKEDEP) $(CXXFLAGS) $(DEFINES) $(INCLUDES) $(OBJS:%.o=%.c) > $@
99 ### Internationalization (I18N):
102 I18Npo = $(wildcard $(PODIR)/*.po)
103 I18Nmo = $(addsuffix .mo, $(foreach file, $(I18Npo), $(basename $(file))))
104 I18Nmsgs = $(addprefix $(DESTDIR)$(LOCDIR)/, $(addsuffix /LC_MESSAGES/vdr-$(PLUGIN).mo, $(notdir $(foreach file, $(I18Npo), $(basename $(file))))))
105 I18Npot = $(PODIR)/$(PLUGIN).pot
109 $(Q)msgfmt -c -o $@ $<
111 $(I18Npot): $(wildcard *.c)
113 $(Q)xgettext -C -cTRANSLATORS --no-wrap --no-location -k -ktr -ktrNOOP --package-name=vdr-$(PLUGIN) --package-version=$(VERSION) --msgid-bugs-address='<see README>' -o $@ `ls $^`
117 $(Q)msgmerge -U --no-wrap --no-location --backup=none -q -N $@ $<
120 $(I18Nmsgs): $(DESTDIR)$(LOCDIR)/%/LC_MESSAGES/vdr-$(PLUGIN).mo: $(PODIR)/%.mo
121 install -D -m644 $< $@
124 i18n: $(I18Nmo) $(I18Npot)
126 install-i18n: $(I18Nmsgs)
132 objectsstandalone: $(OBJS)
133 objects: $(OBJS) $(OBJS2)
136 ( if [ -f .standalone ] ; then ( rm -f .standalone; make clean ; make objects ) ; else exit 0 ;fi )
138 ( if [ ! -f .standalone ] ; then ( make clean; echo "DEFINES+=-DVOMPSTANDALONE" > .standalone; make objectsstandalone ) ; else exit 0 ;fi )
142 $(Q)$(CXX) $(CXXFLAGS) $(LDFLAGS) -shared $(OBJS) $(OBJS2) -o $@
144 vompserver-standalone: objectsstandalone
145 $(CXX) $(CXXFLAGS) $(OBJS) -lpthread -o $@
149 install-lib: $(SOFILE)
150 install -D $^ $(DESTDIR)$(LIBDIR)/$^.$(APIVERSION)
152 install: install-lib install-i18n
154 dist: $(I18Npo) clean
155 @-rm -rf $(TMPDIR)/$(ARCHIVE)
156 @mkdir $(TMPDIR)/$(ARCHIVE)
157 @cp -a * $(TMPDIR)/$(ARCHIVE)
158 @tar czf $(PACKAGE).tgz -C $(TMPDIR) $(ARCHIVE)
159 @-rm -rf $(TMPDIR)/$(ARCHIVE)
160 @echo Distribution package created as $(PACKAGE).tgz
163 @-rm -f $(PODIR)/*.mo $(PODIR)/*.pot
164 @-rm -f $(OBJS) $(DEPFILE) *.so *.tgz core* *~
166 @-rm -f $(OBJS2) .standalone vompserver-standalone