# $Copyright:	$
# Copyright (c) 1991,1992,1993 by Steve Baker
# All rights reserved
#  
# This software is provided as is without any express or implied
# warranties, including, without limitation, the implied warranties
# of merchantability and fitness for a particular purpose.
#
#
# K&R compilers only for now:
# Making this program ANSI would be a good project for someone eh?

CC = cc

#  Add these defines if required:
#	-DCANNOT_ALLOCA		- Set it anyway
#	-DNOSETENV		- For OS's with no setenv function like NeXT's

CFLAGS = -O0 -s -DCANNOT_ALLOCA

#CFLAGS = -g -DCANNOT_ALLOCA
#CFLAGS = -g -DCANNOT_ALLOCA -DNOSETENV
#CFLAGS = -g -DDEBUG -DCANNOT_ALLOCA

ARCHIVE = Makefile ssh.1 NOTES COPYING README MODS DISTRIBUTION INSTALLING \
	  alias.c assign.c init.c key.c parse.c exe.c shcmds.c stat.c \
	  shell.c wc.c vars.c eval.c file.c shell.h cmds.h scripts

OFILES = alias.o assign.o init.o key.o parse.o exe.o shcmds.o stat.o \
	  shell.o wc.o vars.o eval.o file.o

LFILES = alias.c assign.c init.c key.c parse.c exe.c shcmds.c stat.c \
	 shell.c wc.c vars.c eval.c file.c

# These files are for debugging, you don't have these, so don't worry about
# it.
# mem/mem.o mem/smem.o mem/malloc.o

LIBS = -ltermcap

# shells initial destination location and name before installing.
DEST = ssh

# Shells final destination.
BINDEST = /usr/local/bin/ssh

# manuals destination:
MANFILE = ssh.1
MAN = ssh.man
MANDEST = /usr/man/man1/ssh.1

# Archive filenames for lha and tar format.
LHAFILE = ssh.v1.7.lha
TARFILE = ssh.v1.7.tar

all:	ssh man


ssh:	$(OFILES)
	$(CC) $(CFLAGS) -o $(DEST) $(OFILES) $(LIBS)


man:
	nroff -man $(MANFILE) > $(MAN)


install:
	cp $(DEST) $(BINDEST)
	cp $(MAN) $(MANDEST)


clean:
	rm -f $(OFILES) $(DEST) $(MAN)


#
#

$(OFILES):	shell.h


# Run lint on the bugger...
lint:
	lint -v $(LFILES)


# Make the tar file...
tar:
	tar cf $(TARFILE) $(ARCHIVE)
	compress $(TARFILE)

# Make the LHA file...
lha:
	lha cv $(LHAFILE) $(ARCHIVE)

# Make silly shar files...
shar:
	makekit -s60k $(ARCHIVE)
