# $Id: Makefile,v 30000.21 1993/05/25 00:50:23 kkeys Exp $
###########################################################################
# 
#  TinyFugue Makefile
# 
###########################################################################
# 
#  Do not edit this file.
#  All installation options are in the "Build" file.
#
#  Just type "Build" to install everything.
# 
###########################################################################


FILES      = -DTFLIBRARY=\"$(TFLIBRARY)\" -DTFCONNECT=\"$(TFCONNECT)\" \
             -DMAILDIR=\"$(MAILDIR)\"
CFLAGS     = $(FLAGS) $(FILES) $(CONNECT) $(RESTRICT) $(OPT)
CFLAGSNOPT = $(FLAGS) $(FILES) $(CONNECT) $(RESTRICT)
SHELL      = /bin/sh
BUILDERS   = Makefile ../Makefile ../Build ../Config
SOURCE     = main.c world.c util.c socket.c keyboard.c macro.c search.c \
             command1.c command2.c special.c history.c process.c output.c \
             expand.c dstring.c help.c signal.c variable.c tfio.c
CONSOURCE  = tf.connect.c


all install instructions:
	@echo 'Use "Build" to compile and install TinyFugue.'
	@echo 'Read the README file if you have any questions.'

default:  $(EXE) $(TFCONNECT) HELP $(MANPAGE)

tf:     $(OBJS) $(BUILDERS)
	$(CC) $(CFLAGS) -o tf $(OBJS) $(LIBS)

EXE $(EXE): tf $(BUILDERS)
	cp tf $(EXE)
	chmod $(MODE) $(EXE)

tf.connect: tf.connect.c tf.connect.h opensock.o prototype.h $(BUILDERS)
	$(CC) $(CFLAGS) -o tf.connect tf.connect.c opensock.o $(LIBS);

TFCONNECT $(TFCONNECT): tf.connect $(BUILDERS)
	cp tf.connect $(TFCONNECT)
	chmod $(MODE) $(TFCONNECT)

TFLIBRARY $(TFLIBRARY): $(BUILDERS) tf.library
	rm -f $(TFLIBRARY)
	sed '/__HELPFILE__/s;;$(HELPFILE);g' <tf.library> $(TFLIBRARY)
	chmod $(MODE) $(TFLIBRARY)
	chmod ugo-wx $(TFLIBRARY)

MANPAGE $(MANPAGE): $(BUILDERS) tf.1.$(MANTYPE)man
	cp tf.1.$(MANTYPE)man $(MANPAGE)
	chmod $(MODE) $(MANPAGE)
	chmod ugo-x $(MANPAGE)

HELP: $(HELPFILE) $(HELPFILE).index $(BUILDERS)

$(HELPFILE).index: $(HELPFILE) tf.help.index $(BUILDERS)
	cp tf.help.index $(HELPFILE).index
	chmod $(MODE) $(HELPFILE).index
	chmod ugo-x $(HELPFILE).index

HELPFILE $(HELPFILE): $(BUILDERS) tf.help
	cp tf.help $(HELPFILE)
	chmod $(MODE) $(HELPFILE)
	chmod ugo-x $(HELPFILE)

makehelp: makehelp.c $(BUILDERS)
	$(CC) $(CFLAGS) -o makehelp makehelp.c

tf.help.index: tf.help $(BUILDERS)
	$(MAKE) CC='$(CC)' CFLAGS='$(FLAGS)' makehelp
	./makehelp

tf.1.catman:  tf.1.nroffman
	TERM=vt100; nroff -man tf.1.nroffman > tf.1.catman

$(BUILDERS):

uninstall:
	rm -f $(EXE) $(TFCONNECT) $(TFLIBRARY) $(MANPAGE)
	rm -f $(HELPFILE) $(HELPFILE).index

clean:
	rm -f *.o libc.cont makehelp core*

cleaner: clean
	rm -f tf tf.connect

cleanest: cleaner
	rm -f tf.1.catman tf.help.index



# Note the absence of $(OPT) in the socket.o rule.
socket.o : socket.c tf.h prototype.h tfio.h search.h variable.h util.h \
  dstring.h history.h world.h tf.connect.h socket.h output.h process.h \
  macro.h keyboard.h command1.h command2.h special.h signal.h opensock.h \
  $(BUILDERS)
	$(CC) $(CFLAGSNOPT) -c socket.c

command1.o : command1.c tf.h prototype.h tfio.h search.h variable.h dstring.h \
  util.h history.h world.h socket.h output.h macro.h help.h process.h \
  keyboard.h expand.h \
  $(BUILDERS)
command2.o : command2.c tf.h prototype.h tfio.h search.h variable.h dstring.h \
  util.h macro.h world.h history.h keyboard.h output.h command1.h socket.h \
  $(BUILDERS)
dmalloc.o : dmalloc.c \
  $(BUILDERS)
dstring.o : dstring.c tf.h prototype.h tfio.h search.h variable.h dstring.h \
  util.h \
  $(BUILDERS)
expand.o : expand.c tf.h prototype.h tfio.h search.h variable.h dstring.h \
  util.h macro.h world.h history.h command1.h output.h signal.h socket.h \
  $(BUILDERS)
help.o : help.c tf.h prototype.h tfio.h search.h variable.h dstring.h util.h \
  output.h \
  $(BUILDERS)
history.o : history.c tf.h prototype.h tfio.h search.h variable.h dstring.h \
  util.h history.h world.h socket.h expand.h output.h macro.h \
  $(BUILDERS)
keyboard.o : keyboard.c tf.h prototype.h tfio.h search.h variable.h dstring.h \
  util.h macro.h world.h history.h output.h socket.h expand.h \
  $(BUILDERS)
macro.o : macro.c tf.h prototype.h tfio.h search.h variable.h dstring.h util.h \
  world.h history.h macro.h keyboard.h output.h expand.h socket.h command1.h \
  $(BUILDERS)
main.o : main.c tf.h prototype.h tfio.h search.h variable.h dstring.h util.h \
  history.h world.h socket.h macro.h output.h signal.h keyboard.h command1.h \
  command2.h \
  $(BUILDERS)
opensock.o : opensock.c tf.h prototype.h tfio.h search.h variable.h tf.connect.h\
  $(BUILDERS)
output.o : output.c tf.h prototype.h tfio.h search.h variable.h dstring.h \
  util.h world.h history.h socket.h output.h macro.h \
  $(BUILDERS)
process.o : process.c tf.h prototype.h tfio.h search.h variable.h dstring.h \
  util.h history.h world.h socket.h expand.h output.h macro.h \
  $(BUILDERS)
search.o : search.c tf.h prototype.h tfio.h search.h variable.h dstring.h util.h\
  $(BUILDERS)
signal.o : signal.c tf.h prototype.h tfio.h search.h variable.h util.h \
  dstring.h process.h world.h history.h keyboard.h output.h socket.h \
  $(BUILDERS)
special.o : special.c tf.h prototype.h tfio.h search.h variable.h dstring.h \
  util.h world.h history.h socket.h macro.h output.h \
  $(BUILDERS)
tf.connect.o : tf.connect.c prototype.h tf.connect.h opensock.h \
  $(BUILDERS)
tfio.o : tfio.c tf.h prototype.h tfio.h search.h variable.h dstring.h util.h \
  output.h macro.h world.h history.h \
  $(BUILDERS)
util.o : util.c tf.h prototype.h tfio.h search.h variable.h dstring.h util.h \
  output.h macro.h world.h history.h keyboard.h socket.h signal.h \
  $(BUILDERS)
variable.o : variable.c tf.h prototype.h tfio.h search.h variable.h util.h \
  output.h macro.h world.h history.h socket.h \
  $(BUILDERS)
world.o : world.c tf.h prototype.h tfio.h search.h variable.h dstring.h util.h \
  history.h world.h output.h process.h macro.h \
  $(BUILDERS)
dmalloc.o: dmalloc.c tf.h prototye.h \
  $(BUILDERS)

dist: tf.1.catman tf.help.index
	rm -f makehelp

# everything below here is platform dependent

dep: *.c
	gcc -MMD -E *.c >/dev/null
	cat *.d > dep
	rm *.d

tf.pixie: tf
	pixie -o tf.pixie tf

lint:
	lint $(CFLAGS) $(SOURCE) $(LIBRARIES)
	lint $(CFLAGS) $(CONSOURCE) $(LIBRARIES)

# The next line is a hack to get around a bug in BSD/386 make.
make:
