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.
9 # IMPORTANT: the presence of this macro is important for the Make.config
10 # file. So it must be defined, even if it is not used here!
14 ### The version number of this plugin (taken from the main source file):
16 VERSION = $(shell grep 'static const char \*VERSION *=' $(PLUGIN).c | awk '{ print $$6 }' | sed -e 's/[";]//g')
18 ### The C++ compiler and options:
21 CXXFLAGS ?= -g -O3 -Wall -Werror=overloaded-virtual -Wno-parentheses -fpermissive
23 ### The directory environment:
29 ### Make sure that necessary options are included:
31 include $(VDRDIR)/Make.global
33 ### Allow user defined options to overwrite defaults:
35 -include $(VDRDIR)/Make.config
37 ### The version number of VDR's plugin API (taken from VDR's "config.h"):
39 APIVERSION = $(shell sed -ne '/define APIVERSION/s/^.*"\(.*\)".*$$/\1/p' $(VDRDIR)/config.h)
41 ### The name of the distribution archive:
43 ARCHIVE = $(PLUGIN)-$(VERSION)
44 PACKAGE = vdr-$(ARCHIVE)
46 ### Includes and Defines (add further entries here):
48 INCLUDES += -I$(VDRDIR)/include
50 DEFINES += -D_GNU_SOURCE -DPLUGIN_NAME_I18N='"$(PLUGIN)"'
52 ### The object files (add further files here):
54 OBJS = $(PLUGIN).o mongoose.o handler.o log.o config.o
58 all: libvdr-$(PLUGIN).so i18n
63 $(CXX) $(CXXFLAGS) -c $(DEFINES) $(INCLUDES) $<
67 MAKEDEP = $(CXX) -MM -MG
68 DEPFILE = .dependencies
70 @$(MAKEDEP) $(DEFINES) $(INCLUDES) $(OBJS:%.o=%.c) > $@
74 ### Internationalization (I18N):
77 LOCALEDIR = $(VDRDIR)/locale
78 I18Npo = $(wildcard $(PODIR)/*.po)
79 I18Nmsgs = $(addprefix $(LOCALEDIR)/, $(addsuffix /LC_MESSAGES/vdr-$(PLUGIN).mo, $(notdir $(foreach file, $(I18Npo), $(basename $(file))))))
80 I18Npot = $(PODIR)/$(PLUGIN).pot
85 $(I18Npot): $(wildcard *.c)
86 xgettext -C -cTRANSLATORS --no-wrap --no-location -k -ktr -ktrNOOP --package-name=vdr-$(PLUGIN) --package-version=$(VERSION) --msgid-bugs-address='<see README>' -o $@ $^
89 msgmerge -U --no-wrap --no-location --backup=none -q $@ $<
92 $(I18Nmsgs): $(LOCALEDIR)/%/LC_MESSAGES/vdr-$(PLUGIN).mo: $(PODIR)/%.mo
97 i18n: $(I18Nmsgs) $(I18Npot)
101 libvdr-$(PLUGIN).so: $(OBJS)
102 $(CXX) $(CXXFLAGS) $(LDFLAGS) -shared $(OBJS) -ljsoncpp -o $@
103 @cp --remove-destination $@ $(LIBDIR)/$@.$(APIVERSION)
105 dist: $(I18Npo) clean
106 @-rm -rf $(TMPDIR)/$(ARCHIVE)
107 @mkdir $(TMPDIR)/$(ARCHIVE)
108 @cp -a * $(TMPDIR)/$(ARCHIVE)
109 @tar czf $(PACKAGE).tgz -C $(TMPDIR) $(ARCHIVE)
110 @-rm -rf $(TMPDIR)/$(ARCHIVE)
111 @echo Distribution package created as $(PACKAGE).tgz
114 @-rm -f $(OBJS) $(DEPFILE) *.so *.tgz core* *~ $(PODIR)/*.mo $(PODIR)/*.pot