# $Id: Makefile,v 1.4 1992/06/18 20:43:23 aggarwal Exp $
#
# Makefile for 'netmon'
#
# 
# ETC is used for dumping the HELPFILE in that directory

## SET THIS
# Directories needed by the Makefile
TOP = 		/usr/nocol
SRCDIR =	$(TOP)/src

BINDIR = 	$(TOP)/bin
ETCDIR = 	$(TOP)/etc
INCLUDEDIR = 	$(SRCDIR)/include

## SET THIS
# Directories needed by the program.
DATADIR = 	$(TOP)/data
MSGSDIR =	$(TOP)/msgs
HELPFILE = 	$(ETCDIR)/nocol-help

## SET THIS
# The special system definitions. Define:
#	-DNETLOG		If you want to enable invoking netlog from
#				within 'netmon'
SYSDEFS =

## SET THIS
# If your system does not have putenv() in your library, then define
# NEEDOBJS to putenv.o
# NEEDOBJS =	putenv.o

####
#### Can leave the rest alone #######
####

##
# The various directories that are needed in the program. Should NOT
# have trailing '/'.
DIRDEFS =	-DDATADIR=\"$(DATADIR)\" \
		-DMSGSDIR=\"$(MSGSDIR)\" \
		-DHELPFILE=\"$(HELPFILE)\"

# Compilation definitions
CC = 		cc
CDEFS =		$(DIRDEFS) $(SYSDEFS)
LIBS = 		-lcurses -ltermcap
CFLAGS = 	-g -I$(INCLUDEDIR)

OBJECTS = 	build_display.o event_dpy.o fill_window.o filter.o \
		help_page.o  msg_dpy.o netmon.o parse_input.o \
		poll_input.o read_filter.o setup_display.o utils.o


netmon:	$(OBJECTS) $(NEEDOBJS) Makefile
	$(CC) $(CFLAGS) $(NEEDOBJS) $(OBJECTS) $(LIBS) -o netmon


.c.o:
	$(CC) $(CFLAGS) -c  $(CDEFS) $<

## The dependencies in case 'mkdep' not used
#
$(OBJECTS): $(INCLUDEDIR)/nocol.h $(INCLUDEDIR)/netmon.h

install:	netmon
	@[ -d $(TOP) ] || mkdir  $(TOP)
	@[ -d $(DATADIR) ] || mkdir $(DATADIR)
	@[ -d $(ETCDIR) ] || mkdir $(ETCDIR)
	@[ -d $(BINDIR) ] || mkdir $(BINDIR)
	@[ -d $(MSGSDIR) ] || mkdir $(MSGSDIR)
	install -c -m 751 netmon $(BINDIR)/nocol
	install -c -m 0444 nocol-help $(HELPFILE)


clean:
	/bin/rm -f $(OBJECTS) netmon core a.out


rcs:
	@echo "Doing 'rcs' in 'netmon'"
	@-for i in $(OBJS); do \
		$(CO) -q `basename $$i .o`.c ;\
	  done

