|
| 1 | +#*************************************************************************** |
| 2 | +# Group VDR/GraphTFTng |
| 3 | +# File Makefile |
| 4 | +# Date 31.10.06 |
| 5 | +# This code is distributed under the terms and conditions of the |
| 6 | +# GNU GENERAL PUBLIC LICENSE. See the file COPYING for details. |
| 7 | +# (c) 2006-2013 Jörg Wendel |
| 8 | +#*************************************************************************** |
| 9 | + |
| 10 | +FFMDIR = /usr/include |
| 11 | + |
| 12 | +# ---------------------------------------------------------------------------- |
| 13 | +# User settings |
| 14 | + |
| 15 | +# like to support a touch screen ? |
| 16 | +#WITH_TOUCH = 1 |
| 17 | + |
| 18 | +# like the X renderer to display directly on local xorg (grpahtft-fe not needed) |
| 19 | +WITH_X = 1 |
| 20 | + |
| 21 | +# compile the graphtft-fe an the therefor tcp communication |
| 22 | +WITH_TCPCOM = 1 |
| 23 | + |
| 24 | +# compile wit old patch version (depricated) |
| 25 | +#WITH_OLD_PATCH = 1 |
| 26 | + |
| 27 | +# compile with epg2vdr timer support |
| 28 | +#WITH_EPG2VDR = 1 |
| 29 | + |
| 30 | +# Name of the plugin |
| 31 | + |
| 32 | +PLUGIN = graphtftng |
| 33 | +HISTFILE = "HISTORY.h" |
| 34 | + |
| 35 | +### The version number of this plugin (taken from the main source file): |
| 36 | + |
| 37 | +VERSION = $(shell grep 'define _VERSION ' $(HISTFILE) | awk '{ print $$3 }' | sed -e 's/[";]//g') |
| 38 | +LASTHIST = $(shell grep '^\#[0-9][0-9]' $(HISTFILE) | head -1) |
| 39 | +LASTCOMMENT = $(subst |,\n,$(shell sed -n '/$(LASTHIST)/,/^ *$$/p' $(HISTFILE) | tr '\n' '|')) |
| 40 | +LASTTAG = $(shell git describe --tags --abbrev=0) |
| 41 | +BRANCH = $(shell git rev-parse --abbrev-ref HEAD) |
| 42 | +GIT_REV = $(shell git describe --always 2>/dev/null) |
| 43 | + |
| 44 | +# The directory environment |
| 45 | + |
| 46 | +# Use package data if installed...otherwise assume we're under the VDR source directory: |
| 47 | +PKGCFG = $(if $(VDRDIR),$(shell pkg-config --variable=$(1) $(VDRDIR)/vdr.pc),$(shell pkg-config --variable=$(1) vdr || pkg-config --variable=$(1) ../../../vdr.pc)) |
| 48 | +LIBDIR = $(call PKGCFG,libdir) |
| 49 | +LOCDIR = $(call PKGCFG,locdir) |
| 50 | +PLGCFG = $(call PKGCFG,plgcfg) |
| 51 | +# |
| 52 | +TMPDIR ?= /tmp |
| 53 | + |
| 54 | +### The compiler options: |
| 55 | + |
| 56 | +export CFLAGS = $(call PKGCFG,cflags) |
| 57 | +export CXXFLAGS = $(call PKGCFG,cxxflags) -ggdb -fPIC -Wall -Wunused-variable -Wunused-label -Wunused-value -Wunused-function -Wno-unused-result |
| 58 | + |
| 59 | +### The version number of VDR's plugin API: |
| 60 | + |
| 61 | +APIVERSION = $(call PKGCFG,apiversion) |
| 62 | + |
| 63 | +#### Allow user defined options to overwrite defaults: |
| 64 | + |
| 65 | +-include $(PLGCFG) |
| 66 | + |
| 67 | +### The name of the distribution archive: |
| 68 | + |
| 69 | +ARCHIVE = $(PLUGIN)-$(VERSION) |
| 70 | +PACKAGE = vdr-$(ARCHIVE) |
| 71 | + |
| 72 | +### The name of the shared object file: |
| 73 | + |
| 74 | +SOFILE = libvdr-$(PLUGIN).so |
| 75 | + |
| 76 | +### Includes and Defines (add further entries here): |
| 77 | + |
| 78 | +INCLUDES += -I$(VDRDIR)/include -I. \ |
| 79 | + -I./imlibrenderer \ |
| 80 | + -I./imlibrenderer/fbrenderer \ |
| 81 | + -I./imlibrenderer/xrenderer \ |
| 82 | + -I./imlibrenderer/dmyrenderer |
| 83 | + |
| 84 | +INCLUDES += $(shell pkg-config libgtop-2.0 --cflags 2>/dev/null) |
| 85 | +INCLUDES += $(shell pkg-config libexif --cflags 2>/dev/null) |
| 86 | + |
| 87 | +DEFINES += -DPLUGIN_NAME_I18N='"$(PLUGIN)"' -DVDR_PLUGIN |
| 88 | +DEFINES += -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS |
| 89 | + |
| 90 | +ifdef GIT_REV |
| 91 | + DEFINES += -DGIT_REV='"$(GIT_REV)"' |
| 92 | +endif |
| 93 | + |
| 94 | +ifdef WITH_OLD_PATCH |
| 95 | + DEFINES += -D_OLD_PATCH |
| 96 | +endif |
| 97 | + |
| 98 | +ifdef WITH_TCPCOM |
| 99 | + DEFINES += -DWITH_TCPCOM |
| 100 | +endif |
| 101 | + |
| 102 | +ifdef WITH_EPG2VDR |
| 103 | + DEFINES += -DWITH_EPG2VDR |
| 104 | +endif |
| 105 | + |
| 106 | +ifdef WITH_X |
| 107 | + DEFINES += -DWITH_X |
| 108 | +endif |
| 109 | + |
| 110 | +# deactivate VDRs swap definition since the plugin needs std::sort() ! |
| 111 | + |
| 112 | +DEFINES += -D__STL_CONFIG_H |
| 113 | + |
| 114 | +LIBS += $(shell pkg-config libexif --libs 2>/dev/null) |
| 115 | +LIBS += $(shell imlib2-config --libs) |
| 116 | +LIBS += $(shell pkg-config libgtop-2.0 --libs 2>/dev/null) |
| 117 | + |
| 118 | +ifdef WITH_TCPCOM |
| 119 | + LIBS += -ljpeg |
| 120 | +endif |
| 121 | + |
| 122 | +ifdef WITH_TOUCH |
| 123 | + DEFINES += -DWITH_TOUCH |
| 124 | +endif |
| 125 | + |
| 126 | +AVCODEC_INC = $(shell pkg-config libavcodec --cflags | sed -e 's/ //g') |
| 127 | + |
| 128 | +ifeq ($(strip $(AVCODEC_INC)),) |
| 129 | + INCLUDES += -I$(FFMDIR) -I$(FFMDIR)/libavcodec |
| 130 | +else |
| 131 | + INCLUDES += $(AVCODEC_INC) |
| 132 | +endif |
| 133 | + |
| 134 | +AVCODEC_LIBS = $(shell pkg-config libavcodec --libs) |
| 135 | + |
| 136 | +ifeq ($(strip $(AVCODEC_LIBS)),) |
| 137 | + LIBS += -lavcodec |
| 138 | +else |
| 139 | + LIBS += $(AVCODEC_LIBS) |
| 140 | +endif |
| 141 | + |
| 142 | +SWSCALE_INC = $(shell pkg-config libswscale --cflags 2>/dev/null) |
| 143 | + |
| 144 | +ifeq ($(strip $(SWSCALE_INC)),) |
| 145 | + INCLUDES += -I$(FFMDIR) -I$(FFMDIR)/libswscale |
| 146 | +else |
| 147 | + INCLUDES += $(SWSCALE_INC) |
| 148 | +endif |
| 149 | + |
| 150 | +SWSCALE_LIBS = $(shell pkg-config libswscale --libs 2>/dev/null) |
| 151 | + |
| 152 | +ifeq ($(strip $(SWSCALE_LIBS)),) |
| 153 | + LIBS += -lswscale |
| 154 | +else |
| 155 | + LIBS += $(SWSCALE_LIBS) |
| 156 | +endif |
| 157 | + |
| 158 | +### The object files (add further files here): |
| 159 | + |
| 160 | +OBJS = $(PLUGIN).o dspitems.o vlookup.o status.o display.o \ |
| 161 | + setup.o scan.o theme.o common.o sysinfo.o \ |
| 162 | + touchthread.o \ |
| 163 | + imlibrenderer/imlibrenderer.o \ |
| 164 | + imlibrenderer/fbrenderer/fbrenderer.o \ |
| 165 | + renderer.o comthread.o tcpchannel.o \ |
| 166 | + scraper2vdr.o |
| 167 | + |
| 168 | +ifdef WITH_X |
| 169 | + OBJS += imlibrenderer/xrenderer/xrenderer.o |
| 170 | + LIBS += -lX11 |
| 171 | +endif |
| 172 | + |
| 173 | +### The main target: |
| 174 | + |
| 175 | +ifdef WITH_X |
| 176 | + all: $(SOFILE) i18n fe |
| 177 | +else |
| 178 | + all: $(SOFILE) i18n |
| 179 | +endif |
| 180 | + |
| 181 | +### Implicit rules: |
| 182 | + |
| 183 | +%.o: %.c |
| 184 | + $(CXX) $(CXXFLAGS) -c $(DEFINES) $(INCLUDES) -o $@ $< |
| 185 | + |
| 186 | +### Dependencies: |
| 187 | + |
| 188 | +MAKEDEP = $(CXX) -MM -MG |
| 189 | +DEPFILE = .dependencies |
| 190 | + |
| 191 | +$(DEPFILE): Makefile |
| 192 | + @$(MAKEDEP) $(CXXFLAGS) $(DEFINES) $(INCLUDES) $(OBJS:%.o=%.c) > $@ |
| 193 | + |
| 194 | +-include $(DEPFILE) |
| 195 | + |
| 196 | +### Internationalization (I18N): |
| 197 | + |
| 198 | +PODIR = po |
| 199 | +I18Npo = $(wildcard $(PODIR)/*.po) |
| 200 | +I18Nmo = $(addsuffix .mo, $(foreach file, $(I18Npo), $(basename $(file)))) |
| 201 | +I18Nmsgs = $(addprefix $(DESTDIR)$(LOCDIR)/, $(addsuffix /LC_MESSAGES/vdr-$(PLUGIN).mo, $(notdir $(foreach file, $(I18Npo), $(basename $(file)))))) |
| 202 | +I18Npot = $(PODIR)/$(PLUGIN).pot |
| 203 | + |
| 204 | +%.mo: %.po |
| 205 | + msgfmt -c -o $@ $< |
| 206 | + |
| 207 | +$(I18Npot): $(wildcard *.c) |
| 208 | + xgettext -C -cTRANSLATORS --no-wrap --no-location -k -ktr -ktrNOOP --package-name=vdr- $(PLUGIN) --package-version= $(VERSION) --msgid-bugs-address= '<[email protected]>' -o $@ `ls $^` |
| 209 | + |
| 210 | +%.po: $(I18Npot) |
| 211 | + msgmerge -U --no-wrap --no-location --backup=none -q -N $@ $< |
| 212 | + @touch $@ |
| 213 | + |
| 214 | +$(I18Nmsgs): $(DESTDIR)$(LOCDIR)/%/LC_MESSAGES/vdr-$(PLUGIN).mo: $(PODIR)/%.mo |
| 215 | + install -D -m644 $< $@ |
| 216 | + |
| 217 | +.PHONY: i18n |
| 218 | +i18n: $(I18Nmo) $(I18Npot) |
| 219 | + |
| 220 | +install-i18n: $(I18Nmsgs) |
| 221 | + |
| 222 | +### Targets: |
| 223 | + |
| 224 | +# ---------------------------------------------------------------------------- |
| 225 | +# Check madatory environment |
| 226 | +# |
| 227 | + |
| 228 | +check-builddep: |
| 229 | + if ! pkg-config libavcodec; then \ |
| 230 | + echo "Missing libavcodec, aborting build !!"; \ |
| 231 | + exit 1; \ |
| 232 | + fi |
| 233 | + if ! pkg-config libswscale; then \ |
| 234 | + echo "Missing libswscale, aborting build !!"; \ |
| 235 | + exit 1; \ |
| 236 | + fi |
| 237 | + if ! pkg-config imlib2; then \ |
| 238 | + echo "Missing imlib2, aborting build !!"; \ |
| 239 | + exit 1; \ |
| 240 | + fi |
| 241 | + if ! pkg-config libexif; then \ |
| 242 | + echo "Missing libexif, aborting build !!"; \ |
| 243 | + exit 1; \ |
| 244 | + fi |
| 245 | + if ! pkg-config libgtop-2.0; then \ |
| 246 | + echo "Missing libgtop-2.0, aborting build !!"; \ |
| 247 | + exit 1; \ |
| 248 | + fi |
| 249 | + |
| 250 | +$(SOFILE): check-builddep $(COMMONOBJS) $(OBJS) |
| 251 | + $(CXX) $(CXXFLAGS) $(LDFLAGS) -shared $(OBJS) $(LIBS) -o $@ |
| 252 | + |
| 253 | +fe: |
| 254 | + $(MAKE) -C ./graphtft-fe all |
| 255 | + |
| 256 | +install-fe: |
| 257 | + $(MAKE) -C ./graphtft-fe install |
| 258 | + |
| 259 | +install-lib: $(SOFILE) |
| 260 | + install -D -m644 $^ $(DESTDIR)$(LIBDIR)/$^.$(APIVERSION) |
| 261 | + |
| 262 | +install: install-lib |
| 263 | + |
| 264 | +dist: clean clean-fe |
| 265 | + @-rm -rf $(TMPDIR)/$(ARCHIVE) |
| 266 | + @mkdir $(TMPDIR)/$(ARCHIVE) |
| 267 | + @cp -a * $(TMPDIR)/$(ARCHIVE) |
| 268 | + @tar czf $(PACKAGE).tgz -C $(TMPDIR) $(ARCHIVE) |
| 269 | + @-rm -rf $(TMPDIR)/$(ARCHIVE) |
| 270 | + @echo Distribution package created as $(PACKAGE).tgz |
| 271 | + |
| 272 | +ifdef WITH_TCPCOM |
| 273 | +clean: clean-plug clean-fe |
| 274 | +else |
| 275 | +clean: clean-plug |
| 276 | +endif |
| 277 | + |
| 278 | +clean-plug: |
| 279 | + @-rm -f $(OBJS) $(DEPFILE) *.so *.tgz core* |
| 280 | + @-rm -f $(PODIR)/*.mo $(PODIR)/*.pot |
| 281 | + @-rm -f $(PACKAGE).tgz t1 |
| 282 | + @-rm -f *~ */*~ */*/*~ |
| 283 | + |
| 284 | +clean-fe: |
| 285 | + @rm -rf plasma/build imlibrenderer/imlibtest |
| 286 | + $(MAKE) -C ./graphtft-fe clean |
| 287 | + |
| 288 | +t1: test.c scan.c scan.h |
| 289 | + $(CXX) $(INCLUDES) -ggdb $(LIBS) scan.c test.c -lrt -o $@ |
| 290 | + |
| 291 | +# ------------------------------------------------------ |
| 292 | +# Git / Versioning / Tagging |
| 293 | +# ------------------------------------------------------ |
| 294 | + |
| 295 | +vcheck: |
| 296 | + git fetch |
| 297 | + if test "$(LASTTAG)" = "$(VERSION)"; then \ |
| 298 | + echo "Warning: tag/version '$(VERSION)' already exists, update HISTORY first. Aborting!"; \ |
| 299 | + exit 1; \ |
| 300 | + fi |
| 301 | + |
| 302 | +push: vcheck |
| 303 | + echo "tagging git with $(VERSION)" |
| 304 | + git tag $(VERSION) |
| 305 | + git push --tags |
| 306 | + git push |
| 307 | + |
| 308 | +commit: vcheck |
| 309 | + git commit -m "$(LASTCOMMENT)" -a |
| 310 | + |
| 311 | +git: commit push |
| 312 | + |
| 313 | +showv: |
| 314 | + @echo "Git ($(BRANCH)):\\n Version: $(LASTTAG) (tag)" |
| 315 | + @echo "Local:" |
| 316 | + @echo " Version: $(VERSION)" |
| 317 | + @echo " Change:" |
| 318 | + @echo -n " $(LASTCOMMENT)" |
| 319 | + echo |
0 commit comments