tvheadend/Makefile

518 lines
13 KiB
Makefile
Raw Permalink Normal View History

2009-03-25 17:51:08 +00:00
#
2009-03-30 18:02:08 +00:00
# Tvheadend streaming server.
2009-03-30 17:10:22 +00:00
# Copyright (C) 2007-2009 Andreas Öman
2009-03-25 17:51:08 +00:00
#
2009-03-30 17:10:22 +00:00
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
2009-03-30 17:10:22 +00:00
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
2009-03-30 17:10:22 +00:00
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
#
# Configuration
#
include $(dir $(lastword $(MAKEFILE_LIST))).config.mk
PROG := $(BUILDDIR)/tvheadend
#
# Common compiler flags
#
2014-08-11 21:20:32 +02:00
CFLAGS += -g -O2 -Wunused-result
CFLAGS += -Wall -Werror -Wwrite-strings -Wno-deprecated-declarations
CFLAGS += -Wmissing-prototypes
CFLAGS += -fms-extensions -funsigned-char -fno-strict-aliasing
CFLAGS += -D_FILE_OFFSET_BITS=64
CFLAGS += -I${BUILDDIR} -I${ROOTDIR}/src -I${ROOTDIR}
ifeq ($(CONFIG_ANDROID),yes)
LDFLAGS += -ldl -lm
else
2014-05-16 23:18:53 +02:00
LDFLAGS += -ldl -lpthread -lm
endif
2014-05-27 16:02:36 +02:00
ifeq ($(CONFIG_LIBICONV),yes)
2014-05-27 15:35:27 +02:00
LDFLAGS += -liconv
endif
2014-05-31 00:47:17 +02:00
ifeq ($(PLATFORM), darwin)
LDFLAGS += -framework CoreServices
else
ifeq ($(CONFIG_ANDROID),no)
2014-05-16 23:18:53 +02:00
LDFLAGS += -lrt
endif
endif
2014-05-16 23:18:53 +02:00
ifeq ($(COMPILER), clang)
CFLAGS += -Wno-microsoft -Qunused-arguments -Wno-unused-function
CFLAGS += -Wno-unused-value -Wno-tautological-constant-out-of-range-compare
CFLAGS += -Wno-parentheses-equality -Wno-incompatible-pointer-types
endif
ifeq ($(CONFIG_LIBFFMPEG_STATIC),yes)
CFLAGS += -I${ROOTDIR}/libav_static/build/ffmpeg/include
LDFLAGS += -L${ROOTDIR}/libav_static/build/ffmpeg/lib -Wl,-Bstatic \
-lavresample -lswresample -lswscale \
-lavutil -lavformat -lavcodec -lavutil \
-lvorbisenc -lvorbis -logg -lx264 -lvpx \
-Wl,-Bdynamic -ldl
endif
ifeq ($(CONFIG_HDHOMERUN_STATIC),yes)
CFLAGS += -I${ROOTDIR}/libhdhomerun_static
LDFLAGS += -L${ROOTDIR}/libhdhomerun_static/libhdhomerun \
-Wl,-Bstatic -lhdhomerun -Wl,-Bdynamic
2014-05-16 23:18:53 +02:00
endif
vpath %.c $(ROOTDIR)
vpath %.h $(ROOTDIR)
#
# Other config
#
BUNDLE_FLAGS-${CONFIG_ZLIB} = -z
BUNDLE_FLAGS = ${BUNDLE_FLAGS-yes}
#
# Binaries/Scripts
#
2014-11-12 11:51:18 +01:00
MKBUNDLE = $(PYTHON) $(ROOTDIR)/support/mkbundle
#
# Debug/Output
#
ifndef V
ECHO = printf "%-16s%s\n" $(1) $(2)
BRIEF = CC MKBUNDLE CXX
MSG = $(subst $(BUILDDIR)/,,$@)
$(foreach VAR,$(BRIEF), \
$(eval $(VAR) = @$$(call ECHO,$(VAR),$$(MSG)); $($(VAR))))
endif
2009-03-30 17:10:22 +00:00
#
# Core
#
SRCS = src/version.c \
src/uuid.c \
src/main.c \
src/tvhlog.c \
src/idnode.c \
src/prop.c \
2010-06-22 06:47:18 +00:00
src/utils.c \
2009-11-26 19:35:08 +00:00
src/wrappers.c \
2009-03-30 17:10:22 +00:00
src/access.c \
src/tcp.c \
src/udp.c \
src/url.c \
2009-03-30 17:10:22 +00:00
src/http.c \
src/notify.c \
src/file.c \
2009-03-30 17:10:22 +00:00
src/epg.c \
src/epgdb.c\
src/epggrab.c\
2009-03-30 17:10:22 +00:00
src/spawn.c \
src/packet.c \
src/streaming.c \
src/channels.c \
src/subscriptions.c \
2010-11-29 20:06:52 +00:00
src/service.c \
2012-10-25 13:25:06 +02:00
src/htsp_server.c \
2009-03-30 17:10:22 +00:00
src/htsmsg.c \
src/htsmsg_binary.c \
src/htsmsg_json.c \
src/htsmsg_xml.c \
src/misc/dbl.c \
src/misc/json.c \
2009-03-30 17:10:22 +00:00
src/settings.c \
src/htsbuf.c \
src/trap.c \
2009-03-30 17:10:22 +00:00
src/avg.c \
src/htsstr.c \
2014-10-07 19:13:32 +02:00
src/tvhpoll.c \
src/huffman.c \
src/filebundle.c \
src/config.c \
src/lang_codes.c \
src/lang_str.c \
src/imagecache.c \
src/tvhtime.c \
src/service_mapper.c \
src/input.c \
src/httpc.c \
src/rtsp.c \
src/fsmonitor.c \
src/cron.c \
src/esfilter.c \
2014-10-07 19:13:32 +02:00
src/intlconv.c \
src/profile.c \
src/bouquet.c \
src/lock.c
2010-06-22 10:46:53 +00:00
SRCS-${CONFIG_UPNP} += \
src/upnp.c
2015-02-13 16:06:09 +01:00
# SATIP Server
SRCS-${CONFIG_SATIP_SERVER} += \
2015-02-13 21:53:56 +01:00
src/satip/server.c \
src/satip/rtsp.c \
src/satip/rtp.c
2015-02-13 16:06:09 +01:00
SRCS += \
src/api.c \
src/api/api_status.c \
src/api/api_idnode.c \
src/api/api_input.c \
src/api/api_channel.c \
src/api/api_service.c \
src/api/api_mpegts.c \
2014-01-28 14:23:16 +01:00
src/api/api_epg.c \
src/api/api_epggrab.c \
src/api/api_imagecache.c \
src/api/api_esfilter.c \
2014-08-16 15:51:36 +02:00
src/api/api_intlconv.c \
2014-08-21 21:36:49 +02:00
src/api/api_access.c \
src/api/api_dvr.c \
2014-10-07 19:13:32 +02:00
src/api/api_caclient.c \
src/api/api_profile.c \
src/api/api_bouquet.c
SRCS += \
src/parsers/parsers.c \
src/parsers/bitstream.c \
src/parsers/parser_h264.c \
src/parsers/parser_latm.c \
src/parsers/parser_avc.c \
src/parsers/parser_teletext.c \
2010-06-22 10:46:53 +00:00
SRCS += src/epggrab/module.c\
src/epggrab/channel.c\
src/epggrab/module/pyepg.c\
src/epggrab/module/xmltv.c\
SRCS += src/plumbing/tsfix.c \
src/plumbing/globalheaders.c
2009-03-30 17:10:22 +00:00
SRCS += src/dvr/dvr_db.c \
src/dvr/dvr_rec.c \
src/dvr/dvr_autorec.c \
2014-09-15 20:25:15 +02:00
src/dvr/dvr_timerec.c \
src/dvr/dvr_config.c \
2014-01-26 18:05:00 +01:00
src/dvr/dvr_cutpoints.c \
2009-03-30 17:10:22 +00:00
SRCS += src/webui/webui.c \
src/webui/comet.c \
src/webui/extjs.c \
src/webui/simpleui.c \
src/webui/statedump.c \
src/webui/html.c\
src/webui/webui_api.c\
SRCS += src/muxer.c \
2013-01-05 20:46:23 +00:00
src/muxer/muxer_pass.c \
src/muxer/muxer_tvh.c \
src/muxer/tvh/ebml.c \
src/muxer/tvh/mkmux.c \
#
# Optional code
#
# MPEGTS core, order by usage (psi lib, tsdemux)
SRCS-$(CONFIG_MPEGTS) += \
src/descrambler/descrambler.c \
src/descrambler/caclient.c \
src/input/mpegts.c \
src/input/mpegts/mpegts_pid.c \
src/input/mpegts/mpegts_input.c \
src/input/mpegts/tsdemux.c \
src/input/mpegts/dvb_psi_lib.c \
src/input/mpegts/mpegts_network.c \
src/input/mpegts/mpegts_mux.c \
src/input/mpegts/mpegts_service.c \
src/input/mpegts/mpegts_table.c \
src/input/mpegts/dvb_support.c \
src/input/mpegts/dvb_charset.c \
src/input/mpegts/dvb_psi.c \
src/input/mpegts/fastscan.c \
src/input/mpegts/mpegts_mux_sched.c \
src/input/mpegts/mpegts_network_scan.c
# MPEGTS DVB
SRCS-${CONFIG_MPEGTS_DVB} += \
src/input/mpegts/mpegts_network_dvb.c \
src/input/mpegts/mpegts_mux_dvb.c \
src/input/mpegts/scanfile.c
# MPEGTS EPG
SRCS-$(CONFIG_MPEGTS) += \
src/epggrab/otamux.c\
src/epggrab/module/eit.c \
src/epggrab/support/freesat_huffman.c \
src/epggrab/module/opentv.c \
# LINUX DVB
SRCS-${CONFIG_LINUXDVB} += \
2013-06-17 19:57:09 +01:00
src/input/mpegts/linuxdvb/linuxdvb.c \
src/input/mpegts/linuxdvb/linuxdvb_adapter.c \
src/input/mpegts/linuxdvb/linuxdvb_frontend.c \
src/input/mpegts/linuxdvb/linuxdvb_satconf.c \
src/input/mpegts/linuxdvb/linuxdvb_lnb.c \
src/input/mpegts/linuxdvb/linuxdvb_switch.c \
src/input/mpegts/linuxdvb/linuxdvb_rotor.c \
src/input/mpegts/linuxdvb/linuxdvb_en50494.c
2015-02-13 16:06:09 +01:00
# SATIP Client
SRCS-${CONFIG_SATIP_CLIENT} += \
src/input/mpegts/satip/satip.c \
src/input/mpegts/satip/satip_frontend.c \
src/input/mpegts/satip/satip_satconf.c \
src/input/mpegts/satip/satip_rtsp.c
2014-06-27 22:01:54 +02:00
# HDHOMERUN
SRCS_HDHOMERUN = \
2014-06-27 22:01:54 +02:00
src/input/mpegts/tvhdhomerun/tvhdhomerun.c \
src/input/mpegts/tvhdhomerun/tvhdhomerun_frontend.c
SRCS-${CONFIG_HDHOMERUN_CLIENT} += $(SRCS_HDHOMERUN)
2014-06-27 22:01:54 +02:00
# IPTV
SRCS-${CONFIG_IPTV} += \
src/input/mpegts/iptv/iptv.c \
2013-06-17 19:57:09 +01:00
src/input/mpegts/iptv/iptv_mux.c \
src/input/mpegts/iptv/iptv_service.c \
src/input/mpegts/iptv/iptv_http.c \
src/input/mpegts/iptv/iptv_udp.c \
2015-05-01 16:58:04 +02:00
src/input/mpegts/iptv/iptv_rtsp.c \
src/input/mpegts/iptv/iptv_pipe.c
# TSfile
SRCS-$(CONFIG_TSFILE) += \
2013-06-17 19:57:09 +01:00
src/input/mpegts/tsfile/tsfile.c \
src/input/mpegts/tsfile/tsfile_input.c \
src/input/mpegts/tsfile/tsfile_mux.c \
# Timeshift
SRCS-${CONFIG_TIMESHIFT} += \
src/timeshift.c \
src/timeshift/timeshift_filemgr.c \
src/timeshift/timeshift_writer.c \
src/timeshift/timeshift_reader.c \
# Inotify
SRCS-${CONFIG_INOTIFY} += \
src/dvr/dvr_inotify.c \
# Avahi
SRCS-$(CONFIG_AVAHI) += src/avahi.c
2014-05-31 00:47:17 +02:00
# Bonjour
SRCS-$(CONFIG_BONJOUR) += src/bonjour.c
# libav
SRCS_LIBAV = \
src/libav.c \
2013-05-09 21:51:27 +02:00
src/muxer/muxer_libav.c \
src/plumbing/transcoding.c
SRCS-$(CONFIG_LIBAV) += $(SRCS_LIBAV)
2014-05-30 13:38:29 +02:00
# Tvhcsa
SRCS-${CONFIG_TVHCSA} += \
src/descrambler/tvhcsa.c
# CWC
SRCS-${CONFIG_CWC} += \
src/descrambler/cwc.c \
2014-05-30 13:38:29 +02:00
# CAPMT
SRCS-${CONFIG_CAPMT} += \
src/descrambler/capmt.c
# CONSTCW
SRCS-${CONFIG_CONSTCW} += \
src/descrambler/constcw.c
2015-04-14 14:09:09 +02:00
# DVB CAM
SRCS-${CONFIG_LINUXDVB_CA} += \
src/input/mpegts/linuxdvb/linuxdvb_ca.c \
src/descrambler/dvbcam.c
# TSDEBUGCW
SRCS-${CONFIG_TSDEBUG} += \
src/descrambler/tsdebugcw.c
# FFdecsa
ifneq ($(CONFIG_DVBCSA),yes)
FFDECSA-$(CONFIG_CAPMT) = yes
FFDECSA-$(CONFIG_CWC) = yes
FFDECSA-$(CONFIG_CONSTCW) = yes
endif
ifeq ($(FFDECSA-yes),yes)
2014-08-04 23:07:59 +02:00
SRCS-yes += src/descrambler/ffdecsa/ffdecsa_interface.c \
2014-08-05 11:38:12 +02:00
src/descrambler/ffdecsa/ffdecsa_int.c
SRCS-${CONFIG_MMX} += src/descrambler/ffdecsa/ffdecsa_mmx.c
2014-08-04 23:07:59 +02:00
SRCS-${CONFIG_SSE2} += src/descrambler/ffdecsa/ffdecsa_sse2.c
2014-08-05 11:33:23 +02:00
${BUILDDIR}/src/descrambler/ffdecsa/ffdecsa_mmx.o : CFLAGS += -mmmx
2014-08-04 23:07:59 +02:00
${BUILDDIR}/src/descrambler/ffdecsa/ffdecsa_sse2.o : CFLAGS += -msse2
endif
2014-08-05 11:38:12 +02:00
# libaesdec
2014-08-05 22:10:52 +02:00
SRCS-${CONFIG_SSL} += src/descrambler/libaesdec/libaesdec.c
2014-08-05 22:23:23 +02:00
# DBUS
SRCS-${CONFIG_DBUS_1} += src/dbus.c
# File bundles
SRCS-${CONFIG_BUNDLE} += bundle.c
BUNDLES-yes += docs/html docs/docresources src/webui/static
BUNDLES-yes += data/conf
BUNDLES-${CONFIG_DVBSCAN} += data/dvb-scan
BUNDLES = $(BUNDLES-yes)
ALL-$(CONFIG_DVBSCAN) += check_dvb_scan
2009-12-16 07:20:39 +00:00
#
# Add-on modules
2009-12-16 07:20:39 +00:00
#
2009-12-16 07:20:39 +00:00
SRCS_EXTRA = src/extra/capmt_ca.c
#
# Variable transformations
#
SRCS += $(SRCS-yes)
OBJS = $(SRCS:%.c=$(BUILDDIR)/%.o)
2009-12-16 07:20:39 +00:00
OBJS_EXTRA = $(SRCS_EXTRA:%.c=$(BUILDDIR)/%.so)
DEPS = ${OBJS:%.o=%.d}
2011-05-03 20:32:17 +02:00
ifeq ($(CONFIG_LIBFFMPEG_STATIC),yes)
DEPS += ${BUILDDIR}/libffmpeg_stamp
endif
ifeq ($(CONFIG_HDHOMERUN_STATIC),yes)
DEPS += ${BUILDDIR}/libhdhomerun_stamp
endif
#
# Build Rules
#
2011-05-03 20:32:17 +02:00
# Default
all: $(ALL-yes) ${PROG}
# Special
.PHONY: clean distclean check_config reconfigure
# Check configure output is valid
check_config:
@test $(ROOTDIR)/.config.mk -nt $(ROOTDIR)/configure\
|| echo "./configure output is old, please re-run"
@test $(ROOTDIR)/.config.mk -nt $(ROOTDIR)/configure
# Recreate configuration
reconfigure:
$(ROOTDIR)/configure $(CONFIGURE_ARGS)
# Binary
${PROG}: check_config $(OBJS) $(ALLDEPS)
$(CC) -o $@ $(OBJS) $(CFLAGS) $(LDFLAGS)
# Object
2010-06-23 22:40:13 +00:00
${BUILDDIR}/%.o: %.c
@mkdir -p $(dir $@)
$(CC) -MD -MP $(CFLAGS) -c -o $@ $<
2007-08-09 15:42:01 +00:00
# Add-on
2009-12-16 07:20:39 +00:00
${BUILDDIR}/%.so: ${SRCS_EXTRA}
@mkdir -p $(dir $@)
2009-12-16 07:20:39 +00:00
${CC} -O -fbuiltin -fomit-frame-pointer -fPIC -shared -o $@ $< -ldl
# Clean
2009-03-30 17:10:22 +00:00
clean:
rm -rf ${BUILDDIR}/src ${BUILDDIR}/bundle*
2009-03-30 17:10:22 +00:00
find . -name "*~" | xargs rm -f
2008-10-09 21:56:22 +00:00
2009-03-30 17:10:22 +00:00
distclean: clean
2014-10-22 10:08:36 +02:00
rm -rf ${ROOTDIR}/libav_static
rm -rf ${ROOTDIR}/libhdhomerun_static
rm -rf ${ROOTDIR}/build.*
rm -f ${ROOTDIR}/.config.mk
2008-10-09 21:56:22 +00:00
# Create version
$(BUILDDIR)/src/version.o: $(ROOTDIR)/src/version.c
$(ROOTDIR)/src/version.c: FORCE
@$(ROOTDIR)/support/version $@ > /dev/null
FORCE:
2008-10-09 21:56:22 +00:00
2009-03-30 17:10:22 +00:00
# Include dependency files if they exist.
-include $(DEPS)
2008-10-09 21:56:22 +00:00
2009-03-30 17:10:22 +00:00
# Include OS specific targets
include ${ROOTDIR}/support/${OSENV}.mk
2009-03-30 17:10:22 +00:00
# Bundle files
$(BUILDDIR)/bundle.o: $(BUILDDIR)/bundle.c
@mkdir -p $(dir $@)
$(CC) -I${ROOTDIR}/src -c -o $@ $<
$(BUILDDIR)/bundle.c: check_dvb_scan
@mkdir -p $(dir $@)
$(MKBUNDLE) -o $@ -d ${BUILDDIR}/bundle.d $(BUNDLE_FLAGS) $(BUNDLES:%=$(ROOTDIR)/%)
# Static FFMPEG
ifeq ($(CONFIG_LIBFFMPEG_STATIC),yes)
${ROOTDIR}/src/libav.h: ${BUILDDIR}/libffmpeg_stamp
${SRCS_LIBAV}: ${BUILDDIR}/libffmpeg_stamp
endif
${BUILDDIR}/libffmpeg_stamp: ${ROOTDIR}/libav_static/build/ffmpeg/lib/libavcodec.a
@touch $@
${ROOTDIR}/libav_static/build/ffmpeg/lib/libavcodec.a:
CONFIG_LIBFFMPEG_STATIC_X264=$(CONFIG_LIBFFMPEG_STATIC_X264) \
$(MAKE) -f Makefile.ffmpeg build
# Static HDHOMERUN library
ifeq ($(CONFIG_LIBHDHOMERUN_STATIC),yes)
${ROOTDIR}/src/input/mpegts/tvhdhomerun/tvhdhomerun_private.h: ${BUILDDIR}/libhdhomerun_stamp
${SRCS_HDHOMERUN}: ${BUILDDIR}/libhdhomerun_stamp
endif
${BUILDDIR}/libhdhomerun_stamp: ${ROOTDIR}/libhdhomerun_static/libhdhomerun/libhdhomerun.a
@touch $@
${ROOTDIR}/libhdhomerun_static/libhdhomerun/libhdhomerun.a:
$(MAKE) -f Makefile.hdhomerun build
# linuxdvb git tree
$(ROOTDIR)/data/dvb-scan/.stamp:
@echo "Receiving data/dvb-scan/dvb-t from http://linuxtv.org/git/dtv-scan-tables.git"
@rm -rf $(ROOTDIR)/data/dvb-scan/*
@$(ROOTDIR)/support/getmuxlist $(ROOTDIR)/data/dvb-scan
@touch $@
.PHONY: check_dvb_scan
check_dvb_scan: $(ROOTDIR)/data/dvb-scan/.stamp
# dvb-s / enigma2 / satellites.xml
$(ROOTDIR)/data/dvb-scan/dvb-s/.stamp: $(ROOTDIR)/data/satellites.xml \
$(ROOTDIR)/data/dvb-scan/.stamp
@echo "Generating data/dvb-scan/dvb-s from data/satellites.xml"
@if ! test -s $(ROOTDIR)/data/satellites.xml ; then echo "Put your satellites.xml file to $(ROOTDIR)/data/satellites.xml"; exit 1; fi
@if ! test -d $(ROOTDIR)/data/dvb-scan/dvb-s ; then mkdir $(ROOTDIR)/data/dvb-scan/dvb-s ; fi
@rm -rf $(ROOTDIR)/data/dvb-scan/dvb-s/*
@$(ROOTDIR)/support/sat_xml_scan.py \
$(ROOTDIR)/data/satellites.xml $(ROOTDIR)/data/dvb-scan/dvb-s
@touch $(ROOTDIR)/data/dvb-scan/dvb-s/.stamp
.PHONY: satellites_xml
satellites_xml: $(ROOTDIR)/data/dvb-scan/dvb-s/.stamp