2 # libjsoncpp-dev libconfig++-dev libspdlog-dev
5 # Makefile for a Video Disk Recorder plugin
9 # The official name of this plugin.
10 # This name will be used in the '-P...' option of VDR to load the plugin.
11 # By default the main source file also carries this name.
15 ### The version number of this plugin (taken from the main source file):
17 VERSION = $(shell grep 'static const char \*VERSION *=' $(PLUGIN).c | awk '{ print $$6 }' | sed -e 's/[";]//g')
19 ### The directory environment:
21 # Use package data if installed...otherwise assume we're under the VDR source directory:
22 PKGCFG = $(if $(VDRDIR),$(shell pkg-config --variable=$(1) $(VDRDIR)/vdr.pc),$(shell PKG_CONFIG_PATH="$$PKG_CONFIG_PATH:../../.." pkg-config --variable=$(1) vdr))
23 LIBDIR = $(call PKGCFG,libdir)
24 LOCDIR = $(call PKGCFG,locdir)
25 PLGCFG = $(call PKGCFG,plgcfg)
29 ### The compiler options:
31 export CFLAGS = $(call PKGCFG,cflags)
32 export CXXFLAGS = $(call PKGCFG,cxxflags)
34 ### The version number of VDR's plugin API:
36 APIVERSION = $(call PKGCFG,apiversion)
38 ### Allow user defined options to overwrite defaults:
42 ### The name of the distribution archive:
44 ARCHIVE = $(PLUGIN)-$(VERSION)
45 PACKAGE = vdr-$(ARCHIVE)
47 ### The name of the shared object file:
49 SOFILE = libvdr-$(PLUGIN).so
51 ### Includes and Defines (add further entries here):
55 DEFINES += -DPLUGIN_NAME_I18N='"$(PLUGIN)"'
58 CXXFLAGS += -fpermissive
60 ### The object files (add further files here):
62 OBJS = $(PLUGIN).o httpdclient.o vdrclient.o
72 $(Q)$(CXX) $(CXXFLAGS) -c $(DEFINES) $(INCLUDES) -o $@ $<
76 MAKEDEP = $(CXX) -MM -MG
77 DEPFILE = .dependencies
79 @$(MAKEDEP) $(CXXFLAGS) $(DEFINES) $(INCLUDES) $(OBJS:%.o=%.c) > $@
83 ### Internationalization (I18N):
86 I18Npo = $(wildcard $(PODIR)/*.po)
87 I18Nmo = $(addsuffix .mo, $(foreach file, $(I18Npo), $(basename $(file))))
88 I18Nmsgs = $(addprefix $(DESTDIR)$(LOCDIR)/, $(addsuffix /LC_MESSAGES/vdr-$(PLUGIN).mo, $(notdir $(foreach file, $(I18Npo), $(basename $(file))))))
89 I18Npot = $(PODIR)/$(PLUGIN).pot
93 $(Q)msgfmt -c -o $@ $<
95 $(I18Npot): $(wildcard *.c)
97 $(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 $^`
101 $(Q)msgmerge -U --no-wrap --no-location --backup=none -q -N $@ $<
104 $(I18Nmsgs): $(DESTDIR)$(LOCDIR)/%/LC_MESSAGES/vdr-$(PLUGIN).mo: $(PODIR)/%.mo
105 install -D -m644 $< $@
108 i18n: $(I18Nmo) $(I18Npot)
110 install-i18n: $(I18Nmsgs)
116 $(Q)$(CXX) $(CXXFLAGS) $(LDFLAGS) -shared $(OBJS) -ljsoncpp -lconfig++ -lmicrohttpd -lfmt -o $@
118 install-lib: $(SOFILE)
119 install -D $^ $(DESTDIR)$(LIBDIR)/$^.$(APIVERSION)
121 install: install-lib install-i18n
123 dist: $(I18Npo) clean
124 @-rm -rf $(TMPDIR)/$(ARCHIVE)
125 @mkdir $(TMPDIR)/$(ARCHIVE)
126 @cp -a * $(TMPDIR)/$(ARCHIVE)
127 @tar czf $(PACKAGE).tgz -C $(TMPDIR) $(ARCHIVE)
128 @-rm -rf $(TMPDIR)/$(ARCHIVE)
129 @echo Distribution package created as $(PACKAGE).tgz
132 @-rm -f $(PODIR)/*.mo $(PODIR)/*.pot
133 @-rm -f $(OBJS) $(DEPFILE) *.so *.tgz core* *~