diff options
Diffstat (limited to 'Makefile')
-rw-r--r-- | Makefile | 153 |
1 files changed, 55 insertions, 98 deletions
@@ -1,22 +1,23 @@ # # Makefile for a Video Disk Recorder plugin # -# $Id: Makefile,v 1.21 2010/06/04 18:32:34 schmirl Exp $ +# $Id: Makefile,v 1.23 2010/08/02 10:36:59 schmirl Exp $ -# 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. +# The main source file name. # PLUGIN = streamdev -### The version number of this plugin (taken from the main source file): - -VERSION = $(shell grep 'const char \*VERSION *=' common.c | awk '{ print $$5 }' | sed -e 's/[";]//g') +### The C/C++ compiler and options: -### The C++ compiler and options: +CC ?= gcc +CFLAGS ?= -g -O2 -Wall CXX ?= g++ -CXXFLAGS ?= -fPIC -g -O2 -Wall -Woverloaded-virtual -Wno-parentheses +CXXFLAGS ?= -g -O2 -Wall -Woverloaded-virtual -Wno-parentheses + +### The version number of this plugin (taken from the main source file): + +VERSION = $(shell grep 'const char \*VERSION *=' common.c | awk '{ print $$5 }' | sed -e 's/[";]//g') ### The directory environment: @@ -24,119 +25,72 @@ VDRDIR = ../../.. LIBDIR = ../../lib TMPDIR = /tmp -### Allow user defined options to overwrite defaults: - --include $(VDRDIR)/Make.config - ### The version number of VDR (taken from VDR's "config.h"): APIVERSION = $(shell grep 'define APIVERSION ' $(VDRDIR)/config.h | awk '{ print $$3 }' | sed -e 's/"//g') APIVERSNUM = $(shell grep 'define APIVERSNUM ' $(VDRDIR)/config.h | awk '{ print $$3 }' | sed -e 's/"//g') TSPLAYVERSNUM = $(shell grep 'define TSPLAY_PATCH_VERSION ' $(VDRDIR)/device.h | awk '{ print $$3 }') -### The name of the distribution archive: - -ARCHIVE = $(PLUGIN)-$(VERSION) -PACKAGE = vdr-$(ARCHIVE) - -### Includes and Defines (add further entries here): - -INCLUDES += -I$(VDRDIR)/include -I. - -DEFINES += -D_GNU_SOURCE -DPLUGIN_NAME_I18N='"$(PLUGIN)"' +### Allow user defined options to overwrite defaults: +ifeq ($(shell test $(APIVERSNUM) -ge 10713; echo $$?),0) +include $(VDRDIR)/Make.global +else ifeq ($(shell test $(APIVERSNUM) -ge 10704 -o -n "$(TSPLAYVERSNUM)" ; echo $$?),0) - DEFINES += -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE +DEFINES += -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE +CFLAGS += -fPIC +CXXFLAGS += -fPIC +else +CFLAGS += -fPIC +CXXFLAGS += -fPIC endif - -### The object files (add further files here): - -COMMONOBJS = common.o \ - \ - tools/source.o tools/select.o tools/socket.o tools/tools.o - -CLIENTOBJS = $(PLUGIN)-client.o \ - \ - client/socket.o client/device.o client/setup.o \ - client/filter.o - - -SERVEROBJS = $(PLUGIN)-server.o \ - \ - server/server.o server/component.o server/connection.o \ - server/componentVTP.o server/componentHTTP.o server/componentIGMP.o \ - server/connectionVTP.o server/connectionHTTP.o server/connectionIGMP.o \ - server/streamer.o server/livestreamer.o server/livefilter.o \ - server/suspend.o server/setup.o server/menuHTTP.o server/recplayer.o \ - remux/tsremux.o remux/ts2pes.o remux/ts2ps.o remux/ts2es.o remux/extern.o - -ifdef DEBUG - DEFINES += -DDEBUG endif -### The main target: - -.PHONY: all i18n dist clean -all: libvdr-$(PLUGIN)-client.so libvdr-$(PLUGIN)-server.so i18n - -### Implicit rules: - -%.o: %.c - $(CXX) $(CXXFLAGS) -c $(DEFINES) $(INCLUDES) -o $@ $< +-include $(VDRDIR)/Make.config -# Dependencies: +### export all vars for sub-makes, using absolute paths -MAKEDEP = $(CXX) -MM -MG -DEPFILE = .dependencies -ifdef GCC3 -$(DEPFILE): Makefile - @rm -f $@ - @for i in $(CLIENTOBJS:%.o=%.c) $(SERVEROBJS:%.o=%.c) $(COMMONOBJS:%.o=%.c) ; do \ - $(MAKEDEP) $(DEFINES) $(INCLUDES) -MT "`dirname $$i`/`basename $$i .c`.o" $$i >>$@ ; \ - done -else -$(DEPFILE): Makefile - @$(MAKEDEP) $(DEFINES) $(INCLUDES) $(CLIENTOBJS:%.o=%.c) $(SERVEROBJS:%.o=%.c) \ - $(COMMONOBJS:%.o=%.c) > $@ -endif +VDRDIR := $(shell cd $(VDRDIR) >/dev/null 2>&1 && pwd) +LIBDIR := $(shell cd $(LIBDIR) >/dev/null 2>&1 && pwd) +export +unexport PLUGIN --include $(DEPFILE) +### The name of the distribution archive: -### Internationalization (I18N): +ARCHIVE = $(PLUGIN)-$(VERSION) +PACKAGE = vdr-$(ARCHIVE) -PODIR = po -LOCALEDIR = $(VDRDIR)/locale -I18Npo = $(wildcard $(PODIR)/*.po) -I18Nmsgs = $(addprefix $(LOCALEDIR)/, $(addsuffix /LC_MESSAGES/vdr-$(PLUGIN).mo, $(notdir $(foreach file, $(I18Npo), $(basename $(file)))))) -I18Npot = $(PODIR)/$(PLUGIN).pot +### Includes and Defines (add further entries here): -%.mo: %.po - msgfmt -c -o $@ $< +INCLUDES += -I$(VDRDIR)/include -I.. -$(I18Npot): $(CLIENTOBJS:%.o=%.c) $(SERVEROBJS:%.o=%.c) $(COMMONOBJS:%.o=%.c) - xgettext -C -cTRANSLATORS --no-wrap --no-location -k -ktr -ktrNOOP --msgid-bugs-address='<http://www.vdr-developer.org/mantisbt/>' -o $@ $^ +DEFINES += -D_GNU_SOURCE -%.po: $(I18Npot) - msgmerge -U --no-wrap --no-location --backup=none -q $@ $< - @touch $@ +ifdef DEBUG +DEFINES += -DDEBUG +endif +ifdef STREAMDEV_DEBUG +DEFINES += -DDEBUG +endif -$(I18Nmsgs): $(LOCALEDIR)/%/LC_MESSAGES/vdr-$(PLUGIN).mo: $(PODIR)/%.mo - @mkdir -p $(dir $@) - cp $< $@ +### The main target: -i18n: $(I18Nmsgs) +.PHONY: all client server dist clean +all: client server ### Targets: -libdvbmpeg/libdvbmpegtools.a: libdvbmpeg/*.c libdvbmpeg/*.h - $(MAKE) -C ./libdvbmpeg libdvbmpegtools.a - -libvdr-$(PLUGIN)-client.so: $(CLIENTOBJS) $(COMMONOBJS) libdvbmpeg/libdvbmpegtools.a -libvdr-$(PLUGIN)-server.so: $(SERVEROBJS) $(COMMONOBJS) libdvbmpeg/libdvbmpegtools.a +client: + $(MAKE) -C ./tools + $(MAKE) -C ./client + # installs to $(LIBDIR)/libvdr-streamdev-client.so.$(APIVERSION) -%.so: - $(CXX) $(CXXFLAGS) -shared $^ -o $@ - @cp $@ $(LIBDIR)/$@.$(APIVERSION) +server: + $(MAKE) -C ./tools + $(MAKE) -C ./libdvbmpeg + $(MAKE) -C ./remux + $(MAKE) -C ./server + # installs to $(LIBDIR)/libvdr-streamdev-server.so.$(APIVERSION) dist: clean @-rm -rf $(TMPDIR)/$(ARCHIVE) @@ -147,5 +101,8 @@ dist: clean @echo Distribution package created as $(PACKAGE).tgz clean: - @-rm -f $(COMMONOBJS) $(CLIENTOBJS) $(SERVEROBJS) $(DEPFILE) $(PODIR)/*.mo $(PODIR)/*.pot *.so *.tgz core* *~ + $(MAKE) -C ./tools clean $(MAKE) -C ./libdvbmpeg clean + $(MAKE) -C ./remux clean + $(MAKE) -C ./client clean + $(MAKE) -C ./server clean |