# Makefile for powwow
#
# Please try running 'make_it' and, if that fails, read 'Compile.how'
# to see how to compile it on different systems
#
# add the following -D's to CDEFS:
#
# -DUSE_VT100 	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
# -DUSE_SGTTY	if your OS prefers BSD ioctls instead of termio;
#               generally, define USE_SGTTY on BSD derivatives and not on
#		system V systems. On some systems it doesn't matter.
# -DUSE_REGEXP	turns on the possibility to create regular expression
#		actions. Requires the regex library
# -DUSE_RANDOM	if you have random() and srandom() functions instead
#		of lrand48() and srand48()
#
# -DDO_SORT	if you _do_ want aliases and actions to be sorted
# -DNO_SHELL	if you do not wish to compile in the "#!" shell escape
#
# -DAPOLLO      some reported fixes to make it run on apollo with sys5.3
# -DAIX		use this if you are using AIX
# -DBSD_LIKE    use this if you are using 386/BSD, FreeBSD or similar system.
#		usually needed together with -DUSE_SGTTY.
#
# -DBUG_TELNET	if you use NCSA telnet 2.2 for PC which doesn't reset the
#		colour properly. This is just a kludgy hack, in fact.
#
# -DBUG_ANSI	some terminals fill new lines with the current output
#		attribute, which prevents #mark and #hilite from working
#		correctly over line boundaries when coloured background
#		is in use. BUG_ANSI takes care of this.

# For most systems, no options (or just -DUSE_SGTTY alone) is enough.

CDEFS=

CFLAGS=$(CDEFS)

# Compiler: gcc or cc should work. An ANSI compiler is recommended.
CC=cc

# 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= main.c utils.c tcp.c tty.c beam.c cmd.c cmd2.c list.c map.c log.c edit.c eval.c ptr.c
OBJECTS= main.o utils.o tcp.o tty.o beam.o cmd.o cmd2.o list.o map.o log.o edit.o eval.o ptr.o
INCLUDES=main.h utils.h tcp.h tty.h beam.h cmd.h cmd2.h list.h map.h log.h edit.h eval.h ptr.h

NAME=powwow

all: echo strip movie_play movie2ascii follow catrw

echo:
	@echo
	@echo "WARNING: if you are coming from a 1.0.x version,"
	@echo "re-read Changelog and powwow.doc as many things have changed."
	@echo "In particular, syntax and effects of #prompt and #isprompt changed in 1.1.7"
	@echo "Press ENTER to continue..."
	@read dummy

strip: $(NAME)
	strip $(NAME)

$(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)

movie: movie.c
	$(CC) $(CFLAGS) -o movie movie.c
	strip movie

movie_play: movie
	ln -sf movie movie_play

movie2ascii: movie
	ln -sf movie movie2ascii

follow: follow.c
	$(CC) $(CFLAGS) -o follow follow.c
	strip follow

catrw: catrw.c
	$(CC) $(CFLAGS) -o catrw catrw.c
	strip catrw

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

spotless: clean
	rm -f powwow termpowwow follow catrw movie movie_play movie2ascii


# dependancies generated by `gcc -MM *.c >> Makefile'
beam.o: beam.c defines.h ptr.h main.h utils.h beam.h map.h tcp.h tty.h \
 edit.h eval.h
catrw.o: catrw.c
cmd.o: cmd.c defines.h ptr.h main.h utils.h beam.h cmd.h cmd2.h edit.h \
 list.h map.h tcp.h tty.h eval.h log.h
cmd2.o: cmd2.c defines.h ptr.h main.h utils.h beam.h edit.h list.h \
 map.h tcp.h tty.h eval.h
edit.o: edit.c defines.h ptr.h main.h utils.h cmd.h edit.h tcp.h tty.h \
 eval.h log.h
eval.o: eval.c defines.h ptr.h main.h utils.h cmd2.h list.h map.h \
 tty.h edit.h eval.h
follow.o: follow.c
list.o: list.c defines.h ptr.h main.h utils.h cmd2.h tty.h eval.h
log.o: log.c defines.h ptr.h main.h log.h tty.h list.h utils.h
main.o: main.c defines.h ptr.h main.h utils.h beam.h cmd.h cmd2.h \
 edit.h map.h list.h tcp.h tty.h eval.h log.h
map.o: map.c defines.h ptr.h main.h tty.h edit.h tcp.h
movie.o: movie.c
ptr.o: ptr.c defines.h ptr.h main.h utils.h eval.h
tcp.o: tcp.c defines.h ptr.h main.h utils.h tcp.h tty.h edit.h beam.h \
 log.h
tty.o: tty.c defines.h ptr.h main.h edit.h utils.h list.h tty.h tcp.h
utils.o: utils.c defines.h ptr.h main.h utils.h list.h cmd.h cmd2.h \
 beam.h tty.h edit.h eval.h log.h
