###########################################
########### EARS Makefile #################
###########################################




LD	= ld
CC 	= gcc
CFLAGS	= -O2 -g #-Wall 
LDFLAGS = -s
LDLIBS  = #-lX11 -lm


EARSDIR = /usr/local/ears
EARSLOG = ears.log
SYSMAN  = /usr/man/man1
PROG	= ears
HEAD	= ears.h
SRC	= ears.c c_report.c c_snoop.c c_trace.c c_kill.c c_stat.c \
          c_misc.c utils.c traceroute.c c_deny.c pm.c
OBJ	= ears.o c_report.o c_snoop.o c_trace.o c_kill.o c_stat.o \
          c_misc.o utils.o traceroute.o c_deny.o pm.o 


all:	.depend $(PROG)

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

ears:	$(OBJ)
	$(CC) $(LDFLAGS) -o $@ $^ $(LDLIBS)

dep depend .depend: $(SRC) $(HEAD) 
	gcc -M $(SRC) > .depend


clean:	
	rm -rf *.o ears .depend core

install:
	strip $(PROG)
	install -d $(EARSDIR)
	install -g 0 -o 0 -m 700 $(PROG) $(EARSDIR) 
	install -g 0 -o 0 -m 644 ears.1 $(SYSMAN)
	install -g 0 -o 0 -m 600 $(EARSLOG) $(EARSDIR)
	install -g 0 -o 0 -m 600 CERT_FORM $(EARSDIR)
	ln -s $(EARSDIR)/ears /usr/local/sbin/ears

uninstall:
	rm -rf /usr/local/ears
	rm /usr/local/sbin/ears
	rm /usr/man/man1/ears.1
