Repository navigation
Expand file tree
/
Copy pathMakefile
More file actions
154 lines (118 loc) · 5.28 KB
/
Copy pathMakefile
File metadata and controls
154 lines (118 loc) · 5.28 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
#
# Makefile for a Video Disk Recorder plugin
#
# $Id$
PLUGIN = restfulapi
USE_LIBMAGICKPLUSPLUS ?= 1
VERSION = $(shell grep 'static const char \*VERSION *=' $(PLUGIN).cpp | awk '{ print $$6 }' | sed -e 's/[";]//g')
PKGCFG = $(if $(VDRDIR),$(shell pkg-config --variable=$(1) $(VDRDIR)/vdr.pc),$(shell pkg-config --variable=$(1) vdr || pkg-config --variable=$(1) ../../../vdr.pc))
LIBDIR = $(call PKGCFG,libdir)
LOCDIR = $(call PKGCFG,locdir)
PLGCFG = $(call PKGCFG,plgcfg)
TMPDIR ?= /tmp
export CFLAGS = $(call PKGCFG,cflags)
export CXXFLAGS = $(call PKGCFG,cxxflags) -std=c++17
APIVERSION = $(call PKGCFG,apiversion)
-include $(PLGCFG)
ARCHIVE = $(PLUGIN)-$(VERSION)
PACKAGE = vdr-$(ARCHIVE)
SOFILE = libvdr-$(PLUGIN).so
DEFINES += -DPLUGIN_NAME_I18N='"$(PLUGIN)"'
LIBS += $(shell pkg-config --libs cxxtools-http 2>/dev/null || { cxxtools-config --libs; echo -lcxxtools-http; })
CONFDIR = $(call PKGCFG,configdir)
PLGCONFDIR = $(CONFDIR)/plugins/$(PLUGIN)
ifeq ($(USE_LIBMAGICKPLUSPLUS), 1)
INCLUDES += $(shell pkg-config --cflags Magick++)
LIBS += $(shell pkg-config --libs Magick++)
CXXFLAGS += -DUSE_LIBMAGICKPLUSPLUS
endif
OBJS = $(PLUGIN).o serverthread.o tools.o info.o searchtimers.o channels.o events.o recordings.o recordingmutation.o recordinganalysis.o recordingmoveanalysis.o recordingrenameplan.o recordingrenamepreflight.o recordingpreflight.o recordingmovepreflight.o recordingpreview.o recordingmovepreview.o recordingrenamepreview.o recordingexecution.o recordingmoveexecution.o recordingvalidate.o recordingmovevalidate.o recordingrenamevalidate.o recordingmoveexecutor.o recordingmove.o recordingrename.o recordingtrashexecutor.o recordingtrash.o remote.o timers.o changestate.o eventsstreamthread.o changestatetracker.o scraper2vdr.o statusmonitor.o osd.o jsonparser.o epgsearch.o wirbelscan.o webapp.o femon.o
CFGS = API.html
all: $(SOFILE) i18n
%.o: %.cpp
$(CXX) $(CXXFLAGS) -c $(DEFINES) $(INCLUDES) -o $@ $<
MAKEDEP = $(CXX) -MM -MG
DEPFILE = .dependencies
$(DEPFILE): Makefile
@$(MAKEDEP) $(CXXFLAGS) $(DEFINES) $(INCLUDES) $(OBJS:%.o=%.cpp) > $@
-include $(DEPFILE)
PODIR = po
I18Npo = $(wildcard $(PODIR)/*.po)
I18Nmo = $(addsuffix .mo, $(foreach file,$(I18Npo),$(basename $(file))))
I18Nmsgs = $(addprefix $(DESTDIR)$(LOCDIR)/, $(addsuffix /LC_MESSAGES/vdr-$(PLUGIN).mo, $(notdir $(foreach file,$(I18Npo),$(basename $(file))))))
I18Npot = $(PODIR)/$(PLUGIN).pot
%.mo: %.po
msgfmt -c -o $@ $<
$(I18Npot): $(wildcard *.cpp)
xgettext -C -cTRANSLATORS --no-wrap --no-location -k -ktr -ktrNOOP --package-name=vdr-$(PLUGIN) --package-version=$(VERSION) --msgid-bugs-address='<see README>' -o $@ `ls $^`
%.po: $(I18Npot)
msgmerge -U --no-wrap --no-location --backup=none -q -N $@ $<
@touch $@
$(I18Nmsgs): $(DESTDIR)$(LOCDIR)/%/LC_MESSAGES/vdr-$(PLUGIN).mo: $(PODIR)/%.mo
install -D -m644 $< $@
.PHONY: i18n test-recording-move-plan test-recording-move-analysis test-recording-move-preflight test-recording-move-execution-gate test-recording-rename-plan test-recording-rename-preflight
i18n: $(I18Nmo) $(I18Npot)
test-recording-move-plan:
$(CXX) -std=c++17 -Wall -Wextra \
recordingmutation.cpp \
tests/test_recording_move_plan.cpp \
-o /tmp/test_recording_move_plan
/tmp/test_recording_move_plan
test-recording-move-analysis:
$(CXX) -std=c++17 -Wall -Wextra \
recordingmutation.cpp \
recordingmoveanalysis.cpp \
tests/test_recording_move_analysis.cpp \
-o /tmp/test_recording_move_analysis
/tmp/test_recording_move_analysis
test-recording-move-preflight:
$(CXX) -std=c++17 -Wall -Wextra \
recordingmutation.cpp \
recordingmoveanalysis.cpp \
recordingmovepreflight.cpp \
tests/test_recording_move_preflight.cpp \
-o /tmp/test_recording_move_preflight
/tmp/test_recording_move_preflight
test-recording-move-execution-gate:
$(CXX) -std=c++17 -Wall -Wextra \
recordingmutation.cpp \
recordingmoveanalysis.cpp \
recordingmoveexecution.cpp \
tests/test_recording_move_execution_gate.cpp \
-o /tmp/test_recording_move_execution_gate
/tmp/test_recording_move_execution_gate
test-recording-rename-plan:
$(CXX) -std=c++17 -Wall -Wextra \
recordingrenameplan.cpp \
tests/test_recording_rename_plan.cpp \
-o /tmp/test_recording_rename_plan
/tmp/test_recording_rename_plan
test-recording-rename-preflight:
$(CXX) -std=c++17 -Wall -Wextra \
recordingmutation.cpp \
recordingmoveanalysis.cpp \
recordingrenameplan.cpp \
recordingrenamepreflight.cpp \
tests/test_recording_rename_preflight.cpp \
-o /tmp/test_recording_rename_preflight
/tmp/test_recording_rename_preflight
install-i18n: $(I18Nmsgs)
$(SOFILE): $(OBJS)
$(CXX) $(CXXFLAGS) $(LDFLAGS) -shared $(OBJS) -o $@ -Wl,--no-whole-archive $(LIBS)
install-lib: $(SOFILE)
install -D $^ $(DESTDIR)$(LIBDIR)/$^.$(APIVERSION)
install-cfg: $(CFGS)
install -D $^ $(DESTDIR)$(PLGCONFDIR)/$^
install: install-lib install-i18n install-cfg
dist: $(I18Npo) clean
@-rm -rf $(TMPDIR)/$(ARCHIVE)
@mkdir $(TMPDIR)/$(ARCHIVE)
@cp -a * $(TMPDIR)/$(ARCHIVE)
@-rm -rf $(TMPDIR)/$(ARCHIVE)/debian
@tar czf $(PACKAGE).tgz -C $(TMPDIR) $(ARCHIVE)
@echo Distribution package created as $(PACKAGE).tgz
clean:
@-rm -f $(PODIR)/*.mo $(PODIR)/*.pot
@-rm -f $(OBJS) $(DEPFILE) *.so *.tgz core* *~ ._*
archive:
git archive --format=tar.gz --prefix=vdr-plugin-restfulapi-${VERSION}/ --output=../vdr-plugin-restfulapi-${VERSION}.tar.gz master