Import of atscap v1.1
[atscap.git] / Makefile
blob17a6f0287ab59319ee61dd565d72b77e959603af
2 # what uses this Makefile?
3 NAME=atscap
4 VERSION=1.1
5 DISTRO=$(NAME)-$(VERSION)
7 # where do you want to install the software?
8 PREFIX=/usr/local
9 BIN=$(PREFIX)/bin
10 MAN1=$(PREFIX)/share/man/man1
11 MAN5=$(PREFIX)/share/man/man5
12 DOC=$(PREFIX)/share/doc/$(NAME)
14 # specify directory for for captures, program guides and images
15 # -E energy save option will use $DTV/ram, don't forget to mount as tmpfs
16 DTV=/dtv
18 # what is the compiler?
19 CC=gcc
20 # what are the default compile flags?
21 CFLAGS=-Wall -lm
22 # Extra debug information. You may want to comment this if it runs OK.
23 CFLAGS += -g -rdynamic -DUSE_GNU_BACKTRACE -DUSE_GNU_BACKTRACE_SCRIPT
24 # librt (clock_gettime et al)
25 CFLAGS += -DUSE_LIBRT -lrt
27 # debug options for CFLAGS. -g should be left on until 1.1 final.
28 # -g -pg
29 # -g to track segfaults with gdb
30 # -pg to generate profiling information
31 # -g -rdynamic -DUSE_GNU_BACKTRACE to enable backtrace dump data for addr2line
32 # -g -rdynamic -DUSE_GNU_BACKTRACE_SCRIPT for backtrace .sh calling addr2line
33 # Backtrace .bt data dump or .sh script will be stored in $DTV directory.
34 # Use btfd.sh </dtv/infile.bt if USE_GNU_BACKTRACE_SCRIPT not defined.
36 # Audit gcc flags, may generate a few warnings that would alarm the users.
37 # You can enable these if you are attempting to port to another platform.
38 #CFLAGS += -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wpointer-arith -Wshadow -Wbad-function-cast
39 # -Wcast-qual
41 # NOTE: -Wcast_qual may generate errors with #define WHO __FUNCTION__ due
42 # to inconsistency in __FUNCTION__ as char or unsigned char in various GCCs
44 # gcc man page says to use this for multi-threaded, but it breaks asnprintf?
45 #CFLAGS += -fstack-check
47 # default flags that should work for most cards
48 DVBFLAGS= -DUSE_DVB
49 # Comment USE_DYNAMIC for static FIFO, EIT, ETT, frames sequences, 21M.
50 # USE_DYNAMIC is the new default because it uses about 5M when idle.
51 DVBFLAGS += -DUSE_DYNAMIC
52 # Comment this if you don't want it to go to sleep because of driver bugs.
53 DVBFLAGS += -DUSE_POWERDOWN
55 # Console colors, comment this for 28kbit modem low bandwidth ssh remote
56 VFLAGS= -DUSE_ECMA48
58 # Multicast support, VERY experimental. Be CAREFUL. Know the dangers.
59 # You don't want to be sending out data your outbound link can't handle.
60 #UFLAGS= -DUSE_MCAST
62 # USE_WWW enables HTTP experimental support, May be insecure. Use a firewall.
63 # Change WWW_DVBS to the number of DVB API supported ATSC cards in this box
64 # USE_PNG enables display of signal strength as graph in HTTP inteface.
65 WFLAGS= -DUSE_WWW
66 WFLAGS += -DUSE_PNG -lpng
67 WFLAGS += -DUSE_CSS_SCROLLBARS
68 # vert scrollbar works but causes EPG render to be VERY CPU intensive/slow
70 # libmpeg2 and imlib2 flags for xtscut, remote X should not -DUSE_X_EXPOSE
71 # imlib1 is deprecated with xtscut 1.3.0, but can still be compiled,
72 MFLAGS1 = -lmpeg2 -lmpeg2convert -DUSE_IMLIB1 -DUSE_EXPOSE
73 MFLAGS2 = -lmpeg2 -lmpeg2convert -DUSE_IMLIB2 -DUSE_EXPOSE
74 MFLAGS3 = -lmpeg2 -lmpeg2convert -DUSE_LIBVO -lXv
76 # Both Imlibs have package configuration scripts. Use them if possible.
77 # If you don't have these scripts you need to install the -devel packages.
78 MFLAGS1 += `imlib-config --libs`
79 MFLAGS2 += `imlib2-config --libs`
80 # If you still get "imlib-config: command not found" error, try these instead:
81 #MFLAGS1 += -lImlib
82 #MFLAGS2 += -lImlib2
84 # Xtscut and Xsig need these for bare minimum functionality
85 XFLAGS= -L/usr/X11R6/lib -lX11
87 # Comment out one or more of these leaving only the tools you want.
88 PROGS=atscap atscut xtscut xtscut1 xtscut3 xsig
89 # atscap atscap-debug atscap-ssh atscap-udp xtscut1 xtscut2 xtscut3 xsig
90 # rxsock rzloop
92 # Top level that should use make all targets listed in PROGS
93 # make install is automatic to save keyboard wear
94 all: $(PROGS)
95 @echo '+++ compiled $(PROGS)'
96 @echo ' '
97 @echo '*** If no errors, only warnings, do this:'
98 @echo '$ make install'
99 @echo ' '
100 @echo '+++ For more make options, do this:'
101 @echo '$ make help'
102 @echo ' '
103 @echo '+++ Upgrading from older atscap version? Do this:'
104 @echo '$ make eclean'
105 @echo ' '
106 # make eclean
107 # make install
109 help:
110 @echo
111 @echo 'The following make options are available:'
112 @echo 'make [all] makes the following programs: '
113 @echo ' '$(PROGS)
114 @echo ' '
115 @echo 'make atscap make Standard ATSC DVB API capture tool'
116 @echo 'make atscap-debug make debug ATSC DVB API capture tool'
117 @echo 'make atscap-udp make Multicast UDP capture tool'
118 @echo 'make atscap-ssh make SSH no-color low-band capture tool'
119 @echo ' '
120 @echo 'make atscut make the ATSC Transport Stream utility'
121 @echo ' '
122 @echo 'make xtscut make default TS cutter (imlib2)'
123 @echo 'make xtscut1 make TS cutter, imlib1 based (slow)'
124 @echo 'make xtscut2 make TS cutter, imlib2 based (medium)'
125 @echo 'make xtscut3 make TS cutter, Xvideo based (fast)'
126 @echo ' '
127 @echo 'make xsig make a signal strength graphing tool'
128 @echo ' '
129 @echo 'make rxsock make UDP socket receiver test'
130 @echo 'make rzloop make command exit rc nz test'
131 @echo ' '
132 @echo 'make eclean removes guide data from $(DTV)/pg/'
133 @echo 'make clean removes compiled versions in this dir'
134 @echo 'make install install goes to '$(PREFIX)
135 @echo 'make docs Help! I need the man pages, NOW!'
136 @echo ' '
138 docs:
139 @echo +++ copying man pages to $(MAN1)/
140 @mkdir -p $(MAN1)
141 @cp -pf atscap.1.gz $(MAN1)
142 @cp -pf atscut.1.gz $(MAN1)
143 @cp -pf xtscut.1.gz $(MAN1)
144 @echo +++ copying man pages to $(MAN5)/
145 @mkdir -p $(MAN5)
146 @cp -pf atscap_conf.5.gz $(MAN5)
147 @echo +++ copying documentation to $(DOC)/
148 @mkdir -p $(DOC)
149 @cp -pf atscap.FEATURES.gz $(DOC)
150 @cp -pf atscap.README.gz $(DOC)
151 @cp -pf atscap.CHANGELOG.gz $(DOC)
152 @cp -pf atscap.NEWS.gz $(DOC)
153 @cp -pf atscap.MEMORY.gz $(DOC)
154 @echo $(DISTRO) >$(DOC)/$(DISTRO)
156 # strip $(PROGS)
157 install: $(PROGS)
158 @echo make install
159 @echo +++
160 @echo +++ copying binary files to $(BIN)/
161 @cp -pf $(PROGS) $(BIN)
162 @cp -pf btfd.sh $(BIN)
163 @echo +++ copying shell scripts to $(BIN)/
164 @cp -pi mpeg.sh $(BIN)
165 @cp -pi xtc.sh $(BIN)
166 @echo +++ copying man pages to $(MAN1)/
167 @mkdir -p $(MAN1)
168 @cp -pf atscap.1.gz $(MAN1)
169 @cp -pf atscut.1.gz $(MAN1)
170 @cp -pf xtscut.1.gz $(MAN1)
171 @echo +++ copying man pages to $(MAN5)/
172 @mkdir -p $(MAN5)
173 @cp -pf atscap_conf.5.gz $(MAN5)
174 @echo +++ copying documentation to $(DOC)/
175 @mkdir -p $(DOC)
176 @cp -pf atscap.FEATURES.gz $(DOC)
177 @cp -pf atscap.README.gz $(DOC)
178 @cp -pf atscap.CHANGELOG.gz $(DOC)
179 @cp -pf atscap.NEWS.gz $(DOC)
180 @cp -pf atscap.MEMORY.gz $(DOC)
181 @echo $(DISTRO) >$(DOC)/$(DISTRO)
182 @echo +++ extracting image files to ./img/
183 @tar zxf atscap-img.tar.gz
184 @echo +++ copying image files to $(DTV)/pg/img
185 @mkdir -p $(DTV)/pg/img
186 @cp -pf img/* $(DTV)/pg/img/
187 @echo +++ creating cut directory
188 @mkdir -p $(DTV)/cut
189 @echo +++ creating /etc/$(NAME) and /var/run/$(NAME) directories
190 @mkdir -p /etc/$(NAME)
191 @mkdir -p /var/run/$(NAME)
192 @echo $(DISTRO) is now installed
193 @echo +++
195 rxsock: rxsock.c
196 @echo rxsock is a program to test receiving stream via UDP.
197 $(CC) $(CFLAGS) -o $@ $^
199 # small regression tester that checks for exit non zero
200 rzloop: rzloop.c
201 @echo rzloop will loop on a command until it returns non-zero.
202 $(CC) -Wall -o $@ $^
204 # dvb only version
205 # compile, thread and DVB flags
206 atscap: atscap.c
207 @echo
208 @echo Building a colorful object:
209 $(CC) $(CFLAGS) $(DVBFLAGS) $(VFLAGS) $(UFLAGS) $(WFLAGS) -lpthread -o $@ $^
210 @echo +++ You have a capture tool. Setup is atscap -S.
211 @echo +++
212 @echo +++ 'Configuration has moved to /etc/atscap/atscap.?.conf'
213 @echo +++ You should do the following to remove old guide data:
214 @echo +++' make eclean'
215 @echo +++ See also make help ... some things are not usual defaults.
216 @echo +++ You may also set some defaults at the top of atscap.c.
217 @echo +++ You should do make install now.
218 @echo +++
220 # from Peter Knaggs wiki, a large binary about 3x > strip atscap version
221 atscap-debug: atscap.c
222 $(CC) -g -static -rdynamic \
223 -DUSE_GNU_BACKTRACE -DUSE_GNU_BACKTRACE_SCRIPT -DUSER_TEST \
224 -DUSE_LIBRT -DUSE_DVB -DUSE_POWERDOWN -DUSE_DYNAMIC \
225 -DUSE_ECMA48 -DUSE_WWW -DUSE_PNG -DUSE_CSS_SCROLLBARS \
226 -o atscap-debug atscap.c -lpthread -lrt -lm -lpng -lz
228 # compile, thread, DVB and multicast flags, no colors without VFLAGS
229 atscap-udp: atscap.c
230 @echo
231 @echo Building a noisy UDP colorful object:
232 $(CC) $(CFLAGS) $(DVBFLAGS) $(VFLAGS) $(UFLAGS) -lpthread -o $@ $^
233 @echo +++ You have a capture tool. Setup is atscap -S.
235 # compile, thread and DVB flags minus colors
236 atscap-ssh: atscap.c
237 @echo
238 @echo Building a drab object:
239 $(CC) $(CFLAGS) $(DVBFLAGS) -lpthread -o $@ $^
240 @echo +++ You have a capture tool. Setup is atscap -S.
242 # compile flags, need librt to time certain events
243 atscut: atscut.c common.h
244 @echo
245 @echo Building a shiney object:
246 $(CC) $(CFLAGS) -o $@ atscut.c
247 @echo +++ You have a transport stream tool. Try atscut -h.
249 # X11 and DVB flags
250 xsig: xsig.c
251 @echo
252 @echo Building a kaleidescope:
253 $(CC) $(CFLAGS) $(DVBFLAGS) $(XFLAGS) -o $@ $^
254 @echo +++ You have a graphical signal tool. Try xsig -h.
256 # X11 flags, mpeg2dec, with Imlib2, for xtscut 1.3.0 and later
257 xtscut: xtscut.c common.h
258 @echo
259 @echo Building a slice-n-dice-o-matic:
260 @echo +++ NOTE: This is the new standard preview render method.
261 @echo +++" "xtscut was tested with mpeg2dec-0.4.1 and imlib2-1.4.0.
262 @echo +++" "You should install these if you get related compile errors.
263 @echo +++" "The compiler flags for using libmpeg2 and libImlib2 are:
264 @echo +++" "$(MFLAGS2)
265 $(CC) $(CFLAGS) $(XFLAGS) $(MFLAGS2) -o xtscut xtscut.c
266 @echo +++ You have a visual transport stream cut tool. Try xtscut -h.
268 # X11 flags, mpeg2dec, old Imlib1 for backwards compatibility/benchmark tests
269 xtscut1: xtscut.c common.h
270 @echo
271 @echo Building a slice-n-dice-o-matic:
272 @echo +++ NOTE: This is the old standard preview render method.
273 @echo +++" "xtscut was tested with mpeg2dec-0.4.1 and imlib-1.9.14.
274 @echo +++" "You should install these if you get related compile errors.
275 @echo +++" "The compiler flags for using libmpeg2 and libImlib are:
276 @echo +++" "$(MFLAGS1)
277 $(CC) $(CFLAGS) $(XFLAGS) $(MFLAGS1) -o xtscut1 xtscut.c
278 @echo +++ You have a visual transport stream cut tool. Try xtscut -h.
280 # X11 flags, mpeg2dec, with Imlib2, for xtscut 1.3.0 and later
281 xtscut2: xtscut.c common.h
282 @echo
283 @echo Building a slice-n-dice-o-matic:
284 @echo +++ NOTE: This is the new standard preview render method.
285 @echo +++" "xtscut was tested with mpeg2dec-0.4.1 and imlib2-1.4.0.
286 @echo +++" "You should install these if you get related compile errors.
287 @echo +++" "The compiler flags for using libmpeg2 and libImlib2 are:
288 @echo +++" "$(MFLAGS2)
289 $(CC) $(CFLAGS) $(XFLAGS) $(MFLAGS2) -o xtscut2 xtscut.c
290 @echo +++ You have a visual transport stream cut tool. Try xtscut -h.
292 # X11 flags, mpeg2dec, with XShm/XVideo rendering for xtscut 1.3.2 and later
293 xtscut3: xtscut.c common.h xtc_libvo.c
294 @echo
295 @echo Building a slice-n-dice-o-matic:
296 @echo +++ NOTE: Xvideo preview render may not work with older systems.
297 @echo +++" "xtscut Xvideo was tested with mpeg2dec-0.4.1
298 @echo +++" "You should install this if you get related compile errors.
299 @echo +++" "The compiler flags for using libmpeg2 and Xvideo are:
300 @echo +++" "$(MFLAGS3)
301 $(CC) $(CFLAGS) $(XFLAGS) $(MFLAGS3) -o xtscut3 xtscut.c
302 @echo +++ You have a visual transport stream cut tool. Try xtscut -h.
304 eclean:
305 @echo '*** make eclean'
306 @echo Deleting old EPG data in /dtv/pg and /dtv/ram/pg
307 rm -f $(DTV)/pg/*.vc
308 rm -f $(DTV)/pg/*.epg
309 rm -f $(DTV)/ram/pg/*.vc
310 rm -f $(DTV)/ram/pg/*.epg
312 # dont know why it's phony
313 .PHONY clean:
314 @echo Carnival
315 @rm -f $(PROGS)