Set the cut path properly when a non-default output path is specified
[atscap.git] / Makefile
blobccaa27aac3b412cf308021e7bc1499ec4eb8e12c
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 DOCS=atscap.1.gz atscut.1.gz xtscut.1.gz atscap_conf.5.gz atscap.FEATURES.gz atscap.README.gz atscap.CHANGELOG.gz atscap.NEWS.gz atscap.MEMORY.gz
94 # Top level that should use make all targets listed in PROGS
95 # make install is automatic to save keyboard wear
96 all: $(PROGS) $(DOCS)
97 @echo '+++ compiled $(PROGS)'
98 @echo ' '
99 @echo '*** If no errors, only warnings, do this:'
100 @echo '$ make install'
101 @echo ' '
102 @echo '+++ For more make options, do this:'
103 @echo '$ make help'
104 @echo ' '
105 @echo '+++ Upgrading from older atscap version? Do this:'
106 @echo '$ make eclean'
107 @echo ' '
108 # make eclean
109 # make install
111 help:
112 @echo
113 @echo 'The following make options are available:'
114 @echo 'make [all] makes the following programs: '
115 @echo ' '$(PROGS)
116 @echo ' '
117 @echo 'make atscap make Standard ATSC DVB API capture tool'
118 @echo 'make atscap-debug make debug ATSC DVB API capture tool'
119 @echo 'make atscap-udp make Multicast UDP capture tool'
120 @echo 'make atscap-ssh make SSH no-color low-band capture tool'
121 @echo ' '
122 @echo 'make atscut make the ATSC Transport Stream utility'
123 @echo ' '
124 @echo 'make xtscut make default TS cutter (imlib2)'
125 @echo 'make xtscut1 make TS cutter, imlib1 based (slow)'
126 @echo 'make xtscut2 make TS cutter, imlib2 based (medium)'
127 @echo 'make xtscut3 make TS cutter, Xvideo based (fast)'
128 @echo ' '
129 @echo 'make xsig make a signal strength graphing tool'
130 @echo ' '
131 @echo 'make rxsock make UDP socket receiver test'
132 @echo 'make rzloop make command exit rc nz test'
133 @echo ' '
134 @echo 'make eclean removes guide data from $(DTV)/pg/'
135 @echo 'make clean removes compiled versions in this dir'
136 @echo 'make install install goes to '$(PREFIX)
137 @echo 'make docs Help! I need the man pages, NOW!'
138 @echo ' '
140 %.gz:
141 @gzip -c $* > $*.gz
142 @touch -m -c -r $* $*.gz
144 docs: $(DOCS)
145 @echo +++ copying man pages to $(MAN1)/
146 @mkdir -p $(MAN1)
147 @cp -pf atscap.1.gz $(MAN1)
148 @cp -pf atscut.1.gz $(MAN1)
149 @cp -pf xtscut.1.gz $(MAN1)
150 @echo +++ copying man pages to $(MAN5)/
151 @mkdir -p $(MAN5)
152 @cp -pf atscap_conf.5.gz $(MAN5)
153 @echo +++ copying documentation to $(DOC)/
154 @mkdir -p $(DOC)
155 @cp -pf atscap.FEATURES.gz $(DOC)
156 @cp -pf atscap.README.gz $(DOC)
157 @cp -pf atscap.CHANGELOG.gz $(DOC)
158 @cp -pf atscap.NEWS.gz $(DOC)
159 @cp -pf atscap.MEMORY.gz $(DOC)
160 @echo $(DISTRO) >$(DOC)/$(DISTRO)
162 # strip $(PROGS)
163 install: $(PROGS) $(DOCS)
164 @echo make install
165 @echo +++
166 @echo +++ copying binary files to $(BIN)/
167 @cp -pf $(PROGS) $(BIN)
168 @cp -pf btfd.sh $(BIN)
169 @echo +++ copying shell scripts to $(BIN)/
170 @cp -pi mpeg.sh $(BIN)
171 @cp -pi xtc.sh $(BIN)
172 @echo +++ copying man pages to $(MAN1)/
173 @mkdir -p $(MAN1)
174 @cp -pf atscap.1.gz $(MAN1)
175 @cp -pf atscut.1.gz $(MAN1)
176 @cp -pf xtscut.1.gz $(MAN1)
177 @echo +++ copying man pages to $(MAN5)/
178 @mkdir -p $(MAN5)
179 @cp -pf atscap_conf.5.gz $(MAN5)
180 @echo +++ copying documentation to $(DOC)/
181 @mkdir -p $(DOC)
182 @cp -pf atscap.FEATURES.gz $(DOC)
183 @cp -pf atscap.README.gz $(DOC)
184 @cp -pf atscap.CHANGELOG.gz $(DOC)
185 @cp -pf atscap.NEWS.gz $(DOC)
186 @cp -pf atscap.MEMORY.gz $(DOC)
187 @echo $(DISTRO) >$(DOC)/$(DISTRO)
188 @echo +++ copying image files to $(DTV)/pg/img
189 @mkdir -p $(DTV)/pg/img
190 @cp -pf img/* $(DTV)/pg/img/
191 @echo +++ creating cut directory
192 @mkdir -p $(DTV)/cut
193 @echo +++ creating /etc/$(NAME) and /var/run/$(NAME) directories
194 @mkdir -p /etc/$(NAME)
195 @mkdir -p /var/run/$(NAME)
196 @echo $(DISTRO) is now installed
197 @echo +++
199 rxsock: rxsock.c
200 @echo rxsock is a program to test receiving stream via UDP.
201 $(CC) $(CFLAGS) -o $@ $^
203 # small regression tester that checks for exit non zero
204 rzloop: rzloop.c
205 @echo rzloop will loop on a command until it returns non-zero.
206 $(CC) -Wall -o $@ $^
208 # dvb only version
209 # compile, thread and DVB flags
210 atscap: atscap.c
211 @echo
212 @echo Building a colorful object:
213 $(CC) $(CFLAGS) $(DVBFLAGS) $(VFLAGS) $(UFLAGS) $(WFLAGS) -lpthread -o $@ $^
214 @echo +++ You have a capture tool. Setup is atscap -S.
215 @echo +++
216 @echo +++ 'Configuration has moved to /etc/atscap/atscap.?.conf'
217 @echo +++ You should do the following to remove old guide data:
218 @echo +++' make eclean'
219 @echo +++ See also make help ... some things are not usual defaults.
220 @echo +++ You may also set some defaults at the top of atscap.c.
221 @echo +++ You should do make install now.
222 @echo +++
224 # from Peter Knaggs wiki, a large binary about 3x > strip atscap version
225 atscap-debug: atscap.c
226 $(CC) -g -static -rdynamic \
227 -DUSE_GNU_BACKTRACE -DUSE_GNU_BACKTRACE_SCRIPT -DUSER_TEST \
228 -DUSE_LIBRT -DUSE_DVB -DUSE_POWERDOWN -DUSE_DYNAMIC \
229 -DUSE_ECMA48 -DUSE_WWW -DUSE_PNG -DUSE_CSS_SCROLLBARS \
230 -o atscap-debug atscap.c -lpthread -lrt -lm -lpng -lz
232 # compile, thread, DVB and multicast flags, no colors without VFLAGS
233 atscap-udp: atscap.c
234 @echo
235 @echo Building a noisy UDP colorful object:
236 $(CC) $(CFLAGS) $(DVBFLAGS) $(VFLAGS) $(UFLAGS) -lpthread -o $@ $^
237 @echo +++ You have a capture tool. Setup is atscap -S.
239 # compile, thread and DVB flags minus colors
240 atscap-ssh: atscap.c
241 @echo
242 @echo Building a drab object:
243 $(CC) $(CFLAGS) $(DVBFLAGS) -lpthread -o $@ $^
244 @echo +++ You have a capture tool. Setup is atscap -S.
246 # compile flags, need librt to time certain events
247 atscut: atscut.c common.h
248 @echo
249 @echo Building a shiney object:
250 $(CC) $(CFLAGS) -o $@ atscut.c
251 @echo +++ You have a transport stream tool. Try atscut -h.
253 # X11 and DVB flags
254 xsig: xsig.c
255 @echo
256 @echo Building a kaleidescope:
257 $(CC) $(CFLAGS) $(DVBFLAGS) $(XFLAGS) -o $@ $^
258 @echo +++ You have a graphical signal tool. Try xsig -h.
260 # X11 flags, mpeg2dec, with Imlib2, for xtscut 1.3.0 and later
261 xtscut: xtscut.c common.h
262 @echo
263 @echo Building a slice-n-dice-o-matic:
264 @echo +++ NOTE: This is the new standard preview render method.
265 @echo +++" "xtscut was tested with mpeg2dec-0.4.1 and imlib2-1.4.0.
266 @echo +++" "You should install these if you get related compile errors.
267 @echo +++" "The compiler flags for using libmpeg2 and libImlib2 are:
268 @echo +++" "$(MFLAGS2)
269 $(CC) $(CFLAGS) $(XFLAGS) $(MFLAGS2) -o xtscut xtscut.c
270 @echo +++ You have a visual transport stream cut tool. Try xtscut -h.
272 # X11 flags, mpeg2dec, old Imlib1 for backwards compatibility/benchmark tests
273 xtscut1: xtscut.c common.h
274 @echo
275 @echo Building a slice-n-dice-o-matic:
276 @echo +++ NOTE: This is the old standard preview render method.
277 @echo +++" "xtscut was tested with mpeg2dec-0.4.1 and imlib-1.9.14.
278 @echo +++" "You should install these if you get related compile errors.
279 @echo +++" "The compiler flags for using libmpeg2 and libImlib are:
280 @echo +++" "$(MFLAGS1)
281 $(CC) $(CFLAGS) $(XFLAGS) $(MFLAGS1) -o xtscut1 xtscut.c
282 @echo +++ You have a visual transport stream cut tool. Try xtscut -h.
284 # X11 flags, mpeg2dec, with Imlib2, for xtscut 1.3.0 and later
285 xtscut2: xtscut.c common.h
286 @echo
287 @echo Building a slice-n-dice-o-matic:
288 @echo +++ NOTE: This is the new standard preview render method.
289 @echo +++" "xtscut was tested with mpeg2dec-0.4.1 and imlib2-1.4.0.
290 @echo +++" "You should install these if you get related compile errors.
291 @echo +++" "The compiler flags for using libmpeg2 and libImlib2 are:
292 @echo +++" "$(MFLAGS2)
293 $(CC) $(CFLAGS) $(XFLAGS) $(MFLAGS2) -o xtscut2 xtscut.c
294 @echo +++ You have a visual transport stream cut tool. Try xtscut -h.
296 # X11 flags, mpeg2dec, with XShm/XVideo rendering for xtscut 1.3.2 and later
297 xtscut3: xtscut.c common.h xtc_libvo.c
298 @echo
299 @echo Building a slice-n-dice-o-matic:
300 @echo +++ NOTE: Xvideo preview render may not work with older systems.
301 @echo +++" "xtscut Xvideo was tested with mpeg2dec-0.4.1
302 @echo +++" "You should install this if you get related compile errors.
303 @echo +++" "The compiler flags for using libmpeg2 and Xvideo are:
304 @echo +++" "$(MFLAGS3)
305 $(CC) $(CFLAGS) $(XFLAGS) $(MFLAGS3) -o xtscut3 xtscut.c
306 @echo +++ You have a visual transport stream cut tool. Try xtscut -h.
308 eclean:
309 @echo '*** make eclean'
310 @echo Deleting old EPG data in /dtv/pg and /dtv/ram/pg
311 rm -f $(DTV)/pg/*.vc
312 rm -f $(DTV)/pg/*.epg
313 rm -f $(DTV)/ram/pg/*.vc
314 rm -f $(DTV)/ram/pg/*.epg
316 # dont know why it's phony
317 .PHONY clean:
318 @echo Carnival
319 @rm -f $(PROGS) $(DOCS)