# Makefile for cancan 2.5.0b
# Please read 'compile.how' to see how to compile it on different systems
#
# add the following -D's to CFLAGS:
#
# -DVT100 	if you have no termcap and want to hard-code for vt100 escape
#		sequences
# -DLINES=nn	if you defined VT100 and your terminal hasn't 24 lines but nn
# -DMOTDFILE=fn	set the motd file name
# -DUSETERMIO	if your OS prefers termio instead of BSD ioctls;
#               generally, define USETERMIO on system V systems and not on
#               BSD derivatives. On some systems it doesn't matter.
# -DAPOLLO      some reported fixes to make it run on apollo with sys5.3
# -DAIX		use this if you are using AIX
# -DNOSTRDUP	if your library lacks the strdup() function
#
# -DNOSHELL	if you do not wish to compile in the "#!" shell escape
# -DNOSORT	if you do not want aliases and actions to be sorted
#
# -DNOBZERO     if your system doesn't have bzero
# -DNOBCOPY     if your system doesn't have bcopy
#
# -DTELNETBUG   if you use NCSA telnet 2.2 for PC which doesn't reset the
#		colour properly. This is just a kludgy hack, in fact.
#
# For most systems, no options (or just -DUSETERMIO alone) is enough.
#
# This is where to put a message-of-the-day file:
MOTD=\"/home/f91/f91-men/client/motd\"

CFLAGS=-DUSETERMIO -DMOTDFILE=$(MOTD) -DTELNETBUG -Wall -g

# Compiler: gcc or cc should work (I use only K&R C).
CC=gcc

# Libraries: if VT100 is defined above, you don't need -ltermcap.
LDFLAGS= -ltermcap

# TERM support
# term directory.  where you have term's client.a and client.h hidden
TERMDIR = /usr/local/src/term114

SOURCES=cancan.c tel.c term.c beam.c cmd.c list.c mapping.c edit.c
OBJECTS=cancan.o tel.o term.o beam.o cmd.o list.o mapping.o edit.o
ALLFILES=Makefile $(SOURCES) cancan.h cmd.h edit.h term.h \
	 cancan.6 cancan.doc README NEWS TODO HACKING change.log compile.how \
	 make_it README.term

NAME=cancan
CANCANVERSION=2.5.0b

$(NAME): $(OBJECTS)
	$(CC) -o $(NAME) $(OBJECTS) $(LDFLAGS)

term$(NAME): $(SOURCES)
	$(MAKE) LDFLAGS="$(TERMDIR)/client.a $(LDFLAGS)" \
		CFLAGS="$(CFLAGS) -I$(TERMDIR) -DTERM -DTERM_COMPRESS" \
		NAME="term$(NAME)" term$(NAME)

$(OBJECTS): cancan.h cmd.h edit.h term.h

shar: cancan.shar

cancan.shar: $(ALLFILES)
	shar $(ALLFILES) >cancan$(CANCANVERSION).shar

clean:
	rm -f cancan termcancan cancan*.tar* *.o \#* *~ core

tar: 	$(ALLFILES)
	tar cvf cancan$(CANCANVERSION).tar $(ALLFILES)
	compress cancan$(CANCANVERSION).tar

tgz: 	$(ALLFILES)
	tar czvf cancan$(CANCANVERSION).tgz $(ALLFILES)
