# pragma ident "@(#)bnu:Makefile	1.14 91/11/07 "

#G_DEBUG=1

# Copyright 1991 Apple Computer, Inc.
# All Rights Reserved.
#
# THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF APPLE COMPUTER, INC.
# The copyright notice above does not evidence any actual or
# intended publication of such source code.
#
#
# The whole BNU suite of programs are designed to run under A/UX and AT&T 5.4.
# Some support is in place for V7 and BSD systems, but you'll have to do some
# hacking to get it all to work.
#
# Special commands:
#
#    /etc/uucpd	     - executable
#    /usr/ucb/uusend - executable
#
# Commands that the user normally uses are located in /bin or /usr/bin:
#
#    ct		     - executable		deals with I/O issues
#    cu		     - executable		deals with I/O issues
#    uucp	     - executable
#    uudecode	     - executable
#    uuencode	     - executable
#    uuglist	     - executable
#    uulog	     - shell-script
#    uuname	     - executable
#    uupick	     - shell-script
#    uustat	     - executable
#    uuto	     - shell-script
#    uux	     - executable
#
# Commands that the administrator, daemon or uucp normally uses are located in
# /usr/lib/uucp:
#
#    Cvt	     - shell-script		** NOT INSTALLED **
#    SetUp	     - shell-script		** NOT INSTALLED **
#    Teardown	     - shell-script		** NOT INSTALLED **
#    Uutry	     - shell-script
#    bnuconvert	     - executable		** NOT INSTALLED **
#    remote.unknown  - executable
#    uucheck	     - executable
#    uucico	     - executable		deals with I/O issues
#    uucleanup	     - executable
#    uudemon.admin   - shell-script
#    uudemon.cleanup - shell-script
#    uudemon.hour    - shell-script
#    uudemon.poll    - shell-script
#    uusched	     - executable
#    uuxqt	     - executable
#
# Data files are kept in /usr/lib/uucp:
#
#    Config
#    Devconfig
#    Devices
#    Dialcodes
#    Dialers
#    Grades
#    Limits
#    Permissions
#    Poll
#    README
#    Sysfiles
#    Systems
#
# For C2 security:
#    CFLAGS=-D_AUX_SECURITY
#    SEC_DEFS="-DSEC_BASE -DSEC_NET_TTY -DAUX -DAUX_3_0"
#    SEC_LIBS="-lsecurity"
#    SECURITY="YES"
#

DEFINES= -D_MAIN_IDENTS

$(G_DEBUG:V)G_CFLAGS= -g
$(G_DEBUG:V)G_LIBS= -lc

CFLAGS= $(G_CFLAGS::-O) $(DEFINES)

all install clean clobber strip dist clobbergoals distclean lint:: .FAKE
	$(MAKE) -G -f bnu.mk ROOT=${INSTALL_ROOT} DEFINES="${DEFINES}" $@
	$(MAKE) -G -f dial.mk ADD2CFLAGS=-O $@

all::	.FAKE uucpd uusend

dial.o:	.FAKE
	$(MAKE) -G -f dial.mk ADD2CFLAGS=-O $@

uuname uustat uux uucleanup uuxqt uucico uucp ct cu uucheck \
  	install_all install_exec \
	install_empty_files:: .FAKE
	$(MAKE) -G -f bnu.mk ROOT=${INSTALL_ROOT} DEFINES="${DEFINES}" $@

depend:: .FALE
	@echo "Creating .make_deps file..."
	@for n in *.[chly]; do \
	  ${CPP} -M ${DEFINES} $$n >> .make_deps; \
	done

tags::	.FAKE *.[ch]
	ctags -w *.[cshly]

###############################################################################
# Some UCB programs to handle incoming TCP requests and indirect files
# Add this line to /etc/servers:  "uucp tcp /etc/uucpd"
# Add this line to /etc/services: "uucp 540/tcp uucp"
###############################################################################

dist::	.FAKE strip install

install:: .FAKE ${INSTALL_ROOT}/etc/uucpd ${INSTALL_ROOT}/usr/ucb/uusend

uucpd:	uucpd.o logent.o uucpdefs.o utility.o systat.o ulockf.o \
	gnamef.o getargs.o security.o getpwinfo.o perfstat.o line.o \
	statlog.o sysfiles.o permission.o strsave.o uucpname.o expfile.o
	$(CC) -o $@ $> $(G_LIBS::-lc_s)

uusend:	uusend.o logent.o uucpdefs.o utility.o systat.o ulockf.o \
	gnamef.o getargs.o security.o getpwinfo.o perfstat.o line.o \
	statlog.o sysfiles.o permission.o strsave.o uucpname.o expfile.o
	$(CC) -o $@ $> $(G_LIBS::-lc_s)

clean::
	rm -f uucpd.o uusend.o

clobber distclean clobbergoals::
	rm -f uucpd uusend 

${INSTALL_ROOT}/etc/uucpd: $(I_ATTRIBUTES) $$(@F)
	cpset $(OLD) $(@F) $(@) 100 uucp uucp

${INSTALL_ROOT}/usr/ucb/uusend: $(I_ATTRIBUTES) $$(@F)
	cpset $(OLD) $(@F) $(@) 4111 uucp uucp

strip::	.FAKE uucpd uusend
	strip uucpd uusend

Include .make_deps

