This repository has been archived by the owner on Apr 15, 2023. It is now read-only.
forked from tvheadend/tvheadend
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
226 lines (183 loc) · 4.94 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
#
# Tvheadend streaming server.
# Copyright (C) 2007-2009 Andreas Öman
#
# 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.
#
# 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.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
include ${CURDIR}/config.default
BUILDDIR = build.${PLATFORM}
include ${BUILDDIR}/config.mak
PROG=${BUILDDIR}/tvheadend
CFLAGS += -Wall -Werror -Wwrite-strings -Wno-deprecated-declarations
CFLAGS += -Wmissing-prototypes
LDFLAGS += -lrt -ldl
BUNDLES += docs/html docs/docresources src/webui/static
#
# Core
#
SRCS = src/main.c \
src/utils.c \
src/wrappers.c \
src/version.c \
src/access.c \
src/dtable.c \
src/tcp.c \
src/http.c \
src/notify.c \
src/file.c \
src/epg.c \
src/xmltv.c \
src/spawn.c \
src/packet.c \
src/streaming.c \
src/teletext.c \
src/channels.c \
src/subscriptions.c \
src/service.c \
src/psi.c \
src/parsers.c \
src/parser_h264.c \
src/parser_latm.c \
src/tsdemux.c \
src/bitstream.c \
src/htsp.c \
src/serviceprobe.c \
src/htsmsg.c \
src/htsmsg_binary.c \
src/htsmsg_json.c \
src/htsmsg_xml.c \
src/settings.c \
src/htsbuf.c \
src/trap.c \
src/avg.c \
src/htsstr.c \
src/rawtsinput.c \
src/iptv_input.c \
src/avc.c \
SRCS += src/plumbing/tsfix.c \
src/plumbing/globalheaders.c \
SRCS += src/dvr/dvr_db.c \
src/dvr/dvr_rec.c \
src/dvr/dvr_autorec.c \
src/dvr/ebml.c \
src/dvr/mkmux.c \
SRCS-${CONFIG_LINUXDVB} += \
src/dvb/dvb.c \
src/dvb/dvb_support.c \
src/dvb/dvb_fe.c \
src/dvb/dvb_tables.c \
src/dvb/diseqc.c \
src/dvb/dvb_adapter.c \
src/dvb/dvb_multiplex.c \
src/dvb/dvb_transport.c \
src/dvb/dvb_preconf.c \
src/dvb/dvb_satconf.c \
src/webui/extjs_dvb.c \
SRCS-${CONFIG_V4L} += \
src/v4l.c \
src/webui/extjs_v4l.c \
#
# cwc
#
SRCS += src/cwc.c \
src/capmt.c \
src/ffdecsa/ffdecsa_interface.c \
src/ffdecsa/ffdecsa_int.c
SRCS-${CONFIG_MMX} += src/ffdecsa/ffdecsa_mmx.c
SRCS-${CONFIG_SSE2} += src/ffdecsa/ffdecsa_sse2.c
${BUILDDIR}/src/ffdecsa/ffdecsa_mmx.o : CFLAGS = -mmmx
${BUILDDIR}/src/ffdecsa/ffdecsa_sse2.o : CFLAGS = -msse2
#
# Primary web interface
#
SRCS += src/webui/webui.c \
src/webui/comet.c \
src/webui/extjs.c \
src/webui/simpleui.c \
src/webui/statedump.c \
#
# Extra modules
#
SRCS_EXTRA = src/extra/capmt_ca.c
#
# AVAHI interface
#
SRCS-$(CONFIG_AVAHI) += src/avahi.c
${BUILDDIR}/src/avahi.o : CFLAGS = \
$(shell pkg-config --cflags avahi-client) -Wall -Werror
# Various transformations
SRCS += $(SRCS-yes)
DLIBS += $(DLIBS-yes)
SLIBS += $(SLIBS-yes)
OBJS= $(SRCS:%.c=$(BUILDDIR)/%.o)
OBJS_EXTRA = $(SRCS_EXTRA:%.c=$(BUILDDIR)/%.so)
DEPS= ${OBJS:%.o=%.d}
# File bundles
BUNDLE_SRCS=$(BUNDLES:%=$(BUILDDIR)/bundles/%.c)
BUNDLE_DEPS=$(BUNDLE_SRCS:%.c=%.d)
BUNDLE_OBJS=$(BUNDLE_SRCS:%.c=%.o)
.PRECIOUS: ${BUNDLE_SRCS}
# Common CFLAGS for all files
CFLAGS_com = -g -funsigned-char -O2
CFLAGS_com += -D_FILE_OFFSET_BITS=64
CFLAGS_com += -I${BUILDDIR} -I${CURDIR}/src -I${CURDIR}
MKBUNDLE = $(CURDIR)/support/mkbundle
ifndef V
ECHO = printf "$(1)\t%s\n" $(2)
BRIEF = CC MKBUNDLE CXX
MSG = $@
$(foreach VAR,$(BRIEF), \
$(eval $(VAR) = @$$(call ECHO,$(VAR),$$(MSG)); $($(VAR))))
endif
all: ${PROG}
.PHONY: clean distclean
#
#
#
${PROG}: $(OBJS) $(ALLDEPS) support/dataroot/wd.c
$(CC) -o $@ $(OBJS) support/dataroot/wd.c $(LDFLAGS) ${LDFLAGS_cfg}
${PROG}.bundle: $(OBJS) $(BUNDLE_OBJS) $(ALLDEPS) support/dataroot/bundle.c
$(CC) -o $@ $(OBJS) support/dataroot/bundle.c $(BUNDLE_OBJS) $(LDFLAGS) ${LDFLAGS_cfg}
${PROG}.datadir: $(OBJS) $(ALLDEPS) support/dataroot/datadir.c
$(CC) -o $@ $(OBJS) -iquote${BUILDDIR} support/dataroot/datadir.c $(LDFLAGS) ${LDFLAGS_cfg}
#
#
#
${BUILDDIR}/%.o: %.c
@mkdir -p $(dir $@)
$(CC) -MD -MP $(CFLAGS_com) $(CFLAGS) $(CFLAGS_cfg) -c -o $@ $(CURDIR)/$<
${BUILDDIR}/%.so: ${SRCS_EXTRA}
@mkdir -p $(dir $@)
${CC} -O -fbuiltin -fomit-frame-pointer -fPIC -shared -o $@ $< -ldl
clean:
rm -rf ${BUILDDIR}/src ${BUILDDIR}/bundles
find . -name "*~" | xargs rm -f
distclean: clean
rm -rf build.*
# Create buildversion.h
src/version.c: $(BUILDDIR)/buildversion.h
$(BUILDDIR)/buildversion.h: FORCE
@$(CURDIR)/support/version.sh $(CURDIR) $@
FORCE:
# Include dependency files if they exist.
-include $(DEPS) $(BUNDLE_DEPS)
# Include OS specific targets
include support/${OSENV}.mk
# Bundle files
$(BUILDDIR)/bundles/%.o: $(BUILDDIR)/bundles/%.c
@mkdir -p $(dir $@)
$(CC) -I${CURDIR}/src -c -o $@ $<
$(BUILDDIR)/bundles/%.c: %
@mkdir -p $(dir $@)
$(MKBUNDLE) -o $@ -s $< -d ${BUILDDIR}/bundles/$<.d -p $< -z