
###############################################################################
#									      #
# 		 Makefile for UNIX Interactive Tools 4.2a		      #
# 	   Copyright (c) Tudor Hulubei & Andrei Pitis, May 1994	              #
#									      #
#				 Politechnic University of Bucharest	      #
#									      #
###############################################################################


#  HAVE_LINUX	===> 	running on Linux operating system
#  HAVE_CONST	===>	the C compiler supports the 'const' keyword
#  HAVE_STATFS	===>	the kernel supports the 'statfs()' system call


# Linux
SYSCONFIG   =	-DHAVE_LINUX -DHAVE_CONST -DHAVE_STATFS

# Ultrix
# SYSCONFIG =


CFLAGS    =	-O2 $(SYSCONFIG)

LDFLAGS	    =   

CC          =	cc
CPP         =	$(CC) -E $(SYSCONFIG)
LD          =	ld
STRIP       =	strip
LEX	    =	lex
NROFF	    =	nroff
MAKEINFO    =   makeinfo

UITOBJS     =	tty.o window.o edit.o status.o panel.o uit.o config.o\
		termcap.o

UITCMPOBJS  =	uitcmp.o

UITPSOBJS   =	tty.o window.o config.o termcap.o uitps.o
UITVIEWOBJS =	tty.o window.o config.o termcap.o uitview.o

all:            uitmsg uit uitps uitview\
		uitcmp uitdone uitps.c uitcmp.c\
		window.c tty.c edit.c status.c panel.c uit.c config.c\
		termcap.l

uitmsg:
		@echo   "Making UNIX Interactive Tools 4.2a ..."

man:
		@echo   "Formatting the UNIX Interactive Tools 4.2a manual page ..."
		@echo   "WARNING: this will fail if your system doesn't have the nroff utility !"
		@echo	"The file uit.1 contains a pre-formatted version of the manual page."
		@echo	"(just in case ...)"
		@$(NROFF) -man uit.man > uit.man.1
		@echo	"UIT 4.2a manual page sucessfully formatted."
		@echo	"The new manual page was put in the file uit.man.1, preserving the"
		@echo	"original pre-formatted version, uit.1."
		@echo	"done"

info:
		@echo   "Compiling the UNIX Interactive Tools 4.2a info documentation ..."
		@echo   "WARNING: this will fail if your system doesn't have the makeinfo utility !"
		@echo	"The file uit.info.1 contains a pre-compiled version of the info documentation."
		@echo	"(just in case ...)"
		@$(MAKEINFO) uit.texi
		@echo	"UIT 4.2a info documentation sucessfully compiled."
		@echo	"done"

.l.c:
		@echo	-n "Generating termcap.c from" $*.l "... "
		@$(LEX) $*.l
		@mv 	lex.yy.c termcap.c
		@echo	"done"

.c.o:
		@echo	-n "Compiling" $*.c "... "
		@$(CC)	-c $(CFLAGS) $*.c
		@echo   "done"

uit:		$(UITOBJS)
		@echo	-n "Linking uit ... "
		@$(CC)	-o uit $(UITOBJS) $(LDFLAGS)
		@echo   "done"

		@echo   -n "Striping uit ... "
		@$(STRIP) uit
		@echo   "done"

uitps:		$(UITPSOBJS)
		@echo	-n "Linking uitps ... "
		@$(CC)	-o uitps $(UITPSOBJS) $(LDFLAGS)
		@echo   "done"

		@echo   -n "Striping uitps ... "
		@$(STRIP) uitps
		@echo   "done"

uitview:	$(UITVIEWOBJS)
		@echo	-n "Linking uitview ... "
		@$(CC)	-o uitview $(UITVIEWOBJS) $(LDFLAGS)
		@echo   "done"

		@echo   -n "Striping uitview ... "
		@$(STRIP) uitview
		@echo   "done"

uitcmp:		$(UITCMPOBJS)
		@echo	-n "Linking uitcmp ... "
		@$(CC)	-o uitcmp $(UITCMPOBJS) $(LDFLAGS)
		@echo   "done"

		@echo   -n "Striping uitcmp ... "
		@$(STRIP) uitcmp
		@echo   "done"

uitdone:
		@echo	"If you are using Linux please configure the .uitrc.TERM [Setup] section !"
		@echo	"done."

dep:
		@echo 	-n "Making dependencies ... "
		@sed 	'/\#\#\# Dependencies/q' <Makefile >tmp_make
		@(for n in *.c; do $(CPP) -MM $$n; done) >>tmp_make
		@mv 	tmp_make Makefile
		@echo 	"done"

clean:
		@echo	-n "Cleaning ... "
		@rm 	-f *.o *~ termcap.c core* uitps uitview uitcmp uit
		@rm	-f uit.man.1 uit.info
		@echo 	"done"

### Dependencies
config.o : config.c config.h 
edit.o : edit.c tty.h termcap.h window.h edit.h config.h 
panel.o : panel.c tty.h termcap.h window.h status.h config.h panel.h edit.h 
status.o : status.c tty.h termcap.h window.h status.h config.h 
tty.o : tty.c tty.h termcap.h 
uit.o : uit.c tty.h termcap.h window.h edit.h config.h status.h panel.h 
uitcmp.o : uitcmp.c 
uitps.o : uitps.c tty.h termcap.h window.h config.h 
uitview.o : uitview.c tty.h termcap.h window.h config.h 
window.o : window.c tty.h termcap.h window.h 
