2011-12-07 15:06:57 +01:00
|
|
|
#
|
|
|
|
# Makefile for a Video Disk Recorder plugin
|
|
|
|
#
|
|
|
|
# $Id$
|
|
|
|
|
|
|
|
# The official name of this plugin.
|
|
|
|
# This name will be used in the '-P...' option of VDR to load the plugin.
|
|
|
|
# By default the main source file also carries this name.
|
|
|
|
# IMPORTANT: the presence of this macro is important for the Make.config
|
|
|
|
# file. So it must be defined, even if it is not used here!
|
|
|
|
#
|
|
|
|
PLUGIN = softhddevice
|
|
|
|
|
|
|
|
### The version number of this plugin (taken from the main source file):
|
|
|
|
|
2011-12-11 19:43:37 +01:00
|
|
|
VERSION = $(shell grep 'static const char \*const VERSION *=' $(PLUGIN).cpp | awk '{ print $$7 }' | sed -e 's/[";]//g')
|
2012-01-16 15:42:17 +01:00
|
|
|
GIT_REV = $(shell git describe --always 2>/dev/null)
|
2011-12-07 15:06:57 +01:00
|
|
|
|
2011-12-21 12:50:14 +01:00
|
|
|
### Configuration (edit this for your needs)
|
|
|
|
|
2012-08-07 16:46:23 +02:00
|
|
|
CONFIG := #-DDEBUG #-DOSD_DEBUG
|
2012-02-22 18:37:50 +01:00
|
|
|
CONFIG += -DAV_INFO -DAV_INFO_TIME=3000 # debug a/v sync
|
2013-01-05 19:49:59 +01:00
|
|
|
CONFIG += -DUSE_PIP # too experimental PIP support
|
2012-02-21 20:55:28 +01:00
|
|
|
#CONFIG += -DHAVE_PTHREAD_NAME # supports new pthread_setname_np
|
2012-03-03 18:47:07 +01:00
|
|
|
#CONFIG += -DNO_TS_AUDIO # disable ts audio parser
|
2012-02-27 23:13:53 +01:00
|
|
|
#CONFIG += -DUSE_TS_VIDEO # build new ts video parser
|
2013-01-24 21:42:39 +01:00
|
|
|
# use ffmpeg libswresample
|
|
|
|
CONFIG += $(shell pkg-config --exists libswresample && echo "-DUSE_SWRESAMPLE")
|
2011-12-21 12:50:14 +01:00
|
|
|
CONFIG += $(shell pkg-config --exists vdpau && echo "-DUSE_VDPAU")
|
2012-01-03 21:31:03 +01:00
|
|
|
CONFIG += $(shell pkg-config --exists libva && echo "-DUSE_VAAPI")
|
2011-12-31 18:55:07 +01:00
|
|
|
CONFIG += $(shell pkg-config --exists alsa && echo "-DUSE_ALSA")
|
2012-01-16 15:42:17 +01:00
|
|
|
CONFIG += -DUSE_OSS
|
2011-12-21 12:50:14 +01:00
|
|
|
|
2011-12-07 15:06:57 +01:00
|
|
|
### The C++ compiler and options:
|
|
|
|
|
2012-02-12 20:30:50 +01:00
|
|
|
CC ?= gcc
|
|
|
|
CXX ?= g++
|
|
|
|
CFLAGS ?= -g -O2 -W -Wall -Wextra -Winit-self \
|
|
|
|
-Wdeclaration-after-statement \
|
2013-01-05 19:49:59 +01:00
|
|
|
-ftree-vectorize -msse3 -flax-vector-conversions -fPIC
|
|
|
|
CXXFLAGS ?= -g -O2 -W -Wall -Wextra -Werror=overloaded-virtual -fPIC
|
2011-12-07 15:06:57 +01:00
|
|
|
|
|
|
|
### The directory environment:
|
|
|
|
|
2012-01-10 22:48:42 +01:00
|
|
|
VDRDIR ?= ../../..
|
|
|
|
LIBDIR ?= ../../lib
|
|
|
|
TMPDIR ?= /tmp
|
2011-12-07 15:06:57 +01:00
|
|
|
|
|
|
|
### Make sure that necessary options are included:
|
|
|
|
|
2012-06-29 15:13:38 +02:00
|
|
|
-include $(VDRDIR)/Make.global
|
2011-12-07 15:06:57 +01:00
|
|
|
|
|
|
|
### Allow user defined options to overwrite defaults:
|
|
|
|
|
|
|
|
-include $(VDRDIR)/Make.config
|
|
|
|
|
|
|
|
### The version number of VDR's plugin API (taken from VDR's "config.h"):
|
|
|
|
|
|
|
|
APIVERSION = $(shell sed -ne '/define APIVERSION/s/^.*"\(.*\)".*$$/\1/p' $(VDRDIR)/config.h)
|
|
|
|
|
|
|
|
### The name of the distribution archive:
|
|
|
|
|
|
|
|
ARCHIVE = $(PLUGIN)-$(VERSION)
|
|
|
|
PACKAGE = vdr-$(ARCHIVE)
|
|
|
|
|
2012-01-10 22:48:42 +01:00
|
|
|
### Includes, Defines and dependencies (add further entries here):
|
2011-12-07 15:06:57 +01:00
|
|
|
|
|
|
|
INCLUDES += -I$(VDRDIR)/include
|
|
|
|
|
2012-01-16 15:42:17 +01:00
|
|
|
DEFINES += $(CONFIG) -D_GNU_SOURCE -DPLUGIN_NAME_I18N='"$(PLUGIN)"' \
|
|
|
|
$(if $(GIT_REV), -DGIT_REV='"$(GIT_REV)"')
|
2011-12-07 15:06:57 +01:00
|
|
|
|
2012-01-10 22:48:42 +01:00
|
|
|
_CFLAGS = $(DEFINES) $(INCLUDES) \
|
2012-02-21 20:55:28 +01:00
|
|
|
$(shell pkg-config --cflags libavcodec) \
|
2012-01-10 22:48:42 +01:00
|
|
|
`pkg-config --cflags x11 x11-xcb xcb xcb-xv xcb-shm xcb-dpms xcb-atom\
|
|
|
|
xcb-screensaver xcb-randr xcb-glx xcb-icccm xcb-keysyms`\
|
|
|
|
`pkg-config --cflags gl glu` \
|
2013-01-24 21:42:39 +01:00
|
|
|
$(if $(findstring USE_SWRESAMPLE,$(CONFIG)), \
|
|
|
|
$(shell pkg-config --cflags libswresample)) \
|
2012-01-10 22:48:42 +01:00
|
|
|
$(if $(findstring USE_VAAPI,$(CONFIG)), \
|
2013-01-24 21:42:39 +01:00
|
|
|
`pkg-config --cflags libva-x11 libva-glx libva`) \
|
2012-01-10 22:48:42 +01:00
|
|
|
$(if $(findstring USE_ALSA,$(CONFIG)), \
|
2013-01-24 21:42:39 +01:00
|
|
|
`pkg-config --cflags alsa`)
|
2012-01-10 22:48:42 +01:00
|
|
|
|
|
|
|
#override _CFLAGS += -Werror
|
|
|
|
override CXXFLAGS += $(_CFLAGS)
|
2012-02-12 20:30:50 +01:00
|
|
|
override CFLAGS += $(_CFLAGS)
|
2012-01-10 22:48:42 +01:00
|
|
|
|
|
|
|
LIBS += -lrt \
|
2012-02-21 20:55:28 +01:00
|
|
|
$(shell pkg-config --libs libavcodec) \
|
2012-01-10 22:48:42 +01:00
|
|
|
`pkg-config --libs x11 x11-xcb xcb xcb-xv xcb-shm xcb-dpms xcb-atom\
|
|
|
|
xcb-screensaver xcb-randr xcb-glx xcb-icccm xcb-keysyms`\
|
|
|
|
`pkg-config --libs gl glu` \
|
2013-01-24 21:42:39 +01:00
|
|
|
$(if $(findstring USE_SWRESAMPLE,$(CONFIG)), \
|
|
|
|
$(shell pkg-config --libs libswresample)) \
|
2012-01-10 22:48:42 +01:00
|
|
|
$(if $(findstring USE_VDPAU,$(CONFIG)), \
|
2013-01-24 21:42:39 +01:00
|
|
|
`pkg-config --libs vdpau`) \
|
2012-01-10 22:48:42 +01:00
|
|
|
$(if $(findstring USE_VAAPI,$(CONFIG)), \
|
2013-01-24 21:42:39 +01:00
|
|
|
`pkg-config --libs libva-x11 libva-glx libva`) \
|
2012-01-10 22:48:42 +01:00
|
|
|
$(if $(findstring USE_ALSA,$(CONFIG)), \
|
2013-01-24 21:42:39 +01:00
|
|
|
`pkg-config --libs alsa`)
|
2012-01-10 22:48:42 +01:00
|
|
|
|
2011-12-07 15:06:57 +01:00
|
|
|
### The object files (add further files here):
|
|
|
|
|
|
|
|
OBJS = $(PLUGIN).o softhddev.o video.o audio.o codec.o ringbuffer.o
|
|
|
|
SRCS = $(wildcard $(OBJS:.o=.c)) $(PLUGIN).cpp
|
|
|
|
|
|
|
|
### The main target:
|
|
|
|
|
|
|
|
all: libvdr-$(PLUGIN).so i18n
|
|
|
|
|
|
|
|
### Implicit rules:
|
|
|
|
#
|
|
|
|
#%.o: %.cpp
|
|
|
|
# $(CXX) $(CXXFLAGS) -c $(DEFINES) $(INCLUDES) $<
|
|
|
|
|
|
|
|
### Dependencies:
|
|
|
|
|
|
|
|
MAKEDEP = $(CC) -MM -MG
|
|
|
|
DEPFILE = .dependencies
|
|
|
|
$(DEPFILE): Makefile
|
|
|
|
@$(MAKEDEP) $(DEFINES) $(INCLUDES) $(SRCS) >$@
|
|
|
|
|
2012-01-12 15:19:19 +01:00
|
|
|
$(OBJS): Makefile
|
|
|
|
|
2011-12-07 15:06:57 +01:00
|
|
|
-include $(DEPFILE)
|
|
|
|
|
|
|
|
### Internationalization (I18N):
|
|
|
|
|
2012-02-12 20:30:50 +01:00
|
|
|
PODIR = po
|
2011-12-07 15:06:57 +01:00
|
|
|
LOCALEDIR = $(VDRDIR)/locale
|
2012-02-12 20:30:50 +01:00
|
|
|
I18Npo = $(wildcard $(PODIR)/*.po)
|
2011-12-07 15:06:57 +01:00
|
|
|
I18Nmsgs = $(addprefix $(LOCALEDIR)/, $(addsuffix /LC_MESSAGES/vdr-$(PLUGIN).mo, $(notdir $(foreach file, $(I18Npo), $(basename $(file))))))
|
2012-02-12 20:30:50 +01:00
|
|
|
I18Npot = $(PODIR)/$(PLUGIN).pot
|
2011-12-07 15:06:57 +01:00
|
|
|
|
|
|
|
%.mo: %.po
|
|
|
|
msgfmt -c -o $@ $<
|
|
|
|
|
2013-01-24 21:42:39 +01:00
|
|
|
$(I18Npot): $(wildcard *.cpp) $(wildcard *.c)
|
2011-12-07 15:06:57 +01:00
|
|
|
xgettext -C -cTRANSLATORS --no-wrap --no-location -k -ktr -ktrNOOP \
|
|
|
|
-k_ -k_N --package-name=VDR --package-version=$(VDRVERSION) \
|
|
|
|
--msgid-bugs-address='<see README>' -o $@ $^
|
|
|
|
|
|
|
|
%.po: $(I18Npot)
|
|
|
|
msgmerge -U --no-wrap --no-location --backup=none -q $@ $<
|
|
|
|
@touch $@
|
|
|
|
|
|
|
|
$(I18Nmsgs): $(LOCALEDIR)/%/LC_MESSAGES/vdr-$(PLUGIN).mo: $(PODIR)/%.mo
|
|
|
|
@mkdir -p $(dir $@)
|
|
|
|
cp $< $@
|
|
|
|
|
|
|
|
.PHONY: i18n
|
|
|
|
i18n: $(I18Nmsgs) $(I18Npot)
|
|
|
|
|
|
|
|
### Targets:
|
|
|
|
|
|
|
|
libvdr-$(PLUGIN).so: $(OBJS) Makefile
|
2012-01-10 22:48:42 +01:00
|
|
|
$(CXX) $(CXXFLAGS) $(LDFLAGS) -shared -fPIC $(OBJS) -o $@ $(LIBS)
|
2011-12-07 15:06:57 +01:00
|
|
|
@cp --remove-destination $@ $(LIBDIR)/$@.$(APIVERSION)
|
|
|
|
|
|
|
|
dist: $(I18Npo) clean
|
|
|
|
@-rm -rf $(TMPDIR)/$(ARCHIVE)
|
|
|
|
@mkdir $(TMPDIR)/$(ARCHIVE)
|
|
|
|
@cp -a * $(TMPDIR)/$(ARCHIVE)
|
|
|
|
@tar czf $(PACKAGE).tgz -C $(TMPDIR) $(ARCHIVE)
|
|
|
|
@-rm -rf $(TMPDIR)/$(ARCHIVE)
|
|
|
|
@echo Distribution package created as $(PACKAGE).tgz
|
|
|
|
|
|
|
|
clean:
|
|
|
|
@-rm -f $(OBJS) $(DEPFILE) *.so *.tgz core* *~ $(PODIR)/*.mo $(PODIR)/*.pot
|
|
|
|
|
|
|
|
install: libvdr-$(PLUGIN).so
|
|
|
|
cp --remove-destination libvdr-$(PLUGIN).so \
|
|
|
|
/usr/lib/vdr/plugins/libvdr-$(PLUGIN).so.$(APIVERSION)
|
|
|
|
|
|
|
|
HDRS= $(wildcard *.h)
|
|
|
|
|
|
|
|
indent:
|
2013-01-05 19:49:59 +01:00
|
|
|
for i in $(SRCS) $(HDRS); do \
|
|
|
|
indent $$i; \
|
|
|
|
unexpand -a $$i | sed -e s/constconst/const/ > $$i.up; \
|
|
|
|
mv $$i.up $$i; \
|
2011-12-07 15:06:57 +01:00
|
|
|
done
|
|
|
|
|
2012-01-27 21:08:37 +01:00
|
|
|
video_test: video.c Makefile
|
2012-01-10 22:48:42 +01:00
|
|
|
$(CC) -DVIDEO_TEST -DVERSION='"$(VERSION)"' $(CFLAGS) $(LDFLAGS) $< $(LIBS) \
|
|
|
|
-o $@
|