]> git.vomp.tv Git - jsonserver.git/blob - Makefile
Find event for timer in list even when timer is inactive
[jsonserver.git] / Makefile
1 #
2 # Makefile for a Video Disk Recorder plugin
3 #
4 # $Id$
5
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!
11 #
12 PLUGIN = jsonserver
13
14 ### The version number of this plugin (taken from the main source file):
15
16 VERSION = $(shell grep 'static const char \*VERSION *=' $(PLUGIN).c | awk '{ print $$6 }' | sed -e 's/[";]//g')
17
18 ### The C++ compiler and options:
19
20 CXX      ?= g++
21 CXXFLAGS ?= -g -O3 -Wall -Werror=overloaded-virtual -Wno-parentheses -fpermissive
22
23 ### The directory environment:
24
25 VDRDIR ?= ../../..
26 LIBDIR ?= ../../lib
27 TMPDIR ?= /tmp
28
29 ### Make sure that necessary options are included:
30
31 include $(VDRDIR)/Make.global
32
33 ### Allow user defined options to overwrite defaults:
34
35 -include $(VDRDIR)/Make.config
36
37 ### The version number of VDR's plugin API (taken from VDR's "config.h"):
38
39 APIVERSION = $(shell sed -ne '/define APIVERSION/s/^.*"\(.*\)".*$$/\1/p' $(VDRDIR)/config.h)
40
41 ### The name of the distribution archive:
42
43 ARCHIVE = $(PLUGIN)-$(VERSION)
44 PACKAGE = vdr-$(ARCHIVE)
45
46 ### Includes and Defines (add further entries here):
47
48 INCLUDES += -I$(VDRDIR)/include
49
50 DEFINES += -D_GNU_SOURCE -DPLUGIN_NAME_I18N='"$(PLUGIN)"'
51
52 ### The object files (add further files here):
53
54 OBJS = $(PLUGIN).o mongoose.o handler.o log.o config.o
55
56 ### The main target:
57
58 all: libvdr-$(PLUGIN).so i18n
59
60 ### Implicit rules:
61
62 %.o: %.c
63         $(CXX) $(CXXFLAGS) -c $(DEFINES) $(INCLUDES) $<
64
65 ### Dependencies:
66
67 MAKEDEP = $(CXX) -MM -MG
68 DEPFILE = .dependencies
69 $(DEPFILE): Makefile
70         @$(MAKEDEP) $(DEFINES) $(INCLUDES) $(OBJS:%.o=%.c) > $@
71
72 -include $(DEPFILE)
73
74 ### Internationalization (I18N):
75
76 PODIR     = po
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
81
82 %.mo: %.po
83         msgfmt -c -o $@ $<
84
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 $@ $^
87
88 %.po: $(I18Npot)
89         msgmerge -U --no-wrap --no-location --backup=none -q $@ $<
90         @touch $@
91
92 $(I18Nmsgs): $(LOCALEDIR)/%/LC_MESSAGES/vdr-$(PLUGIN).mo: $(PODIR)/%.mo
93         @mkdir -p $(dir $@)
94         cp $< $@
95
96 .PHONY: i18n
97 i18n: $(I18Nmsgs) $(I18Npot)
98
99 ### Targets:
100
101 libvdr-$(PLUGIN).so: $(OBJS)
102         $(CXX) $(CXXFLAGS) $(LDFLAGS) -shared $(OBJS) -ljsoncpp -o $@
103         @cp --remove-destination $@ $(LIBDIR)/$@.$(APIVERSION)
104
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
112
113 clean:
114         @-rm -f $(OBJS) $(DEPFILE) *.so *.tgz core* *~ $(PODIR)/*.mo $(PODIR)/*.pot