|
| 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 | + |
| 10 | +PLUGIN = web |
| 11 | + |
| 12 | +### The version number of this plugin (taken from the main source file): |
| 13 | + |
| 14 | +VERSION = $(shell grep 'static const char \*VERSION *=' $(PLUGIN).cpp | awk '{ print $$6 }' | sed -e 's/[";]//g') |
| 15 | + |
| 16 | + |
| 17 | +mINI_DIR = thirdparty/mINI-0.9.14 |
| 18 | + |
| 19 | +### The directory environment: |
| 20 | + |
| 21 | +# Use package data if installed...otherwise assume we're under the VDR source directory: |
| 22 | +PKG_CONFIG ?= pkg-config |
| 23 | +PKGCFG = $(if $(VDRDIR),$(shell $(PKG_CONFIG) --variable=$(1) $(VDRDIR)/vdr.pc),$(shell PKG_CONFIG_PATH="$$PKG_CONFIG_PATH:../../.." $(PKG_CONFIG) --variable=$(1) vdr)) |
| 24 | +LIBDIR = $(call PKGCFG,libdir) |
| 25 | +LOCDIR = $(call PKGCFG,locdir) |
| 26 | +PLGCFG = $(call PKGCFG,plgcfg) |
| 27 | +# |
| 28 | +TMPDIR ?= /tmp |
| 29 | + |
| 30 | +### The compiler options: |
| 31 | + |
| 32 | +export CFLAGS = $(call PKGCFG,cflags) |
| 33 | +export CXXFLAGS = $(call PKGCFG,cxxflags) |
| 34 | + |
| 35 | +# ffmpeg libswscale |
| 36 | +CXXFLAGS += $(shell pkg-config --cflags libswscale) |
| 37 | +LDFLAGS += $(shell pkg-config --libs libswscale) |
| 38 | + |
| 39 | +### The version number of VDR's plugin API: |
| 40 | + |
| 41 | +APIVERSION = $(call PKGCFG,apiversion) |
| 42 | + |
| 43 | +### Allow user defined options to overwrite defaults: |
| 44 | + |
| 45 | +-include $(PLGCFG) |
| 46 | + |
| 47 | +### The name of the distribution archive: |
| 48 | + |
| 49 | +ARCHIVE = $(PLUGIN)-$(VERSION) |
| 50 | +PACKAGE = vdr-$(ARCHIVE) |
| 51 | + |
| 52 | +### The name of the shared object file: |
| 53 | + |
| 54 | +SOFILE = libvdr-$(PLUGIN).so |
| 55 | + |
| 56 | +### Includes and Defines (add further entries here): |
| 57 | + |
| 58 | +INCLUDES += -I. -I$(mINI_DIR)/src/mini |
| 59 | + |
| 60 | +DEFINES += -DPLUGIN_NAME_I18N='"$(PLUGIN)"' |
| 61 | + |
| 62 | +### The object files (add further files here): |
| 63 | + |
| 64 | +OBJS = $(PLUGIN).o osddelegate.o webosdmenu.o webosdpage.o sharedmemory.o browserclient.o status.o ait.o videocontrol.o |
| 65 | + |
| 66 | +### The main target: |
| 67 | + |
| 68 | +all: $(SOFILE) i18n |
| 69 | + |
| 70 | +### Implicit rules: |
| 71 | + |
| 72 | +%.o: %.c |
| 73 | + @echo CC $@ |
| 74 | + $(Q)$(CXX) $(CXXFLAGS) -c $(DEFINES) $(INCLUDES) -o $@ $< |
| 75 | + |
| 76 | +%.o: %.cpp |
| 77 | + @echo CC $@ |
| 78 | + $(Q)$(CXX) $(CXXFLAGS) -c $(DEFINES) $(INCLUDES) -o $@ $< |
| 79 | + |
| 80 | +### Dependencies: |
| 81 | + |
| 82 | +MAKEDEP = $(CXX) -MM -MG |
| 83 | +DEPFILE = .dependencies |
| 84 | +$(DEPFILE): Makefile |
| 85 | + @$(MAKEDEP) $(CXXFLAGS) $(DEFINES) $(INCLUDES) $(OBJS:%.o=%.cpp) > $@ |
| 86 | + |
| 87 | +-include $(DEPFILE) |
| 88 | + |
| 89 | +### Internationalization (I18N): |
| 90 | + |
| 91 | +PODIR = po |
| 92 | +I18Npo = $(wildcard $(PODIR)/*.po) |
| 93 | +I18Nmo = $(addsuffix .mo, $(foreach file, $(I18Npo), $(basename $(file)))) |
| 94 | +I18Nmsgs = $(addprefix $(DESTDIR)$(LOCDIR)/, $(addsuffix /LC_MESSAGES/vdr-$(PLUGIN).mo, $(notdir $(foreach file, $(I18Npo), $(basename $(file)))))) |
| 95 | +I18Npot = $(PODIR)/$(PLUGIN).pot |
| 96 | + |
| 97 | +%.mo: %.po |
| 98 | + @echo MO $@ |
| 99 | + $(Q)msgfmt -c -o $@ $< |
| 100 | + |
| 101 | +$(I18Npot): $(wildcard *.cpp) |
| 102 | + @echo GT $@ |
| 103 | + $(Q)xgettext -C -cTRANSLATORS --no-wrap --no-location -k -ktr -ktrNOOP --package-name=vdr-$(PLUGIN) --package-version=$(VERSION) --msgid-bugs-address='<see README>' -o $@ `ls $^` |
| 104 | + |
| 105 | +%.po: $(I18Npot) |
| 106 | + @echo PO $@ |
| 107 | + $(Q)msgmerge -U --no-wrap --no-location --backup=none -q -N $@ $< |
| 108 | + @touch $@ |
| 109 | + |
| 110 | +$(I18Nmsgs): $(DESTDIR)$(LOCDIR)/%/LC_MESSAGES/vdr-$(PLUGIN).mo: $(PODIR)/%.mo |
| 111 | + install -D -m644 $< $@ |
| 112 | + |
| 113 | +.PHONY: i18n |
| 114 | +i18n: $(I18Nmo) $(I18Npot) |
| 115 | + |
| 116 | +install-i18n: $(I18Nmsgs) |
| 117 | + |
| 118 | +### Targets: |
| 119 | + |
| 120 | + |
| 121 | +$(SOFILE): $(OBJS) |
| 122 | + @echo LD $@ |
| 123 | + $(Q)$(CXX) $(CXXFLAGS) -shared $(OBJS) $(LDFLAGS) -o $@ |
| 124 | + |
| 125 | +install-lib: $(SOFILE) |
| 126 | + install -D $^ $(DESTDIR)$(LIBDIR)/$^.$(APIVERSION) |
| 127 | + |
| 128 | +install: install-lib install-i18n |
| 129 | + |
| 130 | +dist: $(I18Npo) clean |
| 131 | + @-rm -rf $(TMPDIR)/$(ARCHIVE) |
| 132 | + @mkdir $(TMPDIR)/$(ARCHIVE) |
| 133 | + @cp -a * $(TMPDIR)/$(ARCHIVE) |
| 134 | + @tar czf $(PACKAGE).tgz -C $(TMPDIR) $(ARCHIVE) |
| 135 | + @-rm -rf $(TMPDIR)/$(ARCHIVE) |
| 136 | + @echo Distribution package created as $(PACKAGE).tgz |
| 137 | + |
| 138 | +clean: |
| 139 | + @-rm -f $(PODIR)/*.mo $(PODIR)/*.pot |
| 140 | + @-rm -f $(OBJS) $(DEPFILE) *.so *.tgz core* *~ |
0 commit comments