# Makefile for tin - for tin compiler flag options read INSTALL and README.
#
# Options that may need changing. For advanced options read the INSTALL file.
# 
CC	= cc
COPTS	= -c -O2 -DNNTP_ABLE 
#CC	= gcc
#COPTS	= -c -g
# LD has to be changed to ln for AmigaDOS
LD	= $(CC)
YACC = yacc
#YACC = bison -y
DEBUG	=
#DEBUG	= -g -DDEBUG

# Where are your news libdir & spooldir?
LIBDIR	= /var/lib/news
SPOOLDIR= /var/spool/news
NOVROOTDIR= $(SPOOLDIR)

# Where do you want the binary & manual page installed?
INS_BINARY_DIR	= /usr/bin
INS_DAEMON_DIR	= $(LIBDIR)
INS_MANUAL_DIR	= /usr/man/man
INS_MANUAL_EXT	= 1

# From: address in posted articles (don't use both - read the INSTALL file)
#NNTP_INEWS_GATEWAY=
#NNTP_INEWS_DOMAIN=

# Default nntp server (can be overridden by NNTPSERVER environment variable)
NNTP_DEFAULT_SERVER=set.your.NNTPSERVER.variable

# Use INN clientlibs config functions (add -DUSE_INN_NNTPLIB to COPTS line)
INN_NNTPLIB=

AMIGA_COPTS=-so -wc -m0s -DM_AMIGA -DSYSV -DSLOW_SCREEN_UPDATE \
		-DNO_PIPING -DNO_SHELL_ESCAPE -DAMIGA_BBS -DLIBDIR=""uulib:"" \
		-DSPOOLDIR=""uunews:"" 

PROJECT	= tin
EXE	= tin
EXED	= tind
MAKE	= make
SHELL	= /bin/sh
STRIP	= strip
STRIP2	= mcs -d
#ROFF	= nroff -man 
ROFF	= groff -Tascii -man 
#BASE_VER= 1.21/tin-1.21
BASE_VER= 170993
VER = 1.22
MAIL_ADDR = "iain.lea@erlm.siemens.de"

HFILES	= config.h tin.h extern.h nntplib.h proto.h stpwatch.h amiga.h os_2.h \
		win32.h

CFILES	= active.c amiga.c art.c curses.c debug.c envarg.c feed.c getline.c \
		group.c hashstr.c help.c inews.c init.c kill.c lang.c mail.c \
		main.c memory.c misc.c newsrc.c nntplib.c open.c os_2.c page.c \
		parsdate.y post.c prompt.c rcfile.c save.c screen.c search.c \
		select.c sigfile.c signal.c spooldir.c strftime.c thread.c \
		wildmat.c win32.c xref.c

OFILES	= active.o amiga.o art.o curses.o debug.o envarg.o feed.o getline.o \
		group.o hashstr.o help.o inews.o init.o kill.o lang.o mail.o \
		main.o memory.o misc.o newsrc.o nntplib.o open.o os_2.o page.o \
		parsdate.o post.o prompt.o rcfile.o save.o screen.o search.o \
		select.o sigfile.o signal.o spooldir.o strftime.o thread.o \
		wildmat.o win32.o xref.o

SUPPORT = Makefile Makefile.ami Makefile.bcc Makefile.icc MANIFEST README \
		README.AMI README.OS2 CHANGES INSTALL HACKERS TODO FTP \
		*.[13] $(EXE).nrf $(EXE).lsm actived.c

NNTP_PATCH = README.NNTP INSTALL.NNTP common.patch server.patch xindex.c \
		xmotd.c xoverview.c xuser.c

ALL_FILES = $(SUPPORT) $(NNTP_PATCH) $(HFILES) patchlev.h $(CFILES)

LINTFLAGS=-a -c -h -n -x 

all: 
	@echo "Makefile for the TIN v$(VER) Usenet newsreader. Configuration:"
	@echo " "
	@echo "  Compiler=[$(CC)]  Copts=[$(COPTS)]  INN Lib=[$(INN_NNTPLIB)]"
	@echo "  Install Bindir=[$(INS_BINARY_DIR)]  Mandir=[$(INS_MANUAL_DIR)$(INS_MANUAL_EXT)]  Manext=[$(INS_MANUAL_EXT)]"
	@echo "  News Lib=[$(LIBDIR)]  Spool=[$(SPOOLDIR)]  Nov=[$(NOVROOTDIR)]"
	@echo "  News Gateway=[$(NNTP_INEWS_GATEWAY)]  Domain=[$(NNTP_INEWS_DOMAIN)]  Server=[$(NNTP_DEFAULT_SERVER)]"
	@echo " "
	@echo "If the above options are OK make one of the following targets:"
	@echo " "
	@echo "  make bsd     [ BSD[I] / DGUX / NeXT / OSF1 / Pyramid / SunOS / Ultrix (nntp)]"
	@echo "  make sysv    [ SysV / HPUX 7&8 ]         make sysvr4    [ SysVR4 / HPUX 9 ]"
	@echo "  make aix     [ IBM AIX (nntp) ]          make amiga     [ AmigaDOS ]"
	@echo "  make apollo  [ Apollo DomainOS ]         make coherent  [ Coherent 4.0 ]"
	@echo "  make dynix   [ Sequent DYNIX (nntp) ]    make irix      [ SGI Irix ]"
	@echo "  make linux   [ Linux (nntp) ]            make minix     [ Minix 386 ]"
	@echo "  make mips    [ Mips / CDC EPIX ]         make ptx       [ Sequent PTX ]"
	@echo "  make qnx     [ QNX 4.1 ]                 make sco       [ SCO Unix ]"
	@echo "  make sinix   [ SNI Sinix ]               make tower     [ NCR Tower]"
	@echo "  make xenix   [ SCO Xenix 386 ]"
	@echo " "
	@echo "Note that targets marked with '(nntp)' have -DNNTP_ABLE defined automatically."
	@echo " "

.c.o:
	$(CC) $(CFLAGS) $*.c

# Uncomment for COHERENT os
#.c.y:
#	$(YACC) $*.y

# For IBM AIX
aix:
	@echo "Compiling $(EXE) v$(VER) for IBM AIX..."
	@$(MAKE) CC=$(CC) CFLAGS='$(COPTS) -DSYSV -DRS6000 \
			-DNNTP_INEWS_GATEWAY=\"$(NNTP_INEWS_GATEWAY)\" \
			-DNNTP_INEWS_DOMAIN=\"$(NNTP_INEWS_DOMAIN)\" \
			-DNNTP_DEFAULT_SERVER=\"$(NNTP_DEFAULT_SERVER)\" \
			-DLIBDIR=\"$(LIBDIR)\" \
			-DSPOOLDIR=\"$(SPOOLDIR)\" \
			-DNOVROOTDIR=\"$(NOVROOTDIR)\"' \
			LIBS="-lcurses -ltermcap $(INN_NNTPLIB)" \
			EXE=tin linkit

# For Commodore AmigaOS
amiga:
	@echo "Compiling $(EXE) v$(VER) for AmigaDOS (Manx-C 5.2)..."
	$(MAKE) CC=$(CC) "CFLAGS=$(AMIGA_COPTS)" LIBS=-lc EXE=tin linkit

# For Apollo 
apollo:
	@echo "Compiling $(EXE) v$(VER) for Apollo..."
	@$(MAKE) CC=$(CC) CFLAGS='$(COPTS) \
			-DNNTP_INEWS_GATEWAY=\"$(NNTP_INEWS_GATEWAY)\" \
			-DNNTP_INEWS_DOMAIN=\"$(NNTP_INEWS_DOMAIN)\" \
			-DNNTP_DEFAULT_SERVER=\"$(NNTP_DEFAULT_SERVER)\" \
			-DLIBDIR=\"$(LIBDIR)\" \
			-DSPOOLDIR=\"$(SPOOLDIR)\" \
			-DNOVROOTDIR=\"$(NOVROOTDIR)\"' \
			LIBS="-lcurses -ltermcap $(INN_NNTPLIB)" \
			EXE=tin linkit

# For BSD-derived systems
bsd:
	@echo "Compiling $(EXE) v$(VER) for BSD/BSDI/DGUX/NeXT/OSF1/Pyramid/SunOS/Ultrix..."
	@$(MAKE) CC=$(CC) CFLAGS='$(COPTS) -DBSD \
			-DNNTP_INEWS_GATEWAY=\"$(NNTP_INEWS_GATEWAY)\" \
			-DNNTP_INEWS_DOMAIN=\"$(NNTP_INEWS_DOMAIN)\" \
			-DNNTP_DEFAULT_SERVER=\"$(NNTP_DEFAULT_SERVER)\" \
			-DLIBDIR=\"$(LIBDIR)\" \
			-DSPOOLDIR=\"$(SPOOLDIR)\" \
			-DNOVROOTDIR=\"$(NOVROOTDIR)\"' \
			LIBS="-lcurses -ltermcap $(INN_NNTPLIB)" \
			EXE=tin linkit

# For Coherent 4.0
#			 NETLIBS="-lsocket" \
#
coherent:
	@echo "Compiling $(EXE) v$(VER) for Coherent 4.0..."
	@$(MAKE) CC=$(CC) CFLAGS='-c -DSYSV \
			-DNNTP_INEWS_GATEWAY=\"$(NNTP_INEWS_GATEWAY)\" \
			-DNNTP_INEWS_DOMAIN=\"$(NNTP_INEWS_DOMAIN)\" \
			-DNNTP_DEFAULT_SERVER=\"$(NNTP_DEFAULT_SERVER)\" \
			-DLIBDIR=\"$(LIBDIR)\" \
			-DSPOOLDIR=\"$(SPOOLDIR)\" \
			-DNOVROOTDIR=\"$(NOVROOTDIR)\"' \
			LIBS="-lterm $(INN_NNTPLIB)" \
			LFLAGS= EXE=tin linkit

# For Sequent DYNIX
dynix:
	@echo "Compiling $(EXE) v$(VER) for Sequent DYNIX..."
	@$(MAKE) CC=$(CC) CFLAGS='$(COPTS) -DBSD \
			-DNNTP_INEWS_GATEWAY=\"$(NNTP_INEWS_GATEWAY)\" \
			-DNNTP_INEWS_DOMAIN=\"$(NNTP_INEWS_DOMAIN)\" \
			-DNNTP_DEFAULT_SERVER=\"$(NNTP_DEFAULT_SERVER)\" \
			-DLIBDIR=\"$(LIBDIR)\" \
			-DSPOOLDIR=\"$(SPOOLDIR)\" \
			-DNOVROOTDIR=\"$(NOVROOTDIR)\"' \
			LIBS="-lcurses -ltermcap -lseq $(INN_NNTPLIB)" \
			EXE=tin linkit


# For SGI Irix
irix:
	@echo "Compiling $(EXE) v$(VER) for SGI Irix..."
	@$(MAKE) CC=$(CC) CFLAGS='$(COPTS) -cckr -DSYSV \
			-DNNTP_INEWS_GATEWAY=\"$(NNTP_INEWS_GATEWAY)\" \
			-DNNTP_INEWS_DOMAIN=\"$(NNTP_INEWS_DOMAIN)\" \
			-DNNTP_DEFAULT_SERVER=\"$(NNTP_DEFAULT_SERVER)\" \
			-DLIBDIR=\"$(LIBDIR)\" \
			-DSPOOLDIR=\"$(SPOOLDIR)\" \
			-DNOVROOTDIR=\"$(NOVROOTDIR)\"' \
			LIBS="-lsun -lcurses -ltermcap $(INN_NNTPLIB)" \
			EXE=tin linkit

# For Linux
linux:
	@echo "Compiling $(EXE) v$(VER) for Slackware Linux (spool or NNTP)..."
	@$(MAKE) CC=$(CC) CFLAGS='$(COPTS) -DSYSV \
			-DNNTP_INEWS_GATEWAY=\"$(NNTP_INEWS_GATEWAY)\" \
			-DNNTP_INEWS_DOMAIN=\"/etc/NNTP_INEWS_DOMAIN\" \
			-DNNTP_DEFAULT_SERVER=\"$(NNTP_DEFAULT_SERVER)\" \
			-DLIBDIR=\"$(LIBDIR)\" \
			-DSPOOLDIR=\"$(SPOOLDIR)\" \
			-DNOVROOTDIR=\"$(NOVROOTDIR)\"' \
			LIBS="-lcurses -ltermcap $(INN_NNTPLIB)" \
			EXE=tin linkit

# For Minix 386
minix:
	@echo "Compiling $(EXE) v$(VER) for Minix 386..."
	@$(MAKE) CC=$(CC) CFLAGS='$(COPTS) -DMINIX -D_POSIX_SOURCE \
			-DNNTP_INEWS_GATEWAY=\"$(NNTP_INEWS_GATEWAY)\" \
			-DNNTP_INEWS_DOMAIN=\"$(NNTP_INEWS_DOMAIN)\" \
			-DNNTP_DEFAULT_SERVER=\"$(NNTP_DEFAULT_SERVER)\" \
			-DLIBDIR=\"$(LIBDIR)\" \
			-DSPOOLDIR=\"$(SPOOLDIR)\" \
			-DNOVROOTDIR=\"$(NOVROOTDIR)\"' \
			LIBS="-lcurses $(INN_NNTPLIB)" \
			EXE=tin linkit
	chmem +131072 $(EXE) 

# For Mips/CDC EPIX
mips:
	@echo "Compiling $(EXE) v$(VER) for Mips/CDC EPIX..."
	@$(MAKE) CC=$(CC) CFLAGS='$(COPTS) -DBSD -DEPIX -systype bsd43 \
			-DNNTP_INEWS_GATEWAY=\"$(NNTP_INEWS_GATEWAY)\" \
			-DNNTP_INEWS_DOMAIN=\"$(NNTP_INEWS_DOMAIN)\" \
			-DNNTP_DEFAULT_SERVER=\"$(NNTP_DEFAULT_SERVER)\" \
			-DLIBDIR=\"$(LIBDIR)\" \
			-DSPOOLDIR=\"$(SPOOLDIR)\" \
			-DNOVROOTDIR=\"$(NOVROOTDIR)\"' \
			LIBS="-L/bsd43/usr/lib -lcurses -ltermcap -lc $(INN_NNTPLIB)" \
			EXE=tin linkit

# For Sequent PTX
ptx:
	@echo "Compiling $(EXE) v$(VER) for Sequent PTX..."
	@$(MAKE) CC=$(CC) CFLAGS='$(COPTS) -DPTX \
			-DNNTP_INEWS_GATEWAY=\"$(NNTP_INEWS_GATEWAY)\" \
			-DNNTP_INEWS_DOMAIN=\"$(NNTP_INEWS_DOMAIN)\" \
			-DNNTP_DEFAULT_SERVER=\"$(NNTP_DEFAULT_SERVER)\" \
			-DLIBDIR=\"$(LIBDIR)\" \
			-DSPOOLDIR=\"$(SPOOLDIR)\" \
			-DNOVROOTDIR=\"$(NOVROOTDIR)\"' \
			LIBS="-lcurses -ltermcap" \
			NETLIBS="-lsocket -linet -lnsl_s $(INN_NNTPLIB)" \
			EXE=tin linkit

# For QNX
qnx:
	@echo "Compiling $(EXE) v$(VER) for QNX 4.1 (Watcom C 8.5E)..."
	@$(MAKE) CC=$(CC) CFLAGS='$(COPTS) -2 -ml -M -fi=unix.h -Wc,-zt200 -D_POSIX_SOURCE_ -DQNX4 \
			-DNNTP_INEWS_GATEWAY=\"$(NNTP_INEWS_GATEWAY)\" \
			-DNNTP_INEWS_DOMAIN=\"$(NNTP_INEWS_DOMAIN)\" \
			-DNNTP_DEFAULT_SERVER=\"$(NNTP_DEFAULT_SERVER)\" \
			-DLIBDIR=\"$(LIBDIR)\" \
			-DSPOOLDIR=\"$(SPOOLDIR)\" \
			-DNOVROOTDIR=\"$(NOVROOTDIR)\"' \
			LIBS="-lcurses $(INN_NNTPLIB)" \
			LFLAGS="-Wc,-zt200 -2 -ml -M -N24K '-Wl,op H=1k'" \
			EXE=tin linkit

# For SCO Unix
#			 NETLIBS="-lnsl_s -lsocket" \
#
sco:
	@echo "Compiling $(EXE) v$(VER) for SCO Unix..."
	@$(MAKE) CC=$(CC) CFLAGS='$(COPTS) -DSYSV -DSCO_UNIX -UM_XENIX \
			-DNNTP_INEWS_GATEWAY=\"$(NNTP_INEWS_GATEWAY)\" \
			-DNNTP_INEWS_DOMAIN=\"$(NNTP_INEWS_DOMAIN)\" \
			-DNNTP_DEFAULT_SERVER=\"$(NNTP_DEFAULT_SERVER)\" \
			-DLIBDIR=\"$(LIBDIR)\" \
			-DSPOOLDIR=\"$(SPOOLDIR)\" \
			-DNOVROOTDIR=\"$(NOVROOTDIR)\"' \
			LIBS="-lcurses -lgen -lc_s $(INN_NNTPLIB)" \
			EXE=tin linkit

# For SNI Sinix
sinix:
	@echo "Compiling $(EXE) v$(VER) for SNI Sinix..."
	@$(MAKE) CC=$(CC) CFLAGS='$(COPTS) \
			-DNNTP_INEWS_GATEWAY="\\"$(NNTP_INEWS_GATEWAY)\\" \
			-DNNTP_INEWS_DOMAIN="\\"$(NNTP_INEWS_DOMAIN)\\" \
			-DNNTP_DEFAULT_SERVER=\"$(NNTP_DEFAULT_SERVER)\" \
			-DLIBDIR=\\"$(LIBDIR)\\" \
			-DSPOOLDIR=\\"$(SPOOLDIR)\\" \
			-DNOVROOTDIR=\\"$(NOVROOTDIR)\\"' \
			LIBS="-lcurses $(INN_NNTPLIB)" \
			EXE=tin linkit

# For System V
#			 NETLIBS="-lnet -lnsl_s" \
#
sysv:
	@echo "Compiling $(EXE) v$(VER) for System V..."
	@$(MAKE) CC=$(CC) CFLAGS='$(COPTS) -DSYSV \
			-DNNTP_INEWS_GATEWAY=\"$(NNTP_INEWS_GATEWAY)\" \
			-DNNTP_INEWS_DOMAIN=\"$(NNTP_INEWS_DOMAIN)\" \
			-DNNTP_DEFAULT_SERVER=\"$(NNTP_DEFAULT_SERVER)\" \
			-DLIBDIR=\"$(LIBDIR)\" \
			-DSPOOLDIR=\"$(SPOOLDIR)\" \
			-DNOVROOTDIR=\"$(NOVROOTDIR)\"' \
			LIBS="-lcurses -ltermcap $(INN_NNTPLIB)" \
			EXE=tin linkit

# For System V Release 4
#			 NETLIBS="-lnsl -lsocket" \
#
sysvr4:
	@echo "Compiling $(EXE) v$(VER) for System V Release 4..."
	@$(MAKE) CC=$(CC) CFLAGS='$(COPTS) -DSVR4 \
			-DNNTP_INEWS_GATEWAY=\"$(NNTP_INEWS_GATEWAY)\" \
			-DNNTP_INEWS_DOMAIN=\"$(NNTP_INEWS_DOMAIN)\" \
			-DNNTP_DEFAULT_SERVER=\"$(NNTP_DEFAULT_SERVER)\" \
			-DLIBDIR=\"$(LIBDIR)\" \
			-DSPOOLDIR=\"$(SPOOLDIR)\" \
			-DNOVROOTDIR=\"$(NOVROOTDIR)\"' \
			LIBS="-lcurses -ltermcap $(INN_NNTPLIB)" \
			EXE=tin linkit

# For NCR Tower
#			 NETLIBS="-lnet -lnsl_s" \
#
tower:
	@echo "Compiling $(EXE) v$(VER) for NCR Tower..."
	@$(MAKE) CC=$(CC) CFLAGS='$(COPTS) -DSYSV -DNCR -DISTRING \
			-DNNTP_INEWS_GATEWAY=\"$(NNTP_INEWS_GATEWAY)\" \
			-DNNTP_INEWS_DOMAIN=\"$(NNTP_INEWS_DOMAIN)\" \
			-DNNTP_DEFAULT_SERVER=\"$(NNTP_DEFAULT_SERVER)\" \
			-DLIBDIR=\"$(LIBDIR)\" \
			-DSPOOLDIR=\"$(SPOOLDIR)\" \
			-DNOVROOTDIR=\"$(NOVROOTDIR)\"' \
			LIBS="-lcurses -ltermcap $(INN_NNTPLIB)" \
			EXE=tin linkit

# For Xenix 386
#			 NETLIBS="-lsocket" \
#
xenix:
	@echo "Compiling $(EXE) v$(VER) for Xenix 386..."
	@$(MAKE) CC=$(CC) CFLAGS='-c -Zi -DSYSV \
			-DNNTP_INEWS_GATEWAY="\\"$(NNTP_INEWS_GATEWAY)\\" \
			-DNNTP_INEWS_DOMAIN="\\"$(NNTP_INEWS_DOMAIN)\\" \
			-DNNTP_DEFAULT_SERVER="\\"$(NNTP_DEFAULT_SERVER)\\" \
			-DLIBDIR=\\"$(LIBDIR)\\" \
			-DSPOOLDIR=\\"$(SPOOLDIR)\\" \
			-DNOVROOTDIR=\\"$(NOVROOTDIR)\\"' \
			 LIBS="-lcurses -ltinfo -lx $(INN_NNTPLIB)" \
			 LFLAGS=-Zi EXE=tin linkit

# !!!  THE FOLLOWING ARE SITE SPECIFIC - IGNORE  !!!
ccenter_obj:
	@echo "Compiling a CL target for SUN01 with NNTP ONLY..."
	#setopt program_name $(EXE)
	#setopt sys_load_flags -Dsun -Dsparc -I/usr/include -I. -L/usr/lib -lcurses -ltermcap
	#load -c -g -DBSD -DNNTP_ABLE -DNNTP_ONLY -lcurses -ltermcap $(CFILES)
	#link

#	@$(MAKE) CC=gcc CFLAGS='-c -O2 -Wall -DSYSV -DHAVE_ISPELL -DNNTP_ABLE -DDONT_HAVE_NNTP_EXTS -DNNTP_INEWS_GATEWAY=\"$(NNTP_INEWS_GATEWAY)\" -DNNTP_INEWS_DOMAIN=\"$(NNTP_INEWS_DOMAIN)\" -DDEBUG' \
#
anl433:
	@echo "Compiling $(EXE) v$(VER) for ANL433 with NNTP..."
	@$(MAKE) CC=gcc CFLAGS='-c -O -Wall -DSYSV -DHAVE_MAIL_HANDLING -DHAVE_ISPELL -DNNTP_ABLE -DDEBUG \
			-DDONT_HAVE_NNTP_EXTS \
			-DNNTP_INEWS_GATEWAY=\"$(NNTP_INEWS_GATEWAY)\" \
			-DNNTP_INEWS_DOMAIN=\"$(NNTP_INEWS_DOMAIN)\" \
			-DNNTP_DEFAULT_SERVER=\"$(NNTP_DEFAULT_SERVER)\" \
			-DLIBDIR=\"$(LIBDIR)\" \
			-DSPOOLDIR=\"$(SPOOLDIR)\" \
			-DNOVROOTDIR=\"$(NOVROOTDIR)\"' \
			LIBS="-lcurses -ltermcap $(INN_NNTPLIB)" \
			NETLIBS="-linet -lnsl_s" \
			EXE=tin linkit

daemon:
	@echo "Compiling $(EXE) v$(VER) for ANL433 with INDEX DAEMON..."
	@$(MAKE) CC=gcc CFLAGS='-c -O2 -DSYSV -DINDEX_DAEMON -DDEBUG' \
			 EXE=$(EXED) linkit

dg01:
	@echo "Compiling $(EXE) v$(VER) for DG01 with NNTP ONLY..."
	@$(MAKE) CC=$(CC) CFLAGS='$(COPTS) -DBSD -DNNTP_ONLY -DDEBUG \
			-DNNTP_INEWS_GATEWAY=\"$(NNTP_INEWS_GATEWAY)\" \
			-DNNTP_INEWS_DOMAIN=\"$(NNTP_INEWS_DOMAIN)\" \
			-DNNTP_DEFAULT_SERVER=\"$(NNTP_DEFAULT_SERVER)\" \
			-DLIBDIR=\"$(LIBDIR)\" \
			-DSPOOLDIR=\"$(SPOOLDIR)\" \
			-DNOVROOTDIR=\"$(NOVROOTDIR)\"' \
			LIBS="-lcurses -ltermcap $(INN_NNTPLIB)" \
			EXE=tin linkit

idefix:
	@echo "Compiling $(EXE) v$(VER) for IDEFIX with NNTP ONLY..."
	@$(MAKE) CC=$(CC) CFLAGS='$(COPTS) -DSYSV -DSCO_UNIX -UM_XENIX -DNNTP_ONLY \
			-DNNTP_INEWS_GATEWAY=\"$(NNTP_INEWS_GATEWAY)\" \
			-DNNTP_INEWS_DOMAIN=\"$(NNTP_INEWS_DOMAIN)\" \
			-DNNTP_DEFAULT_SERVER=\"$(NNTP_DEFAULT_SERVER)\" \
			-DLIBDIR=\"$(LIBDIR)\" \
			-DSPOOLDIR=\"$(SPOOLDIR)\" \
			-DNOVROOTDIR=\"$(NOVROOTDIR)\"' \
			NETLIBS="-lnsl_s -lsocket" \
			LIBS="-lcurses -lgen -lc_s $(INN_NNTPLIB)" \
			EXE=tin linkit

os2unix:
	@echo "Compiling $(EXE) v$(VER) for OS2UNIX with NNTP ONLY..."
	@$(MAKE) CC=$(CC) CFLAGS='$(COPTS) -DSYSV -DNNTP_ONLY -DDEBUG \
			-DNNTP_INEWS_GATEWAY=\"$(NNTP_INEWS_GATEWAY)\" \
			-DNNTP_INEWS_DOMAIN=\"$(NNTP_INEWS_DOMAIN)\" \
			-DNNTP_DEFAULT_SERVER=\"$(NNTP_DEFAULT_SERVER)\" \
			-DLIBDIR=\"$(LIBDIR)\" \
			-DSPOOLDIR=\"$(SPOOLDIR)\" \
			-DNOVROOTDIR=\"$(NOVROOTDIR)\"' \
			LIBS="-lcurses -ltermcap -lx $(INN_NNTPLIB)" \
			NETLIBS="-linet -lnsl_s" \
			EXE=tin linkit

mx331:
	@echo "Compiling $(EXE) v$(VER) for MX331 with NNTP ONLY..."
	@$(MAKE) CC=$(CC) CFLAGS='$(COPTS) -DSYSV -DNNTP_ONLY \
			-DNNTP_INEWS_GATEWAY=\"$(NNTP_INEWS_GATEWAY)\" \
			-DNNTP_INEWS_DOMAIN=\"$(NNTP_INEWS_DOMAIN)\" \
			-DNNTP_DEFAULT_SERVER=\"$(NNTP_DEFAULT_SERVER)\" \
			-DLIBDIR=\"$(LIBDIR)\" \
			-DSPOOLDIR=\"$(SPOOLDIR)\" \
			-DNOVROOTDIR=\"$(NOVROOTDIR)\"' \
			LIBS="-lcurses $(INN_NNTPLIB)" \
			EXE=tin linkit

mx351:
	@echo "Compiling $(EXE) v$(VER) for MX351 with NNTP ONLY..."
	@$(MAKE) CC=$(CC) CFLAGS='$(COPTS) -DSVR4 -DNNTP_ONLY \
			-DNNTP_INEWS_GATEWAY=\"$(NNTP_INEWS_GATEWAY)\" \
			-DNNTP_INEWS_DOMAIN=\"$(NNTP_INEWS_DOMAIN)\" \
			-DNNTP_DEFAULT_SERVER=\"$(NNTP_DEFAULT_SERVER)\" \
			-DLIBDIR=\"$(LIBDIR)\" \
			-DSPOOLDIR=\"$(SPOOLDIR)\" \
			-DNOVROOTDIR=\"$(NOVROOTDIR)\"' \
			NETLIBS="-lnsl -lsocket" \
			LIBS="-lcurses -ltermlib $(INN_NNTPLIB)" \
			EXE=tin linkit

sparc10_1:
	@echo "Compiling $(EXE) v$(VER) for SPARC10 with NNTP ONLY..."
	@$(MAKE) CC=$(CC) CFLAGS='$(COPTS) -DBSD -DNNTP_ONLY \
			-DNNTP_INEWS_GATEWAY=\"$(NNTP_INEWS_GATEWAY)\" \
			-DNNTP_INEWS_DOMAIN=\"$(NNTP_INEWS_DOMAIN)\" \
			-DNNTP_DEFAULT_SERVER=\"$(NNTP_DEFAULT_SERVER)\" \
			-DLIBDIR=\"$(LIBDIR)\" \
			-DSPOOLDIR=\"$(SPOOLDIR)\" \
			-DNOVROOTDIR=\"$(NOVROOTDIR)\"' \
			LIBS="-lcurses -ltermcap $(INN_NNTPLIB)" \
			EXE=tin linkit

sparc10cd:
	@echo "Compiling $(EXE) v$(VER) for SPARC10 with CDROM ABLE..."
	@$(MAKE) CC=$(CC) CFLAGS='$(COPTS) -DBSD -DCDROM_ABLE -DDEBUG' \
 			 NNTPLIB="$(CDLIB)" \
			 LIBS="-lcurses -ltermcap $(INN_NNTPLIB)" \
			 EXE=cdtin linkit

linkit: $(OFILES)
	@echo "Linking $(EXE) v$(VER)..."
	$(LD) $(LFLAGS) -o $(EXE) $(OFILES) $(NNTPLIB) $(NETLIBS) $(LIBS) 
	@ls -l $(EXE)

install:
	@echo "Installing $(EXE) v$(VER)..."
	@$(STRIP) $(EXE)
	@-$(STRIP2) $(EXE)
	@-mv $(EXE) $(INS_BINARY_DIR)
	@-rm $(INS_BINARY_DIR)/r$(EXE)
	@ln $(INS_BINARY_DIR)/$(EXE) $(INS_BINARY_DIR)/r$(EXE)
	@chmod 755 $(INS_BINARY_DIR)/$(EXE)
	@ls -l $(INS_BINARY_DIR)/$(EXE) $(INS_BINARY_DIR)/r$(EXE)
	@cp $(EXE).1 $(INS_MANUAL_DIR)$(INS_MANUAL_EXT)/$(EXE).$(INS_MANUAL_EXT)
	@chmod 644 $(INS_MANUAL_DIR)$(INS_MANUAL_EXT)/$(EXE).$(INS_MANUAL_EXT)

install_setuid:
	@echo "Installing SETUID $(EXE) v$(VER)..."
	@$(STRIP) $(EXE)
	@-$(STRIP2) $(EXE)
	@-mv $(EXE) $(INS_BINARY_DIR)
	@chown news $(INS_BINARY_DIR)/$(EXE) 
	@chgrp news $(INS_BINARY_DIR)/$(EXE) 
	@-rm $(INS_BINARY_DIR)/r$(EXE)
	@ln $(INS_BINARY_DIR)/$(EXE) $(INS_BINARY_DIR)/r$(EXE)
	@su news -c "chmod 6755 $(INS_BINARY_DIR)/$(EXE)"
	@ls -l $(INS_BINARY_DIR)/$(EXE) $(INS_BINARY_DIR)/r$(EXE)
	@cp $(EXE).1 $(INS_MANUAL_DIR)$(INS_MANUAL_EXT)/$(EXE).$(INS_MANUAL_EXT)
	@chmod 644 $(INS_MANUAL_DIR)$(INS_MANUAL_EXT)/$(EXE).$(INS_MANUAL_EXT)

install_daemon:
	@echo "Installing index daemon $(EXED) v$(VER)..."
	@$(STRIP) $(EXED)
	@-$(STRIP2) $(EXED)
	@-mv $(EXED) $(INS_DAEMON_DIR)
	@chown news $(INS_DAEMON_DIR)/$(EXED) 
	@chmod 0755 $(INS_DAEMON_DIR)/$(EXED)
	@ls -l $(INS_DAEMON_DIR)/$(EXED)

proto:
	@echo "Generating function prototypes for proto.h..."
	@echo "#if __STDC__" > PROTO.H
	@echo " " >> PROTO.H
	@cproto -e $(CFILES) >> PROTO.H
	@echo " " >> PROTO.H
	@echo "#else" >> PROTO.H
	@echo " " >> PROTO.H
	@cproto -e -f1 $(CFILES) >> PROTO.H
	@echo " " >> PROTO.H
	@echo "#endif" >> PROTO.H
	@-mv PROTO.H proto.h

nroff:
	@echo "Creating nroff man page..."
	@-$(ROFF) $(EXE).1 > $(EXE).nrf

manifest:
	@echo "Creating MANIFEST..."
	@echo "MANIFEST for $(PROJECT)-$(VER) (`date`)" > MANIFEST
	@echo "----------------------------------------------------" >> MANIFEST
	@wc -c $(ALL_FILES) >> MANIFEST

shar:
	@echo "Generating shell archive..."
	@$(MAKE) nroff
	@$(MAKE) manifest
	@$(MAKE) chmod
	@shar -a -F -L75 -n $(PROJECT)-$(VER) -s $(MAIL_ADDR) \
		-o ../$(PROJECT)-$(VER) $(ALL_FILES)

uuencode:
	@$(MAKE) tar
	@echo "Uuencoding $(PROJECT).tar.Z..."
	@uuencode $(PROJECT).tar.Z $(PROJECT).tar.Z > $(PROJECT).tar.Z.uue
	@ls -l $(PROJECT).tar.Z.uue
 
diff:
	@echo "Generating diffs against $(PROJECT)-$(BASE_VER)..."
	@$(MAKE) nroff
	@$(MAKE) manifest
	@$(MAKE) chmod
	@-mv -f $(PROJECT)-$(VER).diff $(PROJECT)-$(VER).diff-
	@-diff -rus ../$(BASE_VER) . > $(PROJECT)-$(VER).diff
#	@-diff -rcs ../$(BASE_VER) . > $(PROJECT)-$(VER).diff
	@ls -l $(PROJECT)-$(VER).diff

patch:
	@$(MAKE) diff
	@echo "Generating patch against $(PROJECT)-$(BASE_VER)..."
	@-mv $(PROJECT)-$(VER).diff $(PROJECT)-$(VER).patch
	@shar -a -n $(PROJECT)-$(VER) -s $(MAIL_ADDR) -L75 \
		-o ../patch-$(VER) $(PROJECT)-$(VER).patch
	@ls -l ../patch-$(VER).*

tar:
	@echo "Generating compressed tar file..."
	@-rm $(PROJECT).tar $(PROJECT).tar.Z > /dev/null 2>&1
	$(MAKE) chmod
	@tar cvf $(PROJECT).tar $(ALL_FILES)  
	@echo "Compressing $(PROJECT).tar..."
	@compress $(PROJECT).tar 
	@ls -l $(PROJECT).tar.Z

gtar:
	@echo "Generating gzipped tar file..."
	@-rm $(PROJECT).t $(PROJECT).t.[gz] > /dev/null 2>&1
	$(MAKE) chmod
	@tar cvf $(PROJECT).t $(ALL_FILES)  
	@echo "Gzipping $(PROJECT).t..."
	@gzip $(PROJECT).t 
	@ls -l $(PROJECT).t.[gz]

ftptar:
	@echo "Creating FTP tar file with a directory of $(PROJECT)-$(VER)..."
	@-mkdir $(PROJECT)-$(VER)
	@chmod 755 $(PROJECT)-$(VER)
	@$(MAKE) chmod
	@cp $(ALL_FILES) $(PROJECT)-$(VER)
	@tar cvf $(PROJECT)-$(VER).tar $(PROJECT)-$(VER)
	@echo "Compressing $(PROJECT)-$(VER).tar..."
	@compress $(PROJECT)-$(VER).tar 
	@ls -l $(PROJECT)-$(VER).tar.Z

chmod:
	@chmod 644 $(ALL_FILES)

zip:
	@echo "Generating zip archive file..."
	@-rm $(PROJECT).zip > /dev/null 2>&1
	@zip $(PROJECT).zip  $(ALL_FILES)
	@ls -l $(PROJECT).zip

zoo:
	@echo "Generating zoo archive file..."
	@-rm $(PROJECT).zoo > /dev/null 2>&1
	@zoo ah $(PROJECT).zoo  $(ALL_FILES)
	@ls -l $(PROJECT).zoo

tags:
	@echo "Generating tags (results in ./tags)..."
	@-rm tags
	@ctags $(HFILES) patchlev.h $(CFILES) 

lint:
	@echo "Linting source (results in ./LINT)..."
	@lint $(LINTFLAGS) -DNNTP_ABLE $(CFILES) > LINT

clean:
	@echo "Cleaning..."
	-/bin/rm -f $(OFILES)

clobber:
	@echo "Clobbering..."
	/bin/rm -f $(OFILES) $(EXE) tags 

cflow:
	@echo "Creating cflow for $(PROJECT)..."
	@cflow $(CFILES) > cflow.$(PROJECT) &

cscope:
	@echo "Creating cscope database $(PROJECT)..."
	@cscope $(ALL_FILES)

man:
	@echo "Printing $(EXE) manual..."
	@$(ROFF) $(EXE).1 | lpr

print:
	for FILE in $(HFILES) patchlev.h $(CFILES) $(SUPPORT); do \
	echo "Printing $$FILE..."; \
	a2ps $$FILE | lpr; \
	done

actived:
	@echo "Compiling actived for AmigaDOS (Manx-C 5.2)..."
	$(CC) CFLAGS=$(AMIGA_COPTS) actived
	$(LD) actived -lc 
	
active.o:	active.c $(HFILES)
amiga.o:	amiga.c $(HFILES)
art.o:		art.c $(HFILES)
curses.o:	curses.c $(HFILES)
debug.o:	debug.c $(HFILES)
envarg.o:	envarg.c $(HFILES)
feed.o:		feed.c $(HFILES)
getline.o:	getline.c $(HFILES)
group.o:	group.c $(HFILES)
hashstr.o:	hashstr.c $(HFILES)
help.o:		help.c $(HFILES)
inews.o:	inews.c $(HFILES)
init.o:		init.c $(HFILES)
kill.o:		kill.c $(HFILES)
lang.o:		lang.c $(HFILES)
mail.o:		mail.c $(HFILES) patchlev.h
main.o:		main.c $(HFILES) patchlev.h
memory.o:	memory.c $(HFILES)
misc.o:		misc.c $(HFILES)
newsrc.o:	newsrc.c $(HFILES)
nntplib.o:	nntplib.c $(HFILES)
open.o:		open.c $(HFILES) patchlev.h
os_2.o:		os_2.c $(HFILES)
page.o:		page.c $(HFILES)
parsdate.o:	parsdate.y $(HFILES)
post.o:		post.c $(HFILES) patchlev.h
prompt.o:	prompt.c $(HFILES)
rcfile.o:	rcfile.c $(HFILES)
save.o:		save.c $(HFILES)
screen.o:	screen.c $(HFILES)
search.o:	search.c $(HFILES)
select.o:	select.c $(HFILES)
sigfile.o:	sigfile.c $(HFILES)
signal.o:	signal.c $(HFILES)
spooldir.o:	spooldir.c $(HFILES)
strftime.o:	strftime.c $(HFILES)
thread.o:	thread.c $(HFILES)
wildmat.o:	wildmat.c
win32.o:	win32.c win32.h
xref.o:		xref.c $(HFILES)