#
# Makefile version = "$Id: Makefile,v 1.5 2001/05/01 19:20:03 jamesp Exp $"
#

include ../Makefile.inc

#
# linux commands
#

# SHELL=		/bin/bash
CC=		gcc
OPT=		-O
CURSES=	$(shell if [ -f /usr/lib/libncurses.a ]; then echo ncurses; else echo curses; fi)

#
# Ditty compiler options
#

VERSION=  -DDIGI_VERSION=\"$(TRUE_VERSION)\"

APP_OPTS= $(VERSION)

#
# Production targets
#

all:	ditty

ditty:	ditty.c 
	$(CC) ${APP_OPTS} -o ditty $(OPT) -D_DGRP_ -I../commoninc ditty.c -l$(CURSES)
	: strip ditty

#
# Utility
#

install:
	install -d -m 755 $(DITTYBIN)
	install -d -m 755 $(DITTYMAN)
	install -m 755 ditty $(DITTYBIN)/$(DITTYNAME)
	install -m 644 ditty.man $(DITTYMAN)/$(DITTYNAME).1

# TODO: check and make sure no other packages are 
# using the ditty program
uninstall:
	-rm -f $(DITTYBIN)/$(DITTYNAME)
	-rm -f $(DITTYMAN)/$(DITTYNAME).1*
	-rm -f /var/catman/cat1/$(DITTYNAME).1*

clean: 
	rm -f *.o ditty

clobber:	clean
	rm -f *.o.??.?? ditty.??.??

.PHONY: all kernel clean clobber install uninstall
