File: Makefile

package info (click to toggle)
vdr-plugin-markad 4.2.15-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 2,084 kB
  • sloc: cpp: 22,441; python: 613; makefile: 270; sh: 95
file content (189 lines) | stat: -rw-r--r-- 5,057 bytes parent folder | download | duplicates (2)
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
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
#
# Makefile for a Video Disk Recorder addon
#

ifdef VERBOSE
Q =
else
Q = @
endif
export Q

# use this, if you want to debug heap memory consumption
# DEBUG_MEM_MARKAD=1

### Dependencies:
PKG_CONFIG ?= pkg-config

STRIP ?= strip

### The version number of this plugin (taken from the main source file):
$(shell GITVERSION=`git rev-parse --short HEAD 2> /dev/null`; if [ "$$GITVERSION" ]; then sed "s/\";/ ($$GITVERSION)\";/" ../version.dist > ../version.h; else cp ../version.dist ../version.h; fi)
VERSION = $(shell grep 'static const char \*VERSION *=' ../version.h | awk '{ print $$6 }' | sed -e 's/[";]//g')

# check if we want to build without vdr
ifndef NO_VDR
# Use package data if installed...otherwise assume we're under the VDR source directory:
PKGCFG   = $(if $(VDRDIR),$(shell $(PKG_CONFIG) --variable=$(1) $(VDRDIR)/vdr.pc),$(shell PKG_CONFIG_PATH="$$PKG_CONFIG_PATH:../../../.." $(PKG_CONFIG) --variable=$(1) vdr))
BINDIR   = $(call PKGCFG,bindir)
MANDIR   = $(call PKGCFG,mandir)
LIBDIR   = $(call PKGCFG,libdir)
LOCDIR   = $(call PKGCFG,locdir)
PLGCFG   = $(call PKGCFG,plgcfg)
CFGDIR   = $(call PKGCFG,configdir)
CXXFLAGS = $(call PKGCFG,cxxflags)
endif

### set defaults
BINDIR   ?= /usr/bin
LOCDIR   ?= /usr/share/locale
MANDIR   ?= /usr/share/man
CXX      ?= g++
CXXFLAGS ?= -g -fPIC -rdynamic -O3 -funroll-loops -Wall -Woverloaded-virtual -Wno-parentheses

### compiler version dependent options
CXXVERSION=$(shell $(CXX) -dumpversion | cut -d"." -f1)
$(info compiler: ${CXX})
$(info version:  ${CXXVERSION})
DEFINES += -DCXXVERSION=${CXXVERSION}
ifeq ($(CXXVERSION),4)
	export CXXFLAGS += -std=c++11 -Wno-missing-field-initializers # to prevent a lot of compiler warnings with g++ V4
        $(warning your compiler is deprecated, please update)
endif
ifeq ($(CXXVERSION),5)
	export CXXFLAGS += -std=c++11   # to prevent compiler errors with g++ V5
endif


### Includes and Defines (add further entries here):
PKG-LIBS += libavcodec libavutil libavformat libavfilter libswresample libswscale
PKG-INCLUDES += libavcodec libavutil libavformat libavfilter libswresample libswscale

DEFINES += -D_GNU_SOURCE
DEFINES += -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE
DEFINES += -D__STDC_CONSTANT_MACROS -D__USE_XOPEN_EXTENDED


# more debug compiler options
ifdef DEBUG_MEM_MARKAD
DEFINES += -DDEBUG_MEM
$(info option DEBUG_MEM_MARKAD is set)
endif

ifdef DEBUG_MARK_FRAMES
DEFINES += -DDEBUG_MARK_FRAMES=$(DEBUG_MARK_FRAMES)
$(info option DEBUG_MARK_FRAMES is set)
endif

ifdef DEBUG_SANITIZER
export CXXFLAGS += -fsanitize=address -fsanitize=leak -fsanitize=undefined
$(info sanitize option is set)
endif


INCLUDES += $(shell $(PKG_CONFIG) --cflags $(PKG-INCLUDES))
LIBS     += $(shell $(PKG_CONFIG) --libs $(PKG-LIBS)) -pthread


### The object files (add further files here):
OBJS=  evaluate.o 
OBJS+= debug.o
OBJS+= index.o
OBJS+= logo.o
OBJS+= encoder.o
OBJS+= decoder.o
OBJS+= audio.o
OBJS+= video.o
OBJS+= marks.o
OBJS+= markad-standalone.o
OBJS+= osd.o
OBJS+= criteria.o
OBJS+= vps.o
OBJS+= tools.o
OBJS+= overlap.o
OBJS+= sobel.o
OBJS+= test.o


### The main target:
all: markad i18n

### Implicit rules:
%.o: %.cpp
	$(CXX) $(CXXFLAGS) -c $(DEFINES) $(INCLUDES) $<


### debug heap allocations
ifdef DEBUG_MEM_MARKAD
DEFINES += -DDEBUG_MEM
$(info option DEBUG_MEM_MARKAD is set)
endif

INCLUDES += $(shell $(PKG_CONFIG) --cflags $(PKG-INCLUDES))
LIBS     += $(shell $(PKG_CONFIG) --libs $(PKG-LIBS)) -pthread


### The main target:
all: markad i18n

### Implicit rules:
%.o: %.cpp
	@echo CC $@
	$(Q)$(CXX) $(CXXFLAGS) -c $(DEFINES) $(INCLUDES) $<

### Dependencies:
MAKEDEP = $(CXX) -MM -MG
DEPFILE = .dependencies
$(DEPFILE): Makefile
	@$(MAKEDEP) $(DEFINES) $(INCLUDES) $(OBJS:%.o=%.cpp) > $@

-include $(DEPFILE)

### Internationalization (I18N):
PODIR     = po
I18Npo    = $(wildcard $(PODIR)/*.po)
I18Nmsgs  = $(addprefix  $(DESTDIR)$(LOCDIR)/, $(addsuffix /LC_MESSAGES/markad.mo, $(notdir $(foreach file, $(I18Npo), $(basename $(file))))))
I18Npot   = $(PODIR)/markad.pot

%.mo: %.po
	@echo MO $@
	$(Q)msgfmt -c -o $@ $<

$(I18Npot): $(wildcard *.cpp *.h)
	@echo GT $@
	$(Q)xgettext -C -cTRANSLATORS --no-wrap --no-location -k -ktr -ktrNOOP --msgid-bugs-address='<see README>' -o $@ $^

%.po: $(I18Npot)
	@echo PO $@
	$(Q)msgmerge -U --no-wrap --no-location --backup=none -q $@ $<
	@touch $@

$(I18Nmsgs): $(DESTDIR)$(LOCDIR)/%/LC_MESSAGES/markad.mo: $(PODIR)/%.mo
	@echo IN $@
	$(Q)install -D -m644 $< $@

.PHONY: i18n
i18n: $(I18Npot)

### Targets:
markad: $(OBJS)
	@echo CC $@
	$(Q)$(CXX) $(CXXFLAGS) $(LDFLAGS) $(OBJS) $(LIBS) -o $@


install-doc:
	@mkdir -p $(DESTDIR)$(MANDIR)/man1
	@gzip -c markad.1 > $(DESTDIR)$(MANDIR)/man1/markad.1.gz

install: install-doc markad $(I18Nmsgs)
	@mkdir -p $(DESTDIR)$(BINDIR)
	install -D markad $(DESTDIR)$(BINDIR)/markad
	@mkdir -p $(DESTDIR)/var/lib/markad
	install -D logos/* $(DESTDIR)/var/lib/markad
	@echo markad installed

clean:
	@-rm -f $(OBJS) $(DEPFILE) markad *.so *.so.* *.tgz core* *~ $(PODIR)/*.mo $(PODIR)/*.pot

doxygen:
	doxygen doxygen.conf