1# Makefile for the mgetty fax package
2#
3# SCCS-ID: $Id: Makefile,v 4.77 2010/06/05 09:48:22 gert Exp $ (c) Gert Doering
4#
5# this is the C compiler to use (on SunOS, the standard "cc" does not
6# grok my code, so please use gcc there. On ISC 4.0, use "icc".).
7#
8# if you are cross-compiling, this is the C compiler for the target platform
9#CC=gcc
10#CC=cc
11#
12# if you are cross-compiling, *this* needs to be the C compiler that
13# is able to produce binaries that run on the local system (if not
14# cross-compiling, just leave the line as is)
15HOSTCC=$(CC)
16#
17#### C Compiler Flags ####
18#
19# For SCO Unix 3.2v4, it may be necessary to define -D__STDC__=0
20# If you have problems with dial-in / dial-out on the same line (e.g.
21# 'cu' telling you "CAN'T ACCESS DEVICE"), you should try -DBROKEN_SCO_324
22# If the compiler barfs about my getopt() prototype, change it (mgetty.h)
23# If the linker cannot find "syslog()" (compiled with SYSLOG defined),
24# link "-lsocket".
25#
26# On SCO Unix 3.2.2, select(S) refuses to sleep less than a second,
27# so use poll(S) instead. Define -DUSE_POLL
28#
29# For Systems with a "login uid" (man setluid()), define -DSECUREWARE
30# (All SCO Systems have this). Maybe you've to link some special library
31# for it, on SCO it's "-lprot_s".
32#
33#
34# Add "-DSVR4" to compile on System V Release 4 unix
35# For SVR4.2, add "-DSVR4 -DSVR42" to the CFLAGS line.
36#
37# For Linux, you don't have to define anything
38#
39# For SunOS 4.x, please define -Dsunos4.
40#   (We can't use "#ifdef sun" because that's defined on solaris as well)
41#   If you use gcc, add -Wno-missing-prototypes, our code is OK, but
42#   the Sun4 header files lack a lot standard definitions...
43#   Be warned, Hardware handshake (and serial operations in general)
44#   work a lot more reliably with patch 100513-05 (jumbo tty patch)!
45#
46# For Solaris 2.x, please define -Dsolaris2, which will automatically
47#   #define SVR4.
48#
49# Add "-DISC" to compile on Interactive Unix. For posixized ISC 4.0 you
50# may have to add -D_POSIX_SOURCE
51#
52# For IBM AIX 4.x, no changes should be necessary. For AIX 3.x, it might
53# be necessary to add -D_ALL_SOURCE and -DUSE_POLL to the CFLAGS line.
54# [If you experience "strange" problems with AIX, report to me...!]
55#
56# Add "-D_3B1_ -DUSE_READ -D_NOSTDLIB_H -DSHORT_FILENAMES" to compile
57# on the AT&T 3b1 machine -g.t.
58#
59# Add "-DMEIBE" to compile on the Panasonic (Matsushita Electric
60#	industry) BE workstation
61#
62# When compiling on HP/UX, make sure that the compiler defines _HPUX_SOURCE,
63#     if it doesn't, add "-D_HPUX_SOURCE" to the CFLAGS line.
64#
65# On NeXTStep, add "-DNEXTSGTTY -DBSD". To compile vgetty or if you are
66#     brave, you have to use "-posix -DBSD".
67#
68# On the MIPS RiscOS, add "-DMIPS -DSVR4 -systype svr4" (the other
69#     subsystems are too broken. Watch out that *all* programs honour
70#     the SVR4 locking convention, "standard" UUCP and CU do not!)
71#
72# For (otherwise not mentioned) systems with BSD utmp handling, define -DBSD
73#
74# Add "-D_NOSTDLIB_H" if you don't have <stdlib.h>
75#
76# Add "-DPOSIX_TERMIOS" to use POSIX termios.h, "-DSYSV_TERMIO" to use
77#     the System 5 termio.h style. (Default set in tio.h)
78#
79# For machines without the select() call:
80#     Add "-DUSE_POLL" if you don't have select, but do have poll
81#     Add "-DUSE_READ" if you don't have select or poll (ugly)
82#
83# For older SVR systems (with a filename length restriction to 14
84#     characters), define -DSHORT_FILENAMES
85#
86# For Systems that default to non-interruptible system calls (symptom:
87# timeouts in do_chat() don't work reliably) but do have siginterrupt(),
88# define -DHAVE_SIGINTERRUPT. This is the default if BSD is defined.
89#
90# For Systems with broken termios / VMIN/VTIME mechanism (symptom: mgetty
91# hangs in "waiting for line to clear"), define -DBROKEN_VTIME. Notably
92# this hits FreeBSD 0.9 and some SVR4.2 users...
93#
94# If you don't have *both* GNU CC and GNU AS, remove "-pipe"
95#
96# Disk statistics:
97#
98# The following macros select one of 5 different variants of partition
99# information grabbing.  AIX, Linux, 3b1 and SVR4 systems will figure
100# this out themselves.  You can test whether you got this right by
101# running "make testdisk".  If it fails, consult getdisk.c for
102# further instructions.
103#
104#	    BSDSTATFS     - BSD/hp-ux/SunOS/Dynix/vrios
105#			    2-parameter statfs()
106#	    ULTRIXSTATFS  - Ultrix wacko statfs
107#	    SVR4	  - SVR4 statvfs()
108#	    SVR3	  - SVR3/88k/Apollo/SCO 4-parameter statfs()
109#	    USTAT	  - ustat(), no statfs etc.
110#
111#CFLAGS=-Wall -O2 -pipe -DSECUREWARE -DUSE_POLL
112#CFLAGS=-O2 -Wall -pipe
113#CFLAGS=-O -DSVR4
114#CFLAGS=-O -DSVR4 -DSVR42
115#CFLAGS=-O -DUSE_POLL
116#CFLAGS=-Wall -g -O2 -pipe
117# 3B1: You can remove _NOSTDLIB_H and USE_READ if you have the
118# networking library and gcc.
119#CFLAGS=-D_3B1_ -D_NOSTDLIB_H -DUSE_READ -DSHORT_FILENAMES
120#CFLAGS=-std -DPOSIX_TERMIOS -O2 -D_BSD -DBSD	# for OSF/1 (w/ /bin/cc)
121#CFLAGS=-DNEXTSGTTY -DBSD -O2			# for NeXT with sgtty (better!)
122#CFLAGS=-posix -DUSE_VARARGS -DBSD -O2		# for NeXT with POSIX
123#CFLAGS=-D_HPUX_SOURCE -Aa -DBSDSTATFS		# for HP-UX 9.x
124#CFLAGS=-cckr -D__STDC__ -O -DUSE_READ 		# for IRIX 5.2 and up
125
126
127#
128# LDFLAGS specify flags to pass to the linker. You could specify
129# 	special link modes, binary formats, whatever...
130#
131# For the 3B1, add "-s -shlib". For other systems, nothing is needed.
132#
133# LIBS specify extra libraries to link to the programs
134#       (do not specify the libraries in the LDFLAGS statement)
135#
136# To use the "setluid()" function on SCO, link "-lprot", and to use
137# the "syslog()" function, link "-lsocket".
138#
139# For SVR4(.2) and Solaris 2, you may need "-lsocket -lnsl" for syslog().
140#
141# For ISC, add "-linet -lpt" (and -lcposix, if necessary)
142#
143# For Sequent Dynix/ptx, you have to add "-lsocket"
144#
145# For OSF/1, add "-lbsd".
146#
147# On SCO Xenix, add -ldir -lx
148#
149# For FreeBSD and NetBSD, add "-lutil" if the linker complains about
150# 	"utmp.o: unresolved symbol _login"
151# For Linux, add "-lutil" if the linker complains about "updwtmp".
152#
153LDFLAGS=
154LIBS=	-lutil
155#LIBS=-lprot -lsocket				# SCO Unix
156#LIBS=-lsocket
157#LIBS=-lbsd					# OSF/1
158#LIBS=-lutil					# FreeBSD or Linux/GNU libc2
159#LDFLAGS=-posix					# NeXT with POSIX
160#LDFLAGS=-s -shlib				# 3B1
161#
162#
163# the following things are mainly used for ``make install''
164#
165#
166# program to use for installing files
167#
168# "-o <username>" sets the username that will own the binaries after installing.
169# "-g <group>" sets the group
170# "-c" means "copy" (as opposed to "move")
171#
172# if your systems doesn't have one, use the shell script that I provide
173# in "inst.sh" (taken from X11R5). Needed on IRIX5.2
174INSTALL=install -c
175INSTALL_PROGRAM=install -s -c
176#INSTALL=install -c -o root -g wheel		# NeXT/BSD
177#INSTALL=/usr/ucb/install -c -o bin -g bin	# AIX, Solaris 2.x
178#INSTALL=installbsd -c -o bin -g bin		# OSF/1, AIX 4.1, 4.2
179#INSTALL=/usr/bin/X11/bsdinst -c -o bin 	# IRIX
180#
181# prefix, where most (all?) of the stuff lives, usually /usr/local or /usr
182#
183prefix=/usr/local
184#
185# prefix for all the spool directories (usually /usr/spool or /var/spool)
186#
187spool=/var/spool
188#
189# where the mgetty + sendfax binaries live (used for "make install")
190#
191SBINDIR=$(prefix)/sbin
192#
193# where the user executable binaries live
194#
195BINDIR=$(prefix)/bin
196#
197# where the font+coverpage files go
198#
199LIBDIR=$(prefix)/lib/mgetty+sendfax
200#
201# where the configuration files (*.config, aliases, fax.allow/deny) go to
202#
203CONFDIR=$(prefix)/etc/mgetty+sendfax
204#CONFDIR=/etc/default/
205#
206#
207# where mgetty PID files (mgetty.pid) go to
208# (the faxrunqd PID file lives in FAX_SPOOL_OUT/ due to permission reasons)
209#
210VARRUNDIR=/var/run
211#
212# the fax spool directory
213#
214FAX_SPOOL=$(spool)/fax
215FAX_SPOOL_IN=$(FAX_SPOOL)/incoming
216FAX_SPOOL_OUT=$(FAX_SPOOL)/outgoing
217#
218# the user that owns the "outgoing fax queue" (FAX_SPOOL_OUT)
219# this user must exist in the system, otherwise faxspool will not work!
220#
221# faxrunq and faxrunqd should run under this user ID, and nothing else.
222# This user needs access to the modems of course.
223#
224# (it's possible to run faxrunq(d) as root, but the FAX_OUT_USER
225#  MUST NOT BE root or any other privileged account).
226#
227FAX_OUT_USER=root
228#
229#
230# Where section 1 manual pages should be placed
231MAN1DIR=$(prefix)/man/man1
232#
233# Where section 4 manual pages (mgettydefs.4) should be placed
234MAN4DIR=$(prefix)/man/man4
235#
236# Section 5 man pages (faxqueue.5)
237MAN5DIR=$(prefix)/man/man5
238#
239# Section 8 man pages (sendfax.8)
240MAN8DIR=$(prefix)/man/man8
241#
242# Where the GNU Info-Files are located
243#
244INFODIR=$(prefix)/info
245#
246#
247# A shell that understands bourne-shell syntax
248#  Usually this will be /bin/sh or /usr/bin/sh, but bash or ksh are fine.
249#  (on some ultrix systems, you may need /bin/sh5 here)
250#
251SHELL=/bin/sh
252#
253# If your shell requires pre-posix syntax to disable traps ('trap 0'
254#  instead of 'trap - 0'), set this to "0" (very rarely needed)
255#
256SHELL_TRAP_POSIX=1
257#
258# If you have problems with the awk-programs in the fax/ shell scripts,
259# try using "nawk" or "gawk" (or whatever works...) here
260# needed on most SunOS/Solaris/ISC/NeXTStep versions.
261#
262AWK=awk
263#
264# A few (very few) programs want Perl, preferably Perl5. This define
265# tells them where to find it. You can use everything except "faxrunqd"
266# and the "tkperl" frontends without PERL, so don't worry if you don't
267# have it.
268# If you specify command line arguments (-w), don't forget the quotes!
269PERL="$(LOCALBASE)/bin/perl -w"
270#
271# If you have Perl with TK extentions, define it here. This may be the
272# same as PERL=... above, or different, if you have TkPerl statically
273# linked.
274#TKPERL=/usr/bin/tkperl
275#
276#
277# An echo program that understands escapes like "\n" for newline or
278# "\c" for "no-newline-at-end". On SunOS, this is /usr/5bin/echo, in the
279# bash, it's "echo -e"
280# (don't forget the quotes, otherwise compiling mksed will break!!)
281#
282# If you do not have *any* echo program at all that will understand "\c",
283# please use the "mg.echo" program provided in the compat/ subdirectory.
284# Set ECHO="mg.echo" and INSTALL_MECHO to mg.echo
285#
286ECHO="mg.echo"
287#
288INSTALL_MECHO=mg.echo
289
290#
291# for mgetty, that's it. If you want to use the voice
292# extentions, go ahead (don't forget to read the manual!)
293
294# To maintain security, I recommend creating a new group for
295# users who are allowed to manipulate the recorded voice messages.
296PHONE_GROUP=phone
297PHONE_PERMS=770
298
299# Add -DNO_STRSTR to CFLAGS if you don't have strstr().
300
301# create hard/soft links (-s will be added by vgetty Makefile)
302LN=ln
303#LN=/usr/5bin/ln
304
305RM=rm
306MV=mv
307
308#
309# Nothing to change below this line ---------------------------------!
310#
311MR=1.1
312SR=37
313DIFFR=1.1.36
314#
315#
316OBJS=mgetty.o logfile.o do_chat.o locks.o utmp.o logname.o login.o \
317     mg_m_init.o modem.o faxrec.o ring.o \
318     faxlib.o faxsend.o faxrecp.o class1.o class1lib.o faxhng.o hyla_nsf.o \
319     g3file.o io.o gettydefs.o tio.o cnd.o getdisk.o goodies.o \
320     config.o conf_mg.o do_stat.o
321
322SFAXOBJ=sendfax.o logfile.o locks.o modem.o \
323     faxlib.o faxsend.o faxrecp.o class1.o class1lib.o faxhng.o hyla_nsf.o \
324     g3file.o io.o tio.o getdisk.o config.o conf_sf.o goodies.o
325
326all:	bin-all doc-man-only
327
328bin-all: mgetty sendfax newslock sedscript subdirs call-back vgetty
329
330# a few C files need extra compiler arguments
331
332mgetty.o : mgetty.c syslibs.h mgetty.h ugly.h policy.h tio.h fax_lib.h \
333	config.h mg_utmp.h Makefile
334	$(CC) $(CFLAGS) -DVARRUNDIR=\"$(VARRUNDIR)\" -c mgetty.c
335
336conf_mg.o : conf_mg.c mgetty.h ugly.h policy.h syslibs.h \
337	config.h conf_mg.h Makefile
338	$(CC) $(CFLAGS) -DFAX_SPOOL_IN=\"$(FAX_SPOOL_IN)\" \
339		-DCONFDIR=\"$(CONFDIR)\" -c conf_mg.c
340
341conf_sf.o : conf_sf.c mgetty.h ugly.h policy.h syslibs.h \
342	config.h conf_sf.h Makefile
343	$(CC) $(CFLAGS) -DCONFDIR=\"$(CONFDIR)\" -c conf_sf.c
344
345login.o : login.c mgetty.h ugly.h config.h policy.h mg_utmp.h  Makefile
346	$(CC) $(CFLAGS) -DCONFDIR=\"$(CONFDIR)\" -c login.c
347
348cnd.o : cnd.c syslibs.h policy.h mgetty.h ugly.h config.h  Makefile
349	$(CC) $(CFLAGS) -DCONFDIR=\"$(CONFDIR)\" -c cnd.c
350
351logname.o : logname.c syslibs.h mgetty.h policy.h tio.h mg_utmp.h Makefile
352
353# here are the binaries...
354
355mgetty: $(OBJS)
356	$(CC) -o mgetty $(OBJS) $(LDFLAGS) $(LIBS)
357
358sendfax: $(SFAXOBJ)
359	$(CC) -o sendfax $(SFAXOBJ) $(LDFLAGS) $(LIBS)
360
361# sentinelized binaries for runtime testing...
362sentinel:	mgetty.sen sendfax.sen
363
364mgetty.sen: $(OBJS)
365	sentinel -v $(CC) -o mgetty.sen $(OBJS) $(LDFLAGS) $(LIBS)
366
367sendfax.sen: $(SFAXOBJ)
368	sentinel -v $(CC) -o sendfax.sen $(SFAXOBJ) $(LDFLAGS) $(LIBS)
369
370# subdirectories...
371
372subdirs:
373	cd g3 &&    $(MAKE) "CC=$(CC)" "CFLAGS=$(CFLAGS) -I.." "LDFLAGS=$(LDFLAGS)" "LIBS=$(LIBS)" all
374	cd tools && $(MAKE) "CC=$(CC)" "CFLAGS=$(CFLAGS) -I.." "LDFLAGS=$(LDFLAGS)" "LIBS=$(LIBS)" all
375	cd fax &&   $(MAKE) "CC=$(CC)" "CFLAGS=$(CFLAGS) -I.." "LDFLAGS=$(LDFLAGS)" "LIBS=$(LIBS)" "FAX_SPOOL_OUT=$(FAX_SPOOL_OUT)" "FAX_OUT_USER=$(FAX_OUT_USER)" "CONFDIR=$(CONFDIR)" all
376
377call-back:
378	@$(MAKE) mgetty
379	cd callback && $(MAKE) "CC=$(CC)" "CFLAGS=$(CFLAGS) -I.." "LDFLAGS=$(LDFLAGS)" "CONFDIR=$(CONFDIR)" "VARRUNDIR=$(VARRUNDIR)" "LIBS=$(LIBS)" all
380
381contrib-all:
382	cd contrib ; $(MAKE) "CC=$(CC)" "CFLAGS=$(CFLAGS) -I.." "LDFLAGS=$(LDFLAGS)" "LIBS=$(LIBS)" all
383
384doc-all:
385	cd doc ; $(MAKE) "CC=$(CC)" "CFLAGS=$(CFLAGS) -I.." "LDFLAGS=$(LDFLAGS)" "LIBS=$(LIBS)" doc-all
386
387doc-man-only:
388	cd doc ; $(MAKE) "CC=$(CC)" "CFLAGS=$(CFLAGS) -I.." "LDFLAGS=$(LDFLAGS)" "LIBS=$(LIBS)" all
389
390# things...
391
392getdisk: getdisk.c
393	$(CC) $(CFLAGS) -DTESTDISK getdisk.c -o getdisk
394
395testdisk:	getdisk
396	./getdisk / .
397
398
399# README PROBLEMS
400DISTRIB=README.1st THANKS TODO BUGS FTP COPYING Recommend \
401	inittab.aix inst.sh version.h \
402	Makefile ChangeLog policy.h-dist ftp.sh mkidirs \
403	login.cfg.in mgetty.cfg.in sendfax.cfg.in \
404	dialin.config faxrunq.config \
405        mgetty.c mgetty.h ugly.h do_chat.c logfile.c logname.c locks.c \
406	mg_m_init.c modem.c ring.c \
407	class1.h class1.c class1lib.c hyla_nsf.c \
408	faxrec.c faxrecp.c faxsend.c faxlib.c fax_lib.h sendfax.c \
409	g3file.c \
410	io.c tio.c tio.h gettydefs.c login.c do_stat.c faxhng.c \
411	config.h config.c conf_sf.h conf_sf.c conf_mg.h conf_mg.c \
412	cnd.c getdisk.c mksed.c utmp.c mg_utmp.h syslibs.h goodies.c
413
414noident: policy.h
415	    for file in `find . -type f -name "*.[ch]" -print` ; do \
416	    echo "$$file..."; \
417	    case $$file in \
418	      *.c) \
419		mv -f $$file tmp-noident; \
420		sed -e "s/^#ident\(.*\)$$/static char sccsid[] =\1;/" <tmp-noident >$$file; \
421		;; \
422	      *.h) \
423		mv -f $$file tmp-noident; \
424		f=`basename $$file .h`; \
425		sed -e "s/^#ident\(.*\)$$/static char sccs_$$f[] =\1;/" <tmp-noident >$$file; \
426		;; \
427	    esac; \
428	done
429	$(MAKE) "CC=$(CC)" "CFLAGS=$(CFLAGS)" all
430
431sedscript: mksed
432	./mksed >sedscript
433	chmod +x sedscript
434
435mksed: mksed.c policy.h Makefile
436	$(HOSTCC) $(CFLAGS) -DBINDIR=\"$(BINDIR)\" -DSBINDIR=\"$(SBINDIR)\" \
437		-DLIBDIR=\"$(LIBDIR)\" \
438		-DCONFDIR=\"$(CONFDIR)\" \
439		-DFAX_SPOOL=\"$(FAX_SPOOL)\" \
440		-DFAX_SPOOL_IN=\"$(FAX_SPOOL_IN)\" \
441		-DFAX_SPOOL_OUT=\"$(FAX_SPOOL_OUT)\" \
442		-DFAX_OUT_USER=\"$(FAX_OUT_USER)\" \
443		-DVARRUNDIR=\"$(VARRUNDIR)\" \
444		-DAWK=\"$(AWK)\" \
445		-DPERL=\"$(PERL)\" -DTKPERL=\"$(TKPERL)\" \
446		-DECHO=\"$(ECHO)\" \
447		-DSHELL=\"$(SHELL)\" \
448		-DSHELL_TRAP_POSIX=$(SHELL_TRAP_POSIX) \
449	-o mksed mksed.c
450
451policy.h-dist: policy.h
452	@rm -f policy.h-dist
453	cp policy.h policy.h-dist
454	@chmod u+w policy.h-dist
455
456version.h: $(DISTRIB)
457	rm -f version.h
458	if expr "$(MR)" : "[0-9].[13579]" >/dev/null ; then \
459	    date=`date "+%b%d"` ;\
460	    echo "#define VERSION_LONG \"interim release $(MR).$(SR)-$$date\";" >version.h ;\
461	else \
462	    echo "#define VERSION_LONG \"stable release $(MR).$(SR)\";" >version.h ;\
463	fi
464	echo "#define VERSION_SHORT \"$(MR).$(SR)\"" >>version.h
465	echo "extern char * mgetty_version;" >>version.h
466	chmod 444 version.h
467
468mgetty$(MR).$(SR).tar.gz:	$(DISTRIB)
469	rm -f mgetty-$(MR).$(SR)
470	ln -sf . mgetty-$(MR).$(SR)
471	find . -name core -print | xargs rm -f
472	cd voice ; $(MAKE) clean && cvs update -d .
473	( echo "$(DISTRIB)" | tr " " "\\012" ; \
474	  for i in `find . -name .files -print | sed -e 's;^./;;` ; do \
475	      cat $$i | sed -e '/^\.files/d' -e 's;^;'`dirname $$i`'/;' ; \
476	  done ; \
477	  find voice -type f -print | grep -v CVS ; \
478	) \
479	    | sed -e 's;^;mgetty-$(MR).$(SR)/;g' \
480	    | gtar cvvfT mgetty$(MR).$(SR).tar -
481	gzip -f -9 -v mgetty$(MR).$(SR).tar
482
483tar:	mgetty$(MR).$(SR).tar.gz
484
485diff:	mgetty$(DIFFR)-$(MR).$(SR).diff.gz
486
487sign:	tar
488	pgp -sab mgetty$(MR).$(SR).tar.gz
489	chmod +r mgetty$(MR).$(SR).tar.gz.asc
490
491mgetty$(DIFFR)-$(MR).$(SR).diff.gz: \
492	mgetty$(DIFFR).tar.gz mgetty$(MR).$(SR).tar.gz
493	-rm -rf /tmp/mgd
494	mkdir /tmp/mgd
495	gtar xvCfz /tmp/mgd mgetty$(DIFFR).tar.gz
496	gtar xvCfz /tmp/mgd mgetty$(MR).$(SR).tar.gz
497	( cd /tmp/mgd ; \
498	  gdiff -u3 --ignore-space-change --recursive --new-file -I "^#ident" \
499		mgetty-$(DIFFR) mgetty-$(MR).$(SR) ; \
500		exit 0 ) >mgetty$(DIFFR)-$(MR).$(SR).diff
501	rm -rf /tmp/mgd
502	gzip -f -9 -v mgetty$(DIFFR)-$(MR).$(SR).diff
503
504mg.uue:	mgetty$(MR).$(SR).tar.gz
505	uuencode mgetty$(MR).$(SR)-`date +%b%d`.tar.gz <mgetty$(MR).$(SR).tar.gz >mg.uue
506
507uu:	mg.uue
508
509uu2:	mg.uue
510	split -3600 mg.uue mg.uu.
511
512# this is for automatic uploading to the beta site.
513# DO NOT USE IT if you're not ME! Please!
514#
515beta:	tar diff sign
516	test `hostname` = greenie.muc.de || exit 1
517# local
518	cp mgetty$(MR).$(SR).tar.gz /pub/mgetty-archive/
519	cp mgetty$(DIFFR)-$(MR).$(SR).diff.gz /pub/mgetty-archive/
520
521	-cvs commit -m 'new version released' version.h
522# master ftp/www site
523	./ftp.sh $(MR).$(SR) delta2.greenie.net \
524		'/home/ftp/pub/mgetty/source/$(MR)'
525	./beta $(MR) $(SR) $(DIFFR) delta2.greenie.net \
526		'/home/httpd/mgetty.greenie.net/doc'
527
528#shar1:	$(DISTRIB)
529#	shar -M -c -l 40 -n mgetty+sendfax-$(MR).$(SR) -a -o mgetty.sh $(DISTRIB)
530#
531#shar:	$(DISTRIB)
532#	shar -M $(DISTRIB) >mgetty$(MR).$(SR).sh
533
534doc-tar:
535	cd doc ; $(MAKE) "VS=$(MR).$(SR)" doc-tar
536
537policy.h:
538	@echo
539	@echo "You have to create your local policy.h first."
540	@echo "Copy policy.h-dist and edit it."
541	@echo
542	@exit 1
543
544clean:
545	rm -f *.o compat/*.o mgetty sendfax
546	rm -f testgetty getdisk mksed sedscript newslock *~
547	rm -f sendfax.config mgetty.config login.config
548	cd g3 &&       $(MAKE) clean
549	cd fax &&      $(MAKE) clean
550	cd tools &&    $(MAKE) clean
551	cd callback && $(MAKE) clean
552	cd contrib &&  $(MAKE) clean
553	cd doc &&      $(MAKE) clean
554	cd voice &&    $(MAKE) clean
555	cd t &&        $(MAKE) clean
556
557fullclean: clean
558
559distclean: clean
560
561login.config: login.cfg.in sedscript
562	./sedscript <login.cfg.in >login.config
563
564mgetty.config: mgetty.cfg.in sedscript
565	./sedscript <mgetty.cfg.in >mgetty.config
566
567sendfax.config: sendfax.cfg.in sedscript
568	./sedscript <sendfax.cfg.in >sendfax.config
569
570newslock: compat/newslock.c
571	$(CC) $(CFLAGS) -o newslock compat/newslock.c
572
573# internal: use this to create a "clean" mgetty+sendfax tree
574bindist: all doc-all sedscript
575	-rm -rf bindist
576	./mkidirs bindist$(prefix) bindist$(spool)
577	bd=`pwd`/bindist; PATH=`pwd`:"$$PATH" $(MAKE) prefix=$$bd$(prefix) \
578		BINDIR=$$bd$(BINDIR) SBINDIR=$$bd$(SBINDIR) \
579		LIBDIR=$$bd$(LIBDIR) CONFDIR=$$bd$(CONFDIR) \
580		spool=$$bd$(spool) FAX_SPOOL=$$bd$(FAX_SPOOL) \
581		FAX_SPOOL_IN=$$bd$(FAX_SPOOL_IN) \
582		FAX_SPOOL_OUT=$$bd$(FAX_SPOOL_OUT) \
583		MAN1DIR=$$bd$(MAN1DIR) MAN4DIR=$$bd$(MAN4DIR) \
584		MAN5DIR=$$bd$(MAN5DIR) MAN8DIR=$$bd$(MAN8DIR) \
585		INFODIR=$$bd$(INFODIR) install
586	cd bindist; gtar cvvfz mgetty$(MR).$(SR)-bin.tgz *
587
588
589install: install.bin install.doc install-vgetty
590
591install.bin: mgetty sendfax newslock \
592		login.config #mgetty.config sendfax.config
593#
594# binaries
595#
596	-test -d $(STAGEDIR)$(BINDIR)  || ( ./mkidirs $(STAGEDIR)$(BINDIR)  ; chmod 755 $(STAGEDIR)$(BINDIR)  )
597	$(INSTALL_PROGRAM) -m 755 newslock $(STAGEDIR)$(BINDIR)
598
599	-test -d $(STAGEDIR)$(SBINDIR) || ( ./mkidirs $(STAGEDIR)$(SBINDIR) ; chmod 755 $(STAGEDIR)$(SBINDIR) )
600	-mv -f $(STAGEDIR)$(SBINDIR)/mgetty $(STAGEDIR)$(SBINDIR)/mgetty.old
601	-mv -f $(STAGEDIR)$(SBINDIR)/sendfax $(STAGEDIR)$(SBINDIR)/sendfax.old
602	$(INSTALL_PROGRAM) -s -m 700 mgetty $(STAGEDIR)$(SBINDIR)
603	$(INSTALL_PROGRAM) -s -m 755 sendfax $(STAGEDIR)$(SBINDIR)
604	$(INSTALL_PROGRAM) -s -m 755 callback/callback $(STAGEDIR)$(SBINDIR)
605#
606# data files + directories
607#
608	test -d $(STAGEDIR)$(LIBDIR)  || \
609		( ./mkidirs $(STAGEDIR)$(LIBDIR) &&  chmod 755 $(STAGEDIR)$(LIBDIR) )
610	test -d $(STAGEDIR)$(CONFDIR) || \
611		( ./mkidirs $(STAGEDIR)$(CONFDIR) && chmod 755 $(STAGEDIR)$(CONFDIR))
612	test -f $(STAGEDIR)$(CONFDIR)/login.config || \
613		$(INSTALL) -m 600 login.config $(STAGEDIR)$(CONFDIR)/
614	test -f $(STAGEDIR)$(CONFDIR)/dialin.config || \
615		$(INSTALL) -m 600 dialin.config $(STAGEDIR)$(CONFDIR)/
616	test -f $(STAGEDIR)$(CONFDIR)/faxrunq.config || \
617		$(INSTALL) -m 644 faxrunq.config $(STAGEDIR)$(CONFDIR)/
618#
619# test for outdated stuff
620#
621	-@if test -f $(STAGEDIR)$(LIBDIR)/mgetty.login ; \
622	then \
623	    echo "WARNING: the format of $(LIBDIR)/mgetty.login has " ;\
624	    echo "been changed. Because of this, to avoid confusions, it's called " ;\
625	    echo "$(CONFDIR)/login.config now." ;\
626	    echo "" ;\
627	fi
628#
629# g3 tool programs
630#
631	cd g3 && $(MAKE) install INSTALL="$(INSTALL_PROGRAM)" \
632				BINDIR=$(BINDIR) \
633				LIBDIR=$(LIBDIR) CONFDIR=$(CONFDIR)
634#
635# fax programs / scripts / font file
636#
637	cd fax && $(MAKE) install INSTALL="$(INSTALL)" \
638				FAX_OUT_USER=$(FAX_OUT_USER) \
639				BINDIR=$(BINDIR) SBINDIR=$(SBINDIR) \
640				LIBDIR=$(LIBDIR) CONFDIR=$(CONFDIR)
641#
642# compatibility
643#
644	if [ ! -z "$(INSTALL_MECHO)" ] ; then \
645	    cd compat ; \
646	    $(CC) $(CFLAGS) -o mg.echo mg.echo.c && \
647	    $(INSTALL) -s -m 755 mg.echo $(STAGEDIR)$(BINDIR) ; \
648	fi
649
650#
651# documentation
652#
653install.doc:
654	cd doc ; $(MAKE) install INSTALL="$(INSTALL)" \
655				MAN1DIR=$(STAGEDIR)$(MAN1DIR) \
656				MAN4DIR=$(STAGEDIR)$(MAN4DIR) \
657				MAN5DIR=$(STAGEDIR)$(MAN5DIR) \
658				MAN8DIR=$(STAGEDIR)$(MAN8DIR) \
659				INFODIR=$(STAGEDIR)$(INFODIR)
660
661#
662# WWW frontend stuff
663#
664install.www:
665	cd frontends/www ; $(MAKE) install.www INSTALL="$(INSTALL)" \
666				BINDIR=$(BINDIR) \
667				LIBDIR=$(LIBDIR) CONFDIR=$(CONFDIR)
668#
669# voice extensions, consult the `voice' chapter in the documentation
670#
671
672vgetty:
673	@$(MAKE) mgetty
674	cd voice; $(MAKE) CFLAGS="$(CFLAGS)" CC="$(CC)" LDFLAGS="$(LDFLAGS)" \
675	LN="$(LN)" MV="$(MV)" RM="$(RM)" \
676	LIBS="$(LIBS)" \
677	FAX_SPOOL_IN="$(FAX_SPOOL_IN)" CONFDIR="$(CONFDIR)" \
678	VARRUNDIR="$(VARRUNDIR)" \
679	SHELL="$(SHELL)" vgetty-all
680
681vgetty-install: sedscript
682	cd voice; $(MAKE) CFLAGS="$(CFLAGS)" CC="$(CC)" LDFLAGS="$(LDFLAGS)" \
683	BINDIR="$(BINDIR)" SBINDIR="$(SBINDIR)" LIBDIR="$(LIBDIR)" \
684	CONFDIR="$(CONFDIR)" MAN1DIR="$(MAN1DIR)" MAN8DIR="$(MAN8DIR)" INSTALL="$(INSTALL)" \
685	PHONE_GROUP="$(PHONE_GROUP)" PHONE_PERMS="$(PHONE_PERMS)" \
686	LN="$(LN)" MV="$(MV)" RM="$(RM)" \
687	LIBS="$(LIBS)" vgetty-install
688
689install-vgetty: vgetty-install
690
691## test suite
692test: bin-all
693	for D in g3 t ; do \
694	    ( cd $$D ; $(MAKE) CFLAGS="$(CFLAGS) -I.." test ); \
695	done
696
697check: test
698## misc
699
700dump: logfile.o config.o conf_mg.o goodies.o getdisk.o tio.o gettydefs.o io.o
701	$(CC) -o dump -g dump.c logfile.o config.o conf_mg.o goodies.o getdisk.o tio.o gettydefs.o io.o $(LDFLAGS)
702
703######## anything below this line was generated by gcc -MM *.c
704cnd.o : cnd.c syslibs.h policy.h mgetty.h ugly.h config.h
705conf_mg.o : conf_mg.c mgetty.h ugly.h policy.h syslibs.h tio.h config.h conf_mg.h
706conf_sf.o : conf_sf.c mgetty.h ugly.h policy.h syslibs.h config.h conf_sf.h
707config.o : config.c syslibs.h mgetty.h ugly.h config.h
708do_chat.o : do_chat.c syslibs.h mgetty.h ugly.h policy.h tio.h
709ring.o: ring.c syslibs.h mgetty.h ugly.h policy.h tio.h
710do_stat.o : do_stat.c syslibs.h mgetty.h ugly.h policy.h tio.h
711dump.o : dump.c syslibs.h mgetty.h ugly.h policy.h tio.h fax_lib.h mg_utmp.h \
712  config.h conf_mg.h
713faxhng.o : faxhng.c mgetty.h ugly.h
714faxlib.o : faxlib.c mgetty.h ugly.h policy.h fax_lib.h
715faxrec.o : faxrec.c syslibs.h mgetty.h ugly.h tio.h policy.h fax_lib.h
716faxsend.o : faxsend.c syslibs.h mgetty.h ugly.h tio.h policy.h fax_lib.h
717files.o : files.c mgetty.h ugly.h policy.h
718getdisk.o : getdisk.c policy.h mgetty.h ugly.h
719gettydefs.o : gettydefs.c syslibs.h mgetty.h ugly.h policy.h
720goodies.o : goodies.c syslibs.h mgetty.h ugly.h config.h
721io.o : io.c syslibs.h mgetty.h ugly.h
722locks.o : locks.c mgetty.h ugly.h policy.h
723logfile.o : logfile.c mgetty.h ugly.h policy.h
724login.o : login.c mgetty.h ugly.h config.h policy.h mg_utmp.h
725logname.o : logname.c syslibs.h mgetty.h ugly.h policy.h tio.h mg_utmp.h
726mg_m_init.o : mg_m_init.c syslibs.h mgetty.h ugly.h tio.h policy.h fax_lib.h
727mgetty.o : mgetty.c syslibs.h mgetty.h ugly.h policy.h tio.h fax_lib.h mg_utmp.h \
728  config.h conf_mg.h
729sendfax.o : sendfax.c syslibs.h mgetty.h ugly.h tio.h policy.h fax_lib.h config.h \
730  conf_sf.h
731tio.o : tio.c mgetty.h ugly.h tio.h
732utmp.o : utmp.c mgetty.h ugly.h mg_utmp.h
733class1.o: class1.c mgetty.h ugly.h fax_lib.h tio.h class1.h
734class1lib.o: class1lib.c mgetty.h ugly.h fax_lib.h tio.h class1.h
735hyla_nsf.o: hyla_nsf.c mgetty.h ugly.h policy.h
736