# makefile for mgif
#
# date:    Sat Dec  8 01:34:24 1990
# version: 1.0
#

# need this to deal with .l file which make thinks is lex input (.l.c)
# first one clears, second adds just what we need here...
#
.SUFFIXES:
.SUFFIXES:	.c .s .o .man .cat .ttp

# this can be either sect l or sect 1/subsec l...
SECT		= l
SUBSECT		=
TARGET		= mgif.ttp
MANPAGE		= mgif.$(SECT)$(SUBSECT)
CATPAGE		= mgif.cat
MANSRC		= mgif.man
ARCFILE		= mgif.arc
SHARFILE	= mgif.shr
UUEFILE		= mgif.uue
HEADERS		= 
SRCS		= mgif.c setjmp.s
OBJS		= mgif.o #setjmp.o
OTHERS		= readme makefile $(MANSRC)
DISTFILES	= $(OTHERS) $(SRCS)

CFLAGS		=
LDFLAGS		= -s -nf
LIBS		= -llinea
BINDIR		= c:\local\bin
MANDIR		= c:\man\man$(SECT)
RUNPARM		=
RUNOUT		=



# directions...
#
directions:
		@echo type "make all" to built $(TARGET)
		@echo type "make pi3" to built pi3.ttp
		@echo type "make install" to built/install $(TARGET)
		@echo type "make test" to test $(TARGET)
		@echo type "make clean" to remove objects
		@echo type "make clobber" to remove objects and $(TARGET)
		@echo type "make arc" to make source archive $(ARCFILE)
		@echo type "make shar" to make source shar file $(SHARFILE)
		@echo type "make uue" to make uuencoded $(TARGET) $(UUEFILE)


# main target...
#
all:		$(TARGET)

$(TARGET):	$(OBJS)
		$(CC) $(LDFLAGS) -o $(TARGET) $(OBJS) $(LIBS)

pi3:		pi3.ttp

pi3.ttp:	pi3.c
		$(CC) $(LDFLAGS) -o pi3.ttp pi3.c


# manpage (use built-in .man.cat rule)...
#
manpage:	$(MANPAGE)

$(MANPAGE):	$(CATPAGE)
		colcrt $(CATPAGE) >tmp.cat
		entab tmp.cat $(MANPAGE)
		rm tmp.cat

$(CATPAGE):	$(MANSRC)



# to run it...
#
test:		$(TARGET)
		$(TARGET) $(RUNPARM) $(RUNOUT)


# to install it...
#
install:	install_bin install_man

install_bin:	$(TARGET)
		cp $(TARGET) $(BINDIR)$(TARGET)

install_man:	$(MANPAGE)
		cp $(MANPAGE) $(MANDIR)$(MANPAGE)


# others...
#
clean:
		rm $(OBJS) errs $(CATPAGE)

clobber:	clean
		rm $(TARGET) $(MANPAGE)

arc:
		$(ARC) a $(ARCFILE) $(DISTFILES)
		@echo done making $(ARCFILE)

uue:
		$(UUENCODE) $(TARGET)
		@echo done making $(UUEFILE)

shar:
		$(SHAR) $(DISTFILES) >$(SHARFILE)
		@echo done making $(SHARFILE)


# dependencies...
#
mgif.o:		mgif.c

setjmp.o:	setjmp.s

