#*************************************************************************** # Group VDR/GraphTFTng # File Makefile # Date 31.10.06 # This code is distributed under the terms and conditions of the # GNU GENERAL PUBLIC LICENSE. See the file COPYING for details. # (c) 2006-2013 Jörg Wendel #*************************************************************************** FFMDIR = /usr/include # ---------------------------------------------------------------------------- # like to support a touch screen ? #WITH_TOUCH = 1 # ---------------------------------------------------------------------------- # Check madatory environment # ifneq (exists, $(shell pkg-config libavcodec && echo exists)) $(error Missing libavcodec) endif ifneq (exists, $(shell pkg-config imlib2 && echo exists)) $(error Missing imlib2) endif ifneq (exists, $(shell pkg-config libswscale && echo exists)) $(error Missing libavcodec) endif ifneq (exists, $(shell pkg-config libgtop-2.0 && echo exists)) $(error Missing libgtop-2.0) endif # Name of the plugin PLUGIN = graphtft ### The version number of this plugin (taken from the main source file): VERSION = $(shell grep 'static const char\* VERSION *=' $(PLUGIN).h | awk '{ print $$6 }' | sed -e 's/[";]//g') # The directory environment # 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 --variable=$(1) vdr || pkg-config --variable=$(1) ../../../vdr.pc)) LIBDIR = $(call PKGCFG,libdir) LOCDIR = $(call PKGCFG,locdir) PLGCFG = $(call PKGCFG,plgcfg) # TMPDIR ?= /tmp ### The compiler options: export CFLAGS = $(call PKGCFG,cflags) export CXXFLAGS = $(call PKGCFG,cxxflags) -fPIC -Wno-unused-result ### The version number of VDR's plugin API: APIVERSION = $(call PKGCFG,apiversion) #### Allow user defined options to overwrite defaults: -include $(PLGCFG) ### The name of the distribution archive: ARCHIVE = $(PLUGIN)-$(VERSION) PACKAGE = vdr-$(ARCHIVE) ### The name of the shared object file: SOFILE = libvdr-$(PLUGIN).so ### Includes and Defines (add further entries here): INCLUDES += -I$(VDRDIR)/include -I. \ -I./imlibrenderer \ -I./imlibrenderer/fbrenderer \ -I./imlibrenderer/dmyrenderer INCLUDES += $(shell pkg-config libgtop-2.0 --cflags) DEFINES += -DPLUGIN_NAME_I18N='"$(PLUGIN)"' DEFINES += -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS DEFINES += -DWITH_TCP_COM LIBS += `imlib2-config --libs` -ljpeg LIBS += $(shell pkg-config libgtop-2.0 --libs) ifdef WITH_TOUCH DEFINES += -DWITH_TOUCH endif AVCODEC_INC = $(shell pkg-config libavcodec --cflags | sed -e 's/ //g') ifeq ($(strip $(AVCODEC_INC)),) INCLUDES += -I$(FFMDIR) -I$(FFMDIR)/libavcodec else INCLUDES += $(AVCODEC_INC) endif AVCODEC_LIBS = $(shell pkg-config libavcodec --libs) ifeq ($(strip $(AVCODEC_LIBS)),) LIBS += -lavcodec else LIBS += $(AVCODEC_LIBS) endif SWSCALE_INC = $(shell pkg-config libswscale --cflags) ifeq ($(strip $(SWSCALE_INC)),) INCLUDES += -I$(FFMDIR) -I$(FFMDIR)/libswscale else INCLUDES += $(SWSCALE_INC) endif SWSCALE_LIBS = $(shell pkg-config libswscale --libs) ifeq ($(strip $(SWSCALE_LIBS)),) LIBS += -lswscale else LIBS += $(SWSCALE_LIBS) endif ### The object files (add further files here): OBJS = $(PLUGIN).o dspitems.o display.o \ setup.o scan.o theme.o common.o sysinfo.o \ touchthread.o \ imlibrenderer/imlibrenderer.o \ imlibrenderer/fbrenderer/fbrenderer.o \ tcpchannel.o \ comthread.o renderer.o ### The main target: all: $(SOFILE) ### Implicit rules: %.o: %.c $(CXX) $(CXXFLAGS) -c $(DEFINES) $(INCLUDES) -o $@ $< ### Dependencies: MAKEDEP = $(CXX) -MM -MG DEPFILE = .dependencies $(DEPFILE): Makefile @$(MAKEDEP) $(CXXFLAGS) $(DEFINES) $(INCLUDES) $(OBJS:%.o=%.c) > $@ -include $(DEPFILE) ### Targets: $(SOFILE): $(COMMONOBJS) $(OBJS) $(CXX) $(CXXFLAGS) $(LDFLAGS) -shared $(OBJS) $(LIBS) -o $@ install-lib: $(SOFILE) install -D $^ $(DESTDIR)$(LIBDIR)/$^.$(APIVERSION) install: install-lib dist: 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* *~ @-rm -f $(PODIR)/*.mo $(PODIR)/*.pot @-rm -f $(PACKAGE).tgz @-rm -f *~ imlibrenderer/*~ @rm -rf plasma/build (cd graphtft-fe; make -s clean) TDEF += -DLOCDIR=\"$(LOCDIR)\" dev-test: test.c scan.c scan.h imlibrenderer/imlibrenderer.c common.c renderer.c g++ $(INCLUDES) $(CXXFLAGS) $(TDEF) $(LIBS) imlibrenderer/imlibrenderer.c \ renderer.c common.c scan.c test.c \ ~/vdr/tools.c \ ~/vdr/i18n.c \ ~/vdr/thread.c \ -lrt -o $@