-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
403 lines (332 loc) · 14.6 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
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
# This Makefile requires either GNU make or BSD make
# Last Modified by jlc on Thu Oct 11, 2012
###########################################################################
# make local - builds for /usr/local and /var #
# make install - installs files in /usr/local and /var #
# #
# make package - builds for /usr, /etc, and /var #
# make package-install - installs files in /usr, /etc, and /var #
# #
# make fedora - builds for Fedora with service files #
# make fedora-install - installs in /usr, /etc, and /var #
# #
# make redhat - builds for Redhat with init.d files #
# make redhat-install - installs in /usr, /etc, and /var #
# #
# make ubuntu - builds for Ubuntu (includes init.d/ files) #
# make ubuntu-install - installs in /usr, /etc, and /var #
# #
# make tivo-mips - builds for a mips TiVo in /usr/local or prefix #
# can also prefix and prefix[234] #
# make tivo-install - installs in /usr/local #
# can also prefix and prefix[234] #
# make tivo-s1 - builds for a ppc TiVo for /var/hack #
# make tivo-s2 - builds for a mips TiVo for /var/hack #
# make tivo-hack-install - basic install into /var/hack #
# uses the cross compilers at: #
# http://tivoutils.sourceforge.net/ #
# usr.local.powerpc-tivo.tar.bz2 #
# (x86 cross compiler for Series1) #
# usr.local.mips-tivo.tar.bz2 #
# (x86 cross compiler for Series2) #
# #
# make freebsd - builds for FreeBSD in /usr/local #
# make freebsd-install - installs in /usr/local #
# #
# make mac - builds for Macintosh OS X in /usr/local #
# make mac-fat - builds universal OS X binaries in /usr/local #
# make mac-install - installs in /usr/local #
# #
# make cygwin - builds for Windows using cygwin #
# (does not function with modem or comm port) #
# make cygwin-install - installs files in /usr/local, and /var #
###########################################################################
subdirs = server client gateway modules logrotate tools man test \
doc debian Fedora FreeBSD Mac TiVo
Version := $(shell sed 's/.* //; 1q' VERSION)
API := $(shell sed '1d; 2q' VERSION)
# the prefix must end in a - (if part of a name) or a / (if part of a path)
MIPSXCOMPILE = mips-TiVo-linux-
PPCXCOMPILE = /usr/local/tivo/bin/
# prefix and prefix2 are used on a make, install, and making a package
# prefix3 is used on install to make a package
prefix = /usr/local
prefix2 = $(prefix)
prefix3 =
settag = NONE
setlock = NONE
setname = NONE
setmod = NONE
setmac = NONE
unset = NONE
BIN = $(prefix)/bin
SBIN = $(prefix)/sbin
SHARE = $(prefix)/share
ETC = $(prefix2)/etc
DEV = $(prefix3)/dev
VAR = $(prefix3)/var
CONFDIR = $(ETC)/ncid
MODULEDIR = $(SHARE)/ncid
DOCDIR = $(SHARE)/doc/ncid
IMAGEDIR = $(SHARE)/pixmaps/ncid
MAN = $(SHARE)/man
LOG = $(VAR)/log
RUN = $(VAR)/run
CONF = $(CONFDIR)/ncidd.conf
ALIAS = $(CONFDIR)/ncidd.alias
BLACKLIST = $(CONFDIR)/ncidd.blacklist
WHITELIST = $(CONFDIR)/ncidd.whitelist
TTYPORT = $(DEV)/modem
CIDLOG = $(LOG)/cidcall.log
DATALOG = $(LOG)/ciddata.log
LOGFILE = $(LOG)/ncidd.log
PIDFILE = $(RUN)/ncidd.pid
NCIDUPDATE = $(BIN)/cidupdate
NCIDUTIL = $(BIN)/ncidutil
WISH = wish
TCLSH = tclsh
# local additions to CFLAGS
MFLAGS = -Wmissing-declarations -Wunused-variable -Wparentheses \
-Wreturn-type -Wpointer-sign
# Documentation for FreeBSD, Mac, and TiVo
DOC = doc/NCID_Documentation.md doc/ncid-1.jpg doc/README.docdir \
doc/ReleaseNotes.md attic/README.attic \
server/README.server gateway/README.gateways test/README.test \
client/README.client modules/README.modules tools/README.tools \
logrotate/README.logrotate
default:
@echo "make requires an argument, see top of Makefile for description:"
@echo
@echo " make local # builds for /usr/local and /var"
@echo " make install # installs into /usr/local and /var"
@echo " make package # builds for /usr and /var"
@echo " make package-install # installs into for /usr and /var"
@echo " make fedora # builds for Fedora/Redhat with service files/"
@echo " make fedora-install # installs in /usr, /etc, and /var"
@echo " make redhat # builds for Redhat/Fedora, with init files/"
@echo " make redhat-install # installs in /usr, /etc, and /var"
@echo " make ubuntu # builds for Ubuntu, includes init.d/"
@echo " make ubuntu-install # installs in /usr, /etc, and /var"
@echo " make tivo-mips # builds for TiVo in /usr/local, /var"
@echo " make tivo-install # installs in /usr/local, /var"
@echo " make tivo-s1 # builds for a series1 in /var/hack"
@echo " make tivo-s2 # builds for a series[23] in /var/hack"
@echo " make tivo-hack-install # installs in /var/hack, /var"
@echo " make freebsd # builds for FreeBSD in /usr/local, /var"
@echo " make freebsd-install # installs in /usr/local, /var"
@echo " make mac # builds for Mac in /usr/local, /var"
@echo " make mac-fat # builds for Mac in /usr/local, /var"
@echo " make mac-install # installs in /usr/local, /var"
@echo " make cygwin # builds for windows using Cygwin"
@echo " make cygwin-install # installs in /usr/local"
local-base: serverdir clientdir moduledir gatewaydir tooldir docdir mandir
local: local-base logrotatedir
version.h: version.h-in
sed "s/XXX/$(Version)/; s/api/$(API)/" $< > $@
fedoradir:
cd Fedora; $(MAKE) service service prefix=$(prefix) prefix2=$(prefix2) \
prefix3=$(prefix3)
redhatdir:
cd Fedora; $(MAKE) init service prefix=$(prefix) prefix2=$(prefix2) \
prefix3=$(prefix3)
freebsddir:
cd FreeBSD; $(MAKE) rcd prefix=$(prefix) prefix2=$(prefix2) \
prefix3=$(prefix3)
ubuntudir:
cd debian; $(MAKE) init prefix=$(prefix) prefix2=$(prefix2) \
prefix3=$(prefix3)
tivodir:
cd TiVo; $(MAKE) prefix=$(prefix) prefix2=$(prefix2) prefix3=$(prefix3) \
OSDCLIENT=$(OSDCLIENT)
macdir:
cd Mac; $(MAKE) prefix=$(prefix) prefix2=$(prefix2) prefix3=$(prefix3)
moduledir:
cd modules; $(MAKE) modules prefix=$(prefix) prefix2=$(prefix2) \
prefix3=$(prefix3) setmod="$(setmod)" \
unset="$(unset)" setmac="$(setmac)"
gatewaydir:
cd gateway; $(MAKE) gateway prefix=$(prefix) prefix2=$(prefix2) \
prefix3=$(prefix3) BIN=$(BIN) SBIN=$(SBIN) \
MFLAGS="$(MFLAGS)" STRIP=$(STRIP)
serverdir:
cd server; $(MAKE) server prefix=$(prefix) prefix2=$(prefix2) \
prefix3=$(prefix3) BIN=$(BIN) SBIN=$(SBIN) \
MFLAGS="$(MFLAGS)" STRIP=$(STRIP)
clientdir:
cd client; $(MAKE) client prefix=$(prefix) prefix2=$(prefix2) \
prefix3=$(prefix3) BIN=$(BIN) SBIN=$(SBIN) \
MFLAGS="$(MFLAGS)" STRIP=$(STRIP)
tooldir:
cd tools; $(MAKE) tools prefix=$(prefix) prefix2=$(prefix2) \
prefix3=$(prefix3) BIN=$(BIN)
logrotatedir:
cd logrotate; $(MAKE) logrotate prefix=$(prefix) prefix2=$(prefix2) \
prefix3=$(prefix3)
docdir:
cd doc; $(MAKE) doc prefix=$(prefix) prefix2=$(prefix2) \
prefix3=$(prefix3)
mandir:
cd man; $(MAKE) man prefix=$(prefix) prefix2=$(prefix2) MAN=$(MAN)
package:
$(MAKE) local prefix=/usr prefix2=
package-install:
$(MAKE) install prefix=/usr prefix2=
fedora:
$(MAKE) local fedoradir prefix=/usr prefix2= \
LOCKFILE=/var/lock/lockdev/LCK.. \
TTYPORT=$(DEV)/ttyACM0
fedora-install:
$(MAKE) install install-fedora prefix=/usr prefix2=
redhat:
$(MAKE) local redhatdir prefix=/usr prefix2= \
LOCKFILE=/var/lock/lockdev/LCK.. \
TTYPORT=$(DEV)/ttyACM0
redhat-install:
$(MAKE) install install-redhat prefix=/usr prefix2=
ubuntu:
$(MAKE) local ubuntudir prefix=/usr prefix2= \
LOCKFILE=/var/lock/LCK.. \
TTYPORT=$(DEV)/ttyACM0
ubuntu-install:
$(MAKE) install install-ubuntu prefix=/usr prefix2=
tivo-s1:
$(MAKE) tivo-ppc prefix=/var/hack
tivo-ppc:
$(MAKE) local-base tivodir \
CC=$(PPCXCOMPILE)gcc \
MFLAGS="-DTIVO_S1 -D__need_timeval" \
LD=$(PPCXCOMPILE)ld \
RANLIB=$(PPCXCOMPILE)ranlib \
setname="TiVo requires CLOCAL" \
settag="TiVo PPC Modem Port" \
setlock="TiVo Modem Lockfile" \
setmod="TiVo" OSDCLIENT=tivocid
tivo-s2:
$(MAKE) tivo-mips prefix=/var/hack
tivo-hack-install:
$(MAKE) install-server install-client \
install-modules install-gateway install-tivo setmod=TiVo
@if ! test -d $(DOCDIR)/man; then mkdir -p $(DOCDIR)/man; fi
install -m 644 $(DOC) $(DOCDIR)
cd man; make index html
install -m 644 man/*.html $(DOCDIR)/man
tivo-mips:
$(MAKE) local tivodir fedoradir \
CC=$(MIPSXCOMPILE)gcc \
MFLAGS="-std=gnu99" \
LD=$(MIPSXCOMPILE)ld \
RANLIB=$(MIPSXCOMPILE)ranlib \
setname="TiVo requires CLOCAL" \
settag="TiVo MIPS Modem Port" \
setlock="TiVo Modem Lockfile" \
setmod="TiVo" OSDCLIENT=tivoncid
tivo-install:
$(MAKE) install-server install-client install-modules install-gateway \
install-man install-logrotate setmod=TiVo
freebsd:
$(MAKE) local-base freebsddir prefix=/usr/local prefix2=$(prefix) \
LOCKFILE=/var/spool/lock/LCK.. \
WISH=/usr/local/bin/wish*.* TCLSH=/usr/local/bin/tclsh*.* \
BASH=/usr/local/bin/bash
freebsd-install:
$(MAKE) install-base MAN=$(prefix)/man
@if ! test -d $(DOCDIR); then mkdir -p $(DOCDIR); fi
install -m 644 $(DOC) $(DOCDIR)
cd FreeBSD; \
$(MAKE) install prefix=$(prefix) prefix2=$(prefix2) prefix3=$(prefix3) \
MAN=$(prefix)/man
mac-fat:
$(MAKE) local-base macdir settag="default Mac OS X" \
unset="tts default" setmac="Mac default" \
LOCKFILE=/var/spool/uucp/LCK.. \
MFLAGS="-mmacosx-version-min=10.3.9 -arch ppc" STRIP=
mv server/ncidd server/ncidd.ppc-mac
mv gateway/sip2ncid gateway/sip2ncid.ppc-mac
mv gateway/ncid2ncid gateway/ncid2ncid.ppc-mac
$(MAKE) clean
$(MAKE) local settag="default Mac OS X" \
LOCKFILE=/var/spool/uucp/LCK.. \
MFLAGS="-mmacosx-version-min=10.4 -arch i386 -isysroot /Developer/SDKs/MacOSX10.4u.sdk" STRIP=
mv server/ncidd server/ncidd.i386-mac
mv gateway/sip2ncid gateway/sip2ncid.i386-mac
mv gateway/ncid2ncid gateway/ncid2ncid.i386-mac
lipo -create server/ncidd.ppc-mac server/ncidd.i386-mac \
-output server/ncidd
lipo -create gateway/sip2ncid.ppc-mac gateway/sip2ncid.i386-mac \
-output gateway/sip2ncid
lipo -create gateway/ncid2ncid.ppc-mac gateway/ncid2ncid.i386-mac \
-output gateway/ncid2ncid
mac:
$(MAKE) local-base macdir settag="default Mac OS X" \
unset="tts default" setmac="Mac default" \
LOCKFILE=/var/spool/uucp/LCK.. \
MFLAGS="-mmacosx-version-min=10.4" STRIP=
mac-install:
@if ! test -d $(DOCDIR); then mkdir -p $(DOCDIR); fi
install -m 644 $(DOC) $(DOCDIR)
$(MAKE) install-base install-mac MAN=$(MAN)
cygwin:
$(MAKE) local \
MFLAGS=-I/cygdrive/c/WpdPack/Include \
LDLIBS="-s -L/cygdrive/c/WpdPack/Lib -lwpcap" \
SBIN=$(prefix)/bin \
settag="set noserial" \
TTYPORT=$(DEV)/com1
cygwin-install:
$(MAKE) install \
SBIN=$(prefix)/bin \
settag="set noserial" \
TTYPORT=$(DEV)/com1
@if ! test -d $(DOCDIR); then mkdir -p $(DOCDIR); fi
install -m 644 $(DOC) $(DOCDIR)
install-base: install-server install-client install-man \
install-modules install-gateway install-tools
install: install-base install-logrotate
install-fedora:
cd Fedora; \
$(MAKE) install prefix=$(prefix) prefix2=$(prefix2) prefix3=$(prefix3)
install-redhat:
cd Fedora; \
$(MAKE) install-init prefix=$(prefix) prefix2=$(prefix2) prefix3=$(prefix3)
install-mac:
cd Mac; \
$(MAKE) install prefix=$(prefix) prefix2=$(prefix2) prefix3=$(prefix3)
install-ubuntu:
cd debian; \
$(MAKE) install prefix=$(prefix) prefix2=$(prefix2) prefix3=$(prefix3)
install-tivo:
cd TiVo; \
$(MAKE) install prefix=$(prefix) prefix2=$(prefix2) prefix3=$(prefix3)
install-gateway:
cd gateway; \
$(MAKE) install prefix=$(prefix) prefix2=$(prefix2) prefix3=$(prefix3)
install-modules:
cd modules; \
$(MAKE) install prefix=$(prefix) prefix2=$(prefix2) prefix3=$(prefix3) \
setmod="$(setmod)"
install-logrotate:
cd logrotate; \
$(MAKE) install prefix=$(prefix) prefix2=$(prefix2) prefix3=$(prefix3)
install-tools:
cd tools; \
$(MAKE) install prefix=$(prefix) prefix2=$(prefix2) prefix3=$(prefix3) \
ALIAS=$(ALIAS)
install-man:
cd man; \
$(MAKE) install prefix=$(prefix) prefix2=$(prefix2) prefix3=$(prefix3) \
MAN=$(MAN) setmod="$(setmod)"
install-server:
cd server; \
$(MAKE) install prefix=$(prefix) prefix2=$(prefix2) prefix3=$(prefix3)
install-client:
cd client; \
$(MAKE) install prefix=$(prefix) prefix2=$(prefix2) prefix3=$(prefix3)
clean:
for i in $(subdirs); do cd $$i; $(MAKE) clean; cd ..; done
clobber: clean
rm -f version.h a.out *.log *.zip *.tar.gz *.tgz
for i in $(subdirs); do cd $$i; $(MAKE) clobber; cd ..; done
distclean: clobber
files: $(FILES)
.PHONY: local ppc-tivo mips-tivo install install-proc \
install-logrotate install-man install-var clean clobber files